we can also do it by making next_ptr of head = 0 XOR address of last node. for both this and above method we must save the address of last node in temp while creating a XOR link list.
On Thu, Dec 1, 2011 at 9:21 AM, atul anand <atul.87fri...@gmail.com> wrote: > well to make it work in O(1) , i guess just make head=last node. > > now just by XORing next ptr of current element with the previous element , > we will get second last node.... similarly keep traversing . > > On Thu, Dec 1, 2011 at 7:02 AM, Rajeev Kumar <rajeevprasa...@gmail.com>wrote: > >> >> >> -- >> Thank You >> Rajeev Kumar >> >> -- >> 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.