Question: Exercise 5. (8 points) Consider an implementation of a stack ADT using an extendable array, but instead of dou bling the size, when an array

Exercise 5. (8 points) Consider an implementation of a stack ADT using an extendable array, but instead of dou bling the size, when an array of size N is full, you create a new array of size N +4. Assume you start with an array of size 0 (i.e., the first push is a special push): 1) What is the cost of the 5th push? 2) how many normal push can be performed betweern any two special push? 3) what is the cost of the i-th special push? 4) what is the overall cost of performing n push (give the exact formula as well as the big Oh characterization)? Exercise 5. (8 points) Consider an implementation of a stack ADT using an extendable array, but instead of dou bling the size, when an array of size N is full, you create a new array of size N +4. Assume you start with an array of size 0 (i.e., the first push is a special push): 1) What is the cost of the 5th push? 2) how many normal push can be performed betweern any two special push? 3) what is the cost of the i-th special push? 4) what is the overall cost of performing n push (give the exact formula as well as the big Oh characterization)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
