Data-structures 3

Dynamic array

This array doubles in size each time an insertion is made but the array is fullResizing is an O(n) operation as it requires copying all elementsLet Φ(Di)=2niliLet P(ni)=ci+(Φ(Di)Φ(Di1))i=1nP(ni)=i=1nci+Φ(Dn)Φ(D0)==n+(2nn)(0k)=2n+k2nAmortized complexity is O(2nn)=O(1)