[Link].
com
Gursharan Singh Tatla
Page No. 1
INSERT AT ANY SPECIFIC NODE IN A LINKED LIST
Insert Specific ( ):
Description: Here START is a pointer variable which contains the address of first node. NEW is a pointer variable which will contain address of new node. N is the value after which new node is to be inserted and ITEM is the value to be inserted. 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. ELSE PTR = PTR->LINK [End of Step 6 If] [End of While Loop] [End of Step 1 If] 14. Exit Else Set PTR = START, NEW = START Repeat While (PTR != NULL) If (PTR->INFO == N) Then NEW = New Node NEW->INFO = ITEM NEW->LINK = PTR->LINK PTR->LINK = NEW Print: ITEM inserted If (START == NULL) Then Print: Linked-List is empty. It must have at least one node