Question: Consider the extensible array data structure. Consider the version in which there is no extra cost for allocating 2 new memory (the first version we
Consider the extensible array data structure. Consider the version in which there is no extra cost for allocating 2 new memory (the first version we looked at). Suppose that we want to add another operation to this data structure: Remove, which deletes the last element added. In order to make sure that the array doesn't take up too much space, we say that if the array is at least half empty, we will reallocate memory that is only half the size of the current array, and copy all the elements over. This is basically the opposite of the insertion operation from before. Repeat the amortized analysis process from class, and compare the result to the running time you'd get from the standard analysis. Does amortized analysis help? Why or why not?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
