Question: Recall our implementation of the ArrayBag class that used a dynamic resizing strategy for the underlying array. Specifically, the add method checked to see if

Recall our implementation of the ArrayBag class that used a dynamic resizing strategy for the underlying array. Specifically, the add method checked to see if the array was full and used the resize method to double the capacity of the elements array, as shown below. public boolean add (T element) {if (isFull ()) {resize (size * 2);} elements [size] = element; size ++ return true;} The resize method is O(N), but we said that the overall add method was O(1) by using what analysis technique? A. best case analysis B. worst case analysis C. amortized analysis D. doubling analysis
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
