Question: Problem 1 ( Extendable arrays ) a ) We've looked at two ways to grow extendable arrays, with incremental and doubling approaches. How about a
Problem Extendable arrays
a We've looked at two ways to grow extendable arrays, with incremental and doubling
approaches. How about a new approach, which does the following, where N is the current
capacity of the array:
when there are N elements and we insert one more, the array is extended by so
the new capacity is ceil where ceil is the integer "ceiling" of the number.
Show that with this approach, a sequence of n insert operations, starting from an extendable
array of capacity takes time.
b What can you conclude about the amortized time of the insert operations for the extendable
array in a Justify your conclusion using definitions.
c We want to try yet another approach, which does the following, where N is the current
capacity of the array:
when there are N elements and we insert one more, the array is extended by square root
of N cells, so the new capacity is ceil
Show that with this approach, a sequence of n insert operations, starting from an extendable
array of capacity takes time.
d What can you conclude about the amortized time of the insert operations for the extendable
array in c Justify your conclusion.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
