Write an algorithm of “Insert At Last Point”

Algorithm:

Insert (node head, value)
1. [Start]
2. Node temp
Temp->data=value
3. [Check condition]
If head=null then
Head=temp
Else if head->next=null then
Head->next=temp
Else
Node ptr=head
3.1[Repeat loop]
While (ptr!=null)
Ptr=ptr->next
[End of loop step (3.1)]
Ptr->next =temp

[End of if else step (3)]
4. [Return]

Leave a Reply

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