Question: Consider an array list implementation with a removeLast method that shrinks the internal array to half of its size when it is at most half
Consider an array list implementation with a removeLast method that shrinks the internal array to half of its size when it is at most half full. Give a sequence of addLast and removeLast calls that does not have amortized O(1) efficiency.
Step by Step Solution
3.58 Rating (148 Votes )
There are 3 Steps involved in it
To explain this lets first define a few things addLast This method adds an element to the end of the list Normally this operation is O1 but it can pot... View full answer
Get step-by-step solutions from verified subject matter experts
