Question: Let L be a dynamic list implemented as an array A. Initially the size of A is 1. Pushing an element to Lis equivalent to
Let L be a dynamic list implemented as an array A. Initially the size of A is 1. Pushing an element to Lis 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. Assume that each push operation (inserting element) and copy operation (copying element from old array to new array) has a cost of 1 each, what is the approximate average cost of per insertion operation if 513 elements are inserted to the list? (closest to the choices) Select one: a. 1 b.3 C. 513 d. log 513 e. 2
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
