Explain the difference between array and linked list?
|1.||An array is a collection of the elements of a similar data type.||Linked List is an ordered collection of the elements of the same type and all the elements, with the help of pointer, are connected.|
|2.||The array supports the Random Access. Here the elements can be accessed directly using their index, like arr for the 3rd element, arr for the 2nd element, arr for the 1st element, etc.||Linked List supports the Sequential Access. Here to access any element or node in a linked list, we have to sequentially traverse the complete linked list to reach to that element.|
|3.||In an array, elements are stored consecutively in the memory.||In a linked list, the new elements can be stored anywhere in the memory.|
Suggest An Answer
No suggestions Available!