Which is better Array or LinkedList

Hi there people! You must have used both Array and LinkedList at some point in your coding journey. They are very interesting topics and useful in many situations. As we all know Array is a data structure which is able to stores data of the same datatype in the contiguous memory location, whereas LinkedList is a linear data structure where all the data elements (nodes) are stored in random locations in memory and every data node contains the address of another data node. This tutorial will also help you two understand the basic differences between array and LinkedList or you can say Array vs LinkedList.

 Advantages and Disadvantages of using the Array and the LinkedList


                            Advantages                               Disadvantages
  1. Since the data is stored in contiguous memory locations in the array we can easily access data using the index value without traversing the whole array.
  2. A lot amount of data of same data type can be stored under one variable name i.e name of the array.
  3. It requires a fixed amount of memory, overflow of memory does not occur hence it is memory efficient.
  4. They can be used to represent a matrix of 2-Dimensions.
  5. No extra space is needed to store any extra information, unlike the LinkedList.
  6. They are fast in the sense of data retrieval.
  1. Memory wastage is a common scenario in an array. It happens when every index of the array is not filled with data.
  2. Deletion or addition of data is tough in the array because then first, the size of the array will be increased or decreased and then shifting of the elements will occur.
  3. We always have to know the size of an array in advance i.e before declaring the array hence Arrays are not flexible.
  4. We can only store the same type of data in contiguous memory locations.
  1. It a dynamic data structure hence addition and deletion of data are easy.
  2. Data does not have to be stored in contiguous memory location we can use random memory locations.
  3. Size or length of LinkedList does not have to be predefined, that means it is flexible we can easily expand and shrink it.
  4. It can be used to represent other data structure like a stack, queue,  trees, etc.
  5. There are various variants of LinkedList available like singly LinkedList, doubly LinkedList Circular LinkedList which are suitable for various situations.
  1.  Getting a specific node in a LinkedList is tedious task one has to traverse all the node to reach up to that required node.
  2. Extra space is needed to store the address of the next node of the LinkedList.
  3.  A 2-D matrix cannot be represented by LinkedList.
  4. Reverse traversing in a singly LinkedList is a tedious task and in doubly LinkedList extra space is needed to store back pointer address.
  5. Nodes can be accessed only in sequential order.
  6. If the address of a node is not stored properly, data can get lost.




Array and LinkedList both are very helpful in managing data in their own ways. They have an enormous amount of uses. But the real task is to select which data structure will be suitable for a particular problem so that we can get an efficient solution.

Hope you liked the article.

You may also read:

Leave a Reply

Your email address will not be published. Required fields are marked *