Question: Suppose the ArrayList implementation of Section 16.2 had a removeLast method that shrinks the internal array by 50 percent when it is less than 25
Suppose the ArrayList implementation of Section 16.2 had a removeLast method that shrinks the internal array by 50 percent when it is less than 25 percent full. Show that any sequence of addLast and removeLast calls has amortized O(1) efficiency.
Step by Step Solution
3.23 Rating (155 Votes )
There are 3 Steps involved in it
To evaluate this lets use an amortized analysis technique known as the potential met... View full answer
Get step-by-step solutions from verified subject matter experts
