I was going over this page:
And I had the following questions:
Does Insertion and Deletion in this table mean insertion and deletion at the end only?
For Basic Array, why is insertion and deletion for average and worst case marked as -
?
What does Indexing mean in the table? Does it mean Accessing?
Why is Insertion and Deletion of Dynamic Array O(n)?
Why is the index of Linked List O(n) while that of Dynamic Array O(1)? Is it because Dynamic Array is continuous and could be accessed directly by pointer arithmetic, while for a linked list a linear search would be needed?
Does Insertion and Deletion in this table mean insertion and deletion at the end only?
No. Those reflect random insertion and deletion.
For Basic Array, why is insertion and deletion for average and worst case marked as -
?
Because "Basic Array" is a static array structure. You cannot insert or delete elements.
What does Indexing mean in the table? Does it mean Accessing?
It means: to access by index (position) as opposed to access by key (element value).
Why is Insertion and Deletion of Dynamic Array O(n)?
Because insertion/deletion may require that the array grows or shrinks in length. This may involve copying (all) elements. Therefore O(N).
Why is the index of Linked List O(n) while that of Dynamic Array O(1)? Is it because Dynamic Array is continuous and could be accessed directly by pointer arithmetic, while for a linked list a linear search would be needed?
Yes.
For 4, when you insert or delete an element into or from a D-array, you should indicate the index to insert or delete, so you need to make some elements moving forward or backward
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With