Find the middle node of the list by using doubly linked list:

Write a program to find the middle node in the doubly linked list. For linked list there is no data limit. And we don’t have any idea to identify how many data are present in the list like array. Here we are going to explain how to find the middle node by using doubly linked list.

We strongly recommend you to try this program by yourself. Before scrolling down your mouse.

Step to find the middle node in linked list:

Step 1: First we need to increment the head node twice

step 2: By the same time we need to increment another temp node once. Note both temp and head node pointing same head node before processing.

step 3: keep on increment till head node reaches NULL or head node’s next node reaches NULL.

step 4: if head node is null then the list contains odd number so we have middle node in that temp node. Or else if the head->next is NULL then the list is even number. It may not have middle element.