Amortized analysis

unable to understand arralist add amortized analysis

Hi @sudhanshusoni500,
See the basic concept is that if you have to insert a element in arraylist and the size of arraylist currently is a power of 2 then the arraylist will increase its size and hence will have to push the already inserted elements to the new arraylist which is of double size than old array list hence in the video sir is trying to count number of operations it took to add 16 elements and then he divided (number of operations)/(number of values added) to get a average value of time taken in one insertion which came out to be approximately 2. So this kind of method where you find time complexity after taking average of operations that is called amortized analysis.

1 Like

Got it :heart_eyes:… thanks @ivishalydv

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.