2. Outline
1. Deletion & delete Keyword
I. Definition, Advantage & Use
2. Representation of Linked list
3. Deletion Types in Linked List
I. Beginning
A. Pseudo code
II. Particular Position (Middle)
III. Last
3. Deletion & Delete Keyword
• Variable, Object: Memory Allocated
– Example: int I;
– SBBU Nws = new SBBU();
• Removing any Required Node
– Example:
– delete I;
– delete sbbu;
• De-allocating the block of memory
4. Representation of Linked List
101
HEAD
IJK 102 PQR 103 XYZ 0
101 102 103
Node 1 Node 2 Node 3
Indicates Null Value
6. Deleting at Beginning Pseudo code
1. Start
2. If value of COUNT is equal to 1 Then:
Temp= ptr of next
delete ptr
head=temp
End if
3. Stop
Use of Counters
Use of Temporary Variable
Use of delete keyword
Assign Address to head