Posts

Showing posts with the label Difference between Array and linked list

Difference between Array and Linked List

Image
 Difference between Array and Linked List Hello Friends, Today we will tell you the difference between array and linked list, So let's start this guys. Both Arrays and linked list are used for store the linear data but arrays allocate the contiguous memory location in Compile time while linked list allocate the memory in run time. This is basic and most important difference .Now, we will read the other main difference, Array is an ordered collection of same data type but linked list is ordered collection of same type of element which is connected to each other by pointers. Array supports random access which means that we can access this directly by index.e.g. For 1st element arr[0] , for 7th element arr[6] etc. while Linked list supports sequential access which means that in linked list for access any elements/nodes we have to sequentially traverse the full list. Arrays store the elements in contiguous memory location while In linked list a new elements can be store anywhere. In Ar...