Singly Linked List Data Structure all Operations | C++ Program to Implement Singly Linked List

In this tutorial we will understand the working of Singly Linked List & see all operations of Singly Linked List. If you don’t know what a Linked List Data Structure is please check this post.

Singly Linked list is a type of Linked List Data structure which behaves like a one way list/chain. The reason it is called a one way list or one way chain is because we can only traverse this list in one direction, start from the head node to the end.

singly linked list diagramAs you can see from the diagram, each node object has 1 data field & 1 pointer field. The data field contains the actual data where as the pointer field(next pointer) points to the next node in the singly linked list. Since the nodes are not stored in contiguous memory locations, this extra pointer field assists in locating the next node in memory. As we have only one pointer pointing to the next node, we can only traverse in one direction starting from the head node to the end.

Following are the standard Singly Linked List Operations –

  • Traverse – Iterate through the nodes in the linked list starting from the head node.
  • Append – Attach a new node (to the end) of a list
  • Prepend – Attach a new node (to the beginning) of the list
  • Insert – attach a new node to a specific position on the list
  • Delete – Remove/Delink a node from the list
  • Count – Returns the no of nodes in linked list
C++ Program to Implement Singly Linked List – 
YouTube video tutorials –

Leave a Reply

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