Overview of Linked List

Linked list as the name suggests is a list of elements grouped linearly. 

Image Credits:Wikimedia Commons

A unit element in a linked list consists of the following components:

  1. Data
  2. Address of neighbour element/s

We refer to this unit element as a node. Therefore, a linked list is a set of nodes. The last node in the linked list points to null, indicating that the linked list has ended.


Depending upon the number of nodes that are accessed directly, linked lists are further classified into:

  1. Singly Linked List

Here, the primary node contains the address of the next node.

 Imagine playing a game of treasure hunt. You know the first clue, which contains information to direct you to the second clue and so forth.

Image Credits:Wikimedia Commons

       2.  Doubly Linked List

Here, the primary node contains the address of the previous as well as the next node.

Imagine travelling in a metro train. You know the first stop. The trains traverse back and forth according to its route.

Image Credits: Wikimedia Commons


Advantages of the Linked list:

1. Easy to insert or delete an element.

2. The size of the linked list is not fixed.

3. The dynamic nature of linked list disables wastage of memory space.


Disadvantages of the Linked list:

1. Searching and sorting are costly because we cannot access elements randomly.

2. Consumes more memory than an array to store node.


Application of linked list:

1. Implement stack, queue, hash table and graph data structure.

2. Storing polynomial numbers.

3. Operating System uses a linked list when multiple applications are running. These applications are stored in nodes.

4. Programs to play music, view images, go to next web-page.


Comments

Popular posts from this blog

Overview of Tree Data Structure

Overview of Three Dimensional Array

Overview of 2 Dimensional array