Write an algorithm of “Delete At Last Point” in doubly link list

Algorithm:

Delete (node head)
1. [Start]
2. [Check for empty]
If head=null then
Show “List is empty”
Else if head->next=null then
Node ptr=head
Delete ptr
Head=null
Else
Node ptr=head
2.1[Repeat loop]
While ptr->next<>null
Ptr=ptr->next
[End of loop step (2.1)]
Delete ptr->next
Ptr->next=null
[End of if else step (2)]
3. [Return]

Leave a Reply

Your email address will not be published. Required fields are marked *