1st case: if ptr points to the first node, then ptr->next=(ptr->next)->next will do.
2nd case:i think tehre has to be movement of data from third node to the second node. On 4/4/11, 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, Kamakshi kamakshi...@gmail.com -- 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.