Question: Resizing Downward? We can describe a downsizing policy using a criteria and action as well. The first policy we will explore is when the array

 Resizing Downward? We can describe a downsizing policy using a criteria

Resizing Downward? We can describe a downsizing policy using a criteria and action as well. The first policy we will explore is "when the array becomes half full, resize its capacity by a factor of 1/2." or more succinctly. "if n1c/2 update c 0/2n Assuming an initial capacity of 1 , an upward policy that says to "resize the array by a factor of 2 when the array overfils," and a downward policy that says to "resize the array by a factor of 1/2 when the array becomes half full", give a sequence of 3n stack operations whose total cost is at least 2n2. In this problem, "cost" is the total number of additions (pushes), removals (pops), and copies (when resizing). For simplicity, please assume n is a power of 2. This example demonstrates the existence of a sequence of operations whose amortized cost, per operation is: (a) (nlogn) (b) (1) (c) (n2) (d) (logn) (e) (n) and this implies that the policy described above is not a good one

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!