@Hari: But I've not reversed the lists and I think my logic works. On Wed, Aug 25, 2010 at 6:47 PM, hari <harihari1...@gmail.com> wrote:
> I dont think it can be done without reversing the linked list!! > > On Aug 25, 2:54 pm, Raj N <rajn...@gmail.com> wrote: > > Input : Two large singly linked lists representing numbers with most > > significant digit as head and least significant as last node. > > Output: Difference between the numbers as a third linked list with > > Most significant digit as the head. > > Eg: > > --- > > Input: > > A = 5->4->2->0->0->9->0->0 > > B = 1->9->9 > > Output: > > C = 5->4->2->0->0->7->0->1 > > Required complexity : > > O(n) > > Constraint: > > Reversing linked list is NOT allowed > > -- > 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. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.