Loading ...
Global Do...
News & Politics
9
0
Try Now
Log In
Pricing
www.EasyGuides.By3.in Designed By Manibharathi DELETE ANY SPECIFIC NODE IN A LINKED – LIST Delete Specific ( ): Description: Here START is a pointer variable which contains the address of first node. PTR is a pointer variable which contains address of node to be deleted. PREV is a pointer variable which points to previous node. ITEM is the value to be deleted. 1. If (START == NULL) Then [Check whether list is empty] 2. Print: Linked-List is empty. 3. Else If (START->INFO == ITEM) Then [Check if ITEM is in 1 st node] 4. PTR = START 5. START = START->LINK [START now points to 2 nd node] 6. Delete PTR 7. Else 8. PTR = START, PREV = START 9. Repeat While (PTR != NULL) 10. If (PTR->INFO == ITEM) Then [If ITEM matches with PTR->INFO] 11. PREV->LINK = PTR->LINK [Assign LINK field of PTR to PREV] 12. Delete PTR 13. Else 14 PREV = PTR [Assign PTR to PREV] 15. PTR = PTR->LINK [Move PTR to next node] [End of Step 10 If] [End of While Loop] 16. Print: ITEM deleted [End of Step 1 If] 17. Exit