I have the following table that compares different operation complexities for a linked list and array:
Linked List | Array | Dynamic Array
Deletion at ending O(n) | O(1) | O(n)
Insertion in middle O(n) | O(n) | O(n)
Deletion in middle O(n) | O(n) | O(n)
Can anyone please explain why:
- Deletion for Dynamic Array is
O(n)
? - Insertion and deletion in middle for all data structures is
O(n)
?
Thanks