Amortized Analysis of Spreading and Gathering
Explore the amortized cost of the spread and gather operations in SEList, a linked list variant. Understand how these methods impact the performance of add and remove operations, and learn to analyze their efficiency using the potential method in amortized analysis.
We'll cover the following...
We'll cover the following...
Next, we consider the cost of the gather(u) and spread(u) methods that may be executed by the add(i, x) and remove(i) methods. For the sake of completeness, here they are:
...
Amortization
The running time of each of these methods is dominated by the two nested loops. Both the inner and outer loops execute at most times, so the total running time of each of these ...