Question: Consider the following modification to the Dynamic List implementation: Instead of doubling the size of the array, consider tripling the array every time the array
Consider the following modification to the Dynamic List implementation: Instead of doubling the size of the array, consider tripling the array every time the array is full. i.e: Initially the array has 1 cell, after this is filled up and a new element needs to be inserted, the size will then be expanded to 3. Similarly, after this is filled up and another element needs to be placed, it will now be increased to 9. Assume that each push operation and copy operation has a cost of 1 each, what is the approximate average cost of per insertion operation if 81 elements are inserted to the list. Assume that each push operation and copy operation has a cost of 1 each, what is the approximate average cost of per insertion operation if 82 elements are inserted to the list
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
