The solution is essentially the same as Anurag's; Only that it would be simple to reverse both the lists So now the lists look like
Num 1 = 123456 Num 2= 1234 Link-1<-Link-2<-Link-3<-Link-4<-Link5<-Link6 head_num1 Link-1<-Link-2<-Link-3<-Link-4 <-head_num2 Now basically loop, and add the keys, remembering to take the carry ... and if there is carry in the last stage, then make an extra node. Regards On Wed, Jan 27, 2010 at 11:07 AM, Anurag Bhatia <abhati...@gmail.com> wrote: > Let us take an example - > > Num 1 = 123456 > Num 2= 1234 > Link-1->Link-2->Link-3->Link-4->Link5->Link6 > Link-1->Link-2->Link-3->Link-4 > > Add nodes into linkedlist 1 till either one of the list is not null. > Make sure you process the carry in each iteration. > > > --AB > > > On Tue, Jan 26, 2010 at 9:47 PM, Algoose Chase <harishp...@gmail.com> > wrote: > > conditions: > > NO extra memory (@ stack or Heap) at all. No recursion. > > > > Any body has got any hint about how to get this done ? > > > > > > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to algoge...@googlegroups.com. > > To unsubscribe from this group, send email to > > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@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 algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- We are here on earth to do good for others. What the others are here for, I don't know. Afroz Mohiuddin Final Year Masters Student Dept Computer Science and Engineering Indian Institute of Technology Kanpur Kanpur - 208016 INDIA -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@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.