lets say there are two pointers - temp1,temp2 and the start of the node is head.... now, temp1=head; temp2=head->next;
temp1->next=temp2->next; now temp1 points to the first node and the temp2 points to the second node(which got deleted from the list)..... On Thu, Apr 7, 2011 at 5:43 PM, Umer Farooq <the.um...@gmail.com> wrote: > That can be moved. Basically, he is trying to convey that move the data of > temp->next to temp. That's perfectly fine. > > > On Thu, Apr 7, 2011 at 2:05 PM, Akash Mukherjee <akash...@gmail.com>wrote: > >> @ anurag >> >> temp -> data = ( temp -> next ) -> data ; >> >> but data cannot be moved, ryt?? >> >> On 4/6/11, Anurag atri <anu.anurag....@gmail.com> wrote: >> > in case you are given a pointer to the first node simply do >> > temp ->next = ( temp -> next ) -> next . >> > if you are given a pointer to the second node do , >> > temp -> data = ( temp -> next ) -> data ; >> > temp -> next = NULL ; >> > >> > correct me if I am wrong . >> > >> > On Mon, Apr 4, 2011 at 9:48 PM, Umer Farooq <the.um...@gmail.com> >> wrote: >> > >> >> Hello friends, >> >> >> >> The following question has appeared in two top companies of my city. >> I'd >> >> appreciate if anyone is able to answer it. >> >> >> >> Given a singly liked list comprising of three nodes >> >> >> >> Delete the middle node such that: >> >> >> >> 1- A temp pointer is pointing to the first node >> >> 2- A temp pointer is pointing to the second node. >> >> >> >> You can not use any other pointer and you can not move data. >> >> >> >> -- >> >> Umer >> >> >> >> -- >> >> You received this message because you are subscribed to the Google >> Groups >> >> "Algorithm Geeks" group. >> >> To post to this group, send email to algogeeks@googlegroups.com. >> >> To unsubscribe from this group, send email to >> >> algogeeks+unsubscr...@googlegroups.com. >> >> For more options, visit this group at >> >> http://groups.google.com/group/algogeeks?hl=en. >> >> >> > >> > >> > >> > -- >> > Regards >> > Anurag Atri >> > >> > -- >> > You received this message because you are subscribed to the Google >> Groups >> > "Algorithm Geeks" group. >> > To post to this group, send email to algogeeks@googlegroups.com. >> > To unsubscribe from this group, send email to >> > algogeeks+unsubscr...@googlegroups.com. >> > For more options, visit this group at >> > http://groups.google.com/group/algogeeks?hl=en. >> > >> > >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> >> > > > -- > Umer > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- A.Balaji -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.