Về Chương 2
Thao T�c M?ng
10
0
20
1
30
2
40
3
50
4
Operation Panel
Index (k)2
05
System Log
Waiting for command...

💡 Why is this costly?

  • Arrays are contiguous blocks of memory.
  • To insert at index k, we must physically move everything from k to N one step right to make room.
  • To delete at k, we must shift everything from k+1 to N one step left to plug the hole.
  • Worst case (Insert at 0): We move N elements. Thus, complexity is O(N).