What is Singly Linked List? Advantage and Disadvantages

A singly linked list defined as all nodes are linked together in a few sequential manners, hence, it also knows as a linear linked list.

therefore, clearly it has the beginning and the end. the main problem which comes with this list is that we cannot access the predecessor of the node from the current node.
Singly Linked List structure

Singly Linked List

therefore, we can say that a singly linked list is a dynamic data structure because it may shrink or grow. hence, the shrinking and growing depending on the operation made.

let’s start a singly list by first creating it. I hope you know very well, the linked list is created for using structures, pointers and dynamic memory allocation function malloc().

furthermore, it considers the head as an external pointer. this will help us for creating and accessing other nodes in the linked list.

let’s see the following structures definition and head creation.

hence, as you have seen above, it is executed a block of memory sufficient for the store the node is allocated.

therefore its assigns head as the starting address of the node. hence, these all activities can be pictorially shown as given figures.
singly linked list example

In C program – the Basic operation on a linked List

therefore, this is the basic opeartion on a linked list hence, this is a function which will create a single linked list.

For Example-1

Suppose that if you want to insert 35 after 30 in the given list as figure 1.1
singly linked list

First of all, create a node 35
singly linked list
therefore, after that Search for the node 30
singly linked listfig-3
then, 35 will be insert in the list
singly linked list

hence, this process can be done through the following steps:
New next = temp next
temp next=new
therefore, thus finally the desired node gets inserted.

For Example-2

Here, similary while deleting the desired node
let’s suppose here we want to delete 40, the the first we search the node 40, which want to delete, we also search its previous node, 30
therefore, after that prev next = temp next

furthermore, we make temp node free, hence, the final list will look like this

Advantages of Singly Linked List

there are some advantages of singly Linked List

  • it is very easier for the accessibility of a node in the forward direction.
  • the insertion and deletion of a node are very easy.
  • the Requirement will less memory when compared to doubly, circular or doubly circular linked list.
  • the Singly linked list is the very easy data structure to implement.
  • During the execution, we can allocate or deallocate memory easily.
  • Insertion and deletion of elements don’t need the movement of all the elements when compared to an array.

Disadvantages of Singly Linked List

the disadvantages of singly Linked List are following

  • therefore, Accessing the preceding node of a current node is not possible as there is no backward traversal.
  • the Accessing of a node is very time-consuming.