1.0 - Amortised Analysis

1.1 - Dynamic Table Example

Store an initially unknown number of elements in an array.

Typically, inserting an element into an array is constant time

Suppose our array initially has size 1.

  1. Inserting the first element into the array succeeds.

  2. Inserting the second element into the array fails, so we must construct a new array, copy over the old elements + new element.

  3. Following this, the insertion of the third element once again causes the array to over flow, and thus we must construct a new array, copying over the new elements.

1.1.1 - Tighter Analysis on Dynamic Table

Let c1= the cost of the ith insertion={i    if i1 is an exact power of 21otherwise\begin{aligned} c_1=&\ \text{the cost of the ith insertion}\\ =&\begin{cases}i\ \ \ \ &\text{if } {i-1}\text{ is an exact power of 2}\\ 1&\text{otherwise}\end{cases} \end{aligned}

From this, we get:

1.1.2 - Dynamic Table: Aggregate Method

🌱 Develop a summation, and solve it for nn operations. Develop bound for that series of operations.

1.2 - Stack Operations

1.2.1 - Aggregate Method

1.2.2 - Accounting Method

1.2.3 - Potential Method