Q2). i think for second question it will be enough to just swap the data of 
current node to next node,
and delete the next node.
it will be like,
//for swap
int temp=current->data;
current->data=current->next->data;
current->next->data=temp;

//for delete
struct node *temp;
temp=current->next;
current->next=current->next->next;
free(temp);

i think it will be enough even in case of last node.
correct me if i am wrong.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/algogeeks/-/N1elA8-W-iUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to