Question: 6. (5 points) Let A be a dynamic array that - supports push and pop methods. - doubles in size whenever a push occurs when
6. (5 points) Let A be a dynamic array that - supports push and pop methods. - doubles in size whenever a push occurs when the array is already completely full, and - halves in size whenever the array becomes more than half empty, and - puab and pop do O(1) work (excluding resizing costs), while - resizing (either doubling or halving) is O(n) work. Give a starting condition for A and a sequence of n pushes and n pops such that a total of O(n2) work is done
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
