Array

 

            Linked Lists

A data structure consisting of a collection of elements each identified by the array index A linear collection of data elements whose order is not given by their location in memory
It supports random access, so the programmer can directly access an element in the array using the index It supports sequential access, so the programmer has to sequentially go through each element or node until reaching the required element
Elements are stored in contiguous memory location Elements can be stored anywhere in the memory
Programmer has to specify the size of the array at the time of declaring the array There is no need for specifying the size of a linked list
Memory allocation happens at compile time Memory allocation happens at run time
It is a static memory allocation It is a dynamic memory allocation
Elements are independent of each other An element or node points to the next bode or both next node and previous node
Size of an array is fixed Size of an array is not fixed
Array elements can be modified easily by identifying the index value Linked list is a complex process for modify node in a linked list
Array elements cannot be added deleted once it is declared Nodes in the linked list can be added and deleted from the list

Categorized in: