@mohit : +1 On Sat, Aug 13, 2011 at 9:20 AM, Raghavan <its...@gmail.com> wrote:
> First question: > > - .Read the data from the first list and put it in a stack > - Traverse the next list and compare by reading elements from the stack > - This would solve it > > > Second question: > > - Take an list like 1->2->-3->4 > - If you are given with 2, juz copy the value and reference of next > node(i.e : 3) into 2 and delete the node 3 this would solve it > > Thanks. > > > On Thu, Aug 11, 2011 at 10:21 AM, Abhishek gupta < > mailatabhishekgu...@gmail.com> wrote: > >> 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 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. >> > > > > -- > Thanks and regards, > Raghavan.K.L > <http://in.linkedin.com/in/raghavankl> > > -- > 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.