Differences:
Array is an indexed collection of elements. i.e arr[i] represents elements at i‘th index in the array arr. Linked list’s element cannot be accessed using index, rather you have to traverse to that particular element.
Hence, accessing i‘th element in the array is constant-time operation (memory look-up) while accessing i‘th element in a linked list requires i steps (moving to the i‘th node) and is hence O(i) time operation.
Next: Storage …
1 Comment
why we can not use binary search in linked list even it is sorted,what is main reason behind this fact?