we can create linked list for the number where each node will store some k digits (say 5) in the reverse order.then we just perform a normal addition of the data of the nodes with the help of carry. note that if the numbers are not positive then we need to maintain a sign bit node also.if any of the number is negative then we have to find the greater number among the both considering their absolute values only. in this case for comparing the two numbers use doubly linked list so as to compare the digits.
On Tue, Jun 26, 2012 at 7:33 PM, Ashish Goel <ashg...@gmail.com> wrote: > the base is not given, so 10 can't be assumed > > Best Regards > Ashish Goel > "Think positive and find fuel in failure" > +919985813081 > +919966006652 > > > On Tue, Jun 26, 2012 at 4:38 PM, amrit harry <dabbcomput...@gmail.com>wrote: > >> make size of both array by adding '0' in front of smaller array >> then >> int carry=0; >> for(i=array.size();i>=0;i--) >> { >> sum[i]=carry+arrayA[i]+arrayB[i]; >> carry=sum[i]/10; >> sum[i]=sum[i]%10; >> } >> then reverse and print sum >> On Tue, Jun 26, 2012 at 3:40 PM, Ashish Goel <ashg...@gmail.com> wrote: >> >>> >>> Best Regards >>> >>> Ashish Goel >>> "Think positive and find fuel in failure" >>> +919985813081 >>> +919966006652 >>> >>> -- >>> 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. >>> >> >> >> >> -- >> Thanks & Regards >> Amritpal singh >> >> -- >> 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. > -- Regards Lomash Goyal * * -- 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.