Consider an extendable table that supports both add and remove methods, as defined in the previous exercise.
Question:
Consider an extendable table that supports both add and remove methods, as defined in the previous exercise. Moreover, suppose we grow the underlying array implementing the table by doubling its capacity any time we need to increase the size of this array, and we shrink the underlying array by half any time the number of (actual) elements in the table dips below N/4, where N is the current capacity of the array. Show that a sequence of n add and remove methods, starting from an array with capacity N = 1, takes O(n) time.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Algorithm Design And Applications
ISBN: 9781118335918
1st Edition
Authors: Michael T. Goodrich, Roberto Tamassia
Question Posted: