**Delete a node in Double Linked List**

**The following steps are followed, to delete a node at the beginning of the list:***a. If list is empty then display 'Empty List' message.*

*b. If the list is not empty, follow the steps given below:*

*temp = start;*

*start = start -> right;*

*start -> left = NULL; free(temp);*

**Deleting a node at the end**

**of Data Structure**

**:***The following steps are followed to delete a node at the end of the list:*

*a. If list is empty then display 'Empty List' message*

*b. If the list is not empty, follow the steps given below:*

*temp = start;*

*while(temp -> right != NULL)*

*{*

*temp = temp -> right;*

*}*

*temp -> left -> right = NULL;*

*free(temp);*

*Deleting a node at Intermediate position**of Data Structure**:**The following steps are followed, to delete a node from an intermediate position in the list (List must contain more than two nodes).*

*a. If list is empty then display 'Empty List' message.*

*b. If the list is not empty, follow the steps given below:*

*c. Get the position of the node to delete.*

*d. Ensure that the specified position is in between first node and last node. If not, specified position is invalid.*

*Then perform the following steps:*

*if(pos > 1 && pos < nodectr)*

*{*

*temp = start; i = 1;*

*while(i < pos)*

*{*

*temp = temp -> right;*

*i++;*

*}*

*temp -> right -> left = temp -> left;*

*temp -> left -> right = temp -> right;*

*free(temp);*

*printf("\n node deleted..");*

**Thanks**

**Mukesh Rajput**
## Post A Comment:

## 0 comments:

Thanks

Mukesh Rajput