infinite loop while trying to insert node before a node in singly linked list
I tried to insert a node before a given node by specifying the position of the node before which I want to insert the newnode. I got the data present inside that node’s position and using a while loop, compared this data with each node’s data till I reached the point where I was supposed to insert the node.