Jump to content

File:ArrayListAmotizedPush.png

Page contents not supported in other languages.
This is a file from the Wikimedia Commons
From Wikipedia, the free encyclopedia
    Original file (640 × 480 pixels, file size: 18 KB, MIME type: image/png)

    Summary

    Description
    English: The original picture in https://en.wikipedia.org/wiki/Amortized_analysis#Dynamic_array is not right as it show an ArrayList with no space preallowcated. So I fix it.

    I use matplotlib Python3 library to draw this picture.

    Code:

    import matplotlib.pyplot as plt
    
    xaxis = list(range(1, 11))
    data = [1, 1, 1, 1, 5, 1, 1, 1, 9, 1]
    
    plt.bar(xaxis, data)
    
    plt.xlabel("Push iteration")
    plt.ylabel("Time Cost")
    
    plt.title("ArrayList\nAmortized Push Operations")
    
    plt.xticks(xaxis)
    plt.yticks(data)
    
    plt.show()
    
    Date
    Source Own work
    Author Mxxxr

    Licensing

    I, the copyright holder of this work, hereby publish it under the following license:
    Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
    The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

    Captions

    Example for push operation in ArrayList

    Items portrayed in this file

    depicts

    27 September 2023

    18,137 byte

    480 pixel

    640 pixel

    image/png

    75cf7314f6f867e899888414d20f2a98f2da1588

    File history

    Click on a date/time to view the file as it appeared at that time.

    Date/TimeThumbnailDimensionsUserComment
    current14:31, 27 September 2023Thumbnail for version as of 14:31, 27 September 2023640 × 480 (18 KB)MxxxrUploaded own work with UploadWizard

    The following page uses this file: