Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4. (20 points) Recall that we investigated in studio the asymptotic complexity of im plementing a list using an array. When the array became full,
4. (20 points) Recall that we investigated in studio the asymptotic complexity of im plementing a list using an array. When the array became full, we tried at least the following two strategies to accommodate the new elements given that the array was already full: . Allocate a new array whose size is exactly one slot bigger than the old, full array . Allocate a new array whose size is twice the size of the old, full array For either approach, assume that the size of the very first (initial) array is 1, and you (a) (6 points) Recalling our work from studio, what expression represents the total i. (3 points) the new array's size is just one element bigger than the old, full can assume that n below is a power of 2. work done to insert n elements into the array list, when arr ii. (3 points) the new array's size is twice the size of the old, full array: e- ) (b) (14 points) Now suppose we are going to the oppposite of what we did in studio. Instead of creating newer larger arrays to accommodate more elements in our array-based list, we are going to remove elements from the array, and replace a larger, less full array with a smaller, full one. We do this by n delete operations on our array-based list that, from the perspective of this problem, initially contained n elements, and we study two scenarios; i. (7 points) When an element is deleted, we replace the old array by one with exactly one fewer element. As with problem 3, that involves allocating a new array, and copying some elements from the old array into the new one. Below develop a summation expression T(n) for the amount of time needed to delete n elemnts from the array-based list that initially contained n elements. Your answer below must explicitly show the asymptotic work performed by each call to delete, as the list goes from n to 0 elements. After developing that expression, state its closed form using (-..) notation. CSE 247 (Exam I) 7- Due by End of sessiorn ii. (7 points) When an element is deleted, we see if the current array is half full. If so, we allocate the newer, smaller array to be half the original array's size, and copy over the elements as above. As before, develop T(n) as the summation expression for the work performed to go from n (a power of 2) to 0 elements, and state its closed form solution using (--) notation
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started