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 <[email protected]> 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 <[email protected]>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 [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. >> > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. 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.
