About Global Documents
Global Documents provides you with documents from around the globe on a variety of topics for your enjoyment.
Global Documents utilizes edocr for all its document needs due to edocr's wonderful content features. Thousands of professionals and businesses around the globe publish marketing, sales, operations, customer service and financial documents making it easier for prospects and customers to find content.
Tag Cloud
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
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