/    /  Data Structures-Linked List

Linked List

 

A linked list is a collection of nodes stored randomly in the memory. The nodes contain two fields:

  1. Data stored at a specified address.
  2. A pointer to the address of the next node. 

 

Uses of a linked list:

 

  1. Linked lists help to optimize the utilization of space as they are not required to be continuously present in the memory. 
  2. It need not be declared early hand as it is limited to the size of the memory.
  3. The value of primitive types or objects can be stored in the singly linked list.
  4. There are no empty nodes in the linked list. 

 

Why linked list is better than an array?

 

An array has the following limitations:

  1. The size of the array must be known beforehand.
  2. It requires a long time to increase the size of the array.
  3. There is no optimized utilization of space as the elements need to be continuously present in the memory. 

 

 

Reference

Linked List