Question: Let L be a dynamic list implemented as an array A. Initially the size of A is 1. Pushing an element to L is equivalent
Let L be a dynamic list implemented as an array A. Initially the size of A is 1. Pushing an element to L is equivalent to adding an element to the end of the array. Once A is filled up, a new array A is initialized, with a size that is double of array A, and all the contents of the earlier array A will be transferred to the new array. What is the size of array A if 24 elements are already in it? If the array A has n elements, what is the worst case complexity of inserting an element in the list? What is the amortized cost of inserting an element into the dynamic list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
