Linked List

Linked List Basics

Linked list is a non-sequential collections of data items called nodes that contains the element and address of the next element.

These nodes when connected to one another forms very useful data structure and has several advantages compared to arrays.


Types of linked lists

There are two types of linked list:

  1. Singly linked list
  2. Doubly linked list

A digrammatic representation of nodes is given below:


linked list nodes by tutorialsinhand.com


From the above diagram we can see:

  • Singly linked list nodes contain only two fields: one holds data element and the other holds link(or address) to the next element
  • Doubly linked list nodes contain three fields: two fields holds link (or address) to the next and previous element and third field contains element.

Advantages of linked list

  1. Linked list is a dynamic in nature data structure. It can grow and shrink as per demand during program execution.
  2. Linked list uses memory efficiently as here there is no concept of memory pre-allocation. Memory is allocated and deallocated as per need.
  3. Linked list is really useful as data structure for operations where large number insertion and deletion operations are to be performed.

Disadvantages of linked list

  1. Linked list requires extra memory for storing address of the next element
  2. Accessing an element from the linked list is time consuming as you cannot directly pick element based on index position.

Important points

  • The pointer to the very first node that helps us to access the entire linked list is known as external pointer.
  • The last in the linked list doesnot point to the address of any other element thus contains NULL value. This null pointer indicates the end of the list.
  • If linked list doenot contain any node then it is known as empty list or null list. A linked list can be made an empty list by assigning null value to the external pointer.

Please Share this page
Views : 124
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!