Let 
 denote the number of elements present on the stack after 
 operations (including push and pop). 
Let 
 denote the allocated size of the stack after 
 operations. We Define a potential energy function 
 as follows.
Clearly
The amortized cost of the push operation which requires doubling of the array is as follows.
The amortized cost of the pop
From the above we can see that that amortized cost of all the operations is
(b)
Let the load factor
"When 
 (i.e. the array is full) increase the size of the array by 
 times. 
When 
 (i.e. the array about to under flow) reduce the size of the array
by half (
)".
We define the following potential function and finally show that the amortized complexity of each of
the operations push, pop is 
.
We now prove that the amortized cost of each operation is bounded by a constant. From the
previous problem (since the potential function is same as the previous problem when 
) 
we can observe that push operation when 
 (expansion) has an amortized cost of 
. We can also observe that whenever expansion does not occur the amortized cost of the push operation
is 
. So we will concentrate on the other possible situations. We use the notation 
 to 
indicate the load factor of the array after 
 operations on the array. 
Amortized cost of push when 
 
 
Amortized cost of push when 
, 
 
Amortized cost of pop when 
 
Amortized cost of pop when 
 
Amortized cost of pop when 
 and 
 
Amortized cost of pop when 
 with compaction
If the 
We have proved that the amortized cost of both push and pop with all possible values
of the load factor 
 to be 
.
