i was thinking of character array. which is same as string. Any thoughts on better alternatives?
On Friday, 6 July 2012 13:34:01 UTC-4, anshu wrote: > > yes, We can have much better data structure for storing big integer > instead of string just for simplicity I have taken string. > > On Fri, Jul 6, 2012 at 11:11 AM, Mithun Kumar <[email protected]>wrote: > >> @anshuman... >> >> Are you converting numbers to string because data types ranges >> and precision differs? or is there any other reason? >> >> -mithun >> >> On Fri, Jul 6, 2012 at 12:58 AM, payal gupta <[email protected]> wrote: >> >>> thnx...4 d rply.. >>> >>> Regards, >>> PAYAL GUPTA, >>> NIT-B. >>> >>> >>> On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra <[email protected] >>> > wrote: >>> >>>> First define all the basic operation you can apply on two numbers. >>>> >>>> Binary operation : +, -, *, /, %, optional(&(and), |(or), ^(xor)) >>>> Unary operation : !, ~, - >>>> Comparison : <, > ==, != >>>> >>>> Define all these operation. >>>> >>>> Most simplest one can be, >>>> class BIG_INT { >>>> private string val; >>>> //Define constructor >>>> private BIG_INT(){} >>>> public BIG_INT(int x) { >>>> this.val = x.toString(); >>>> } >>>> public BIG_INT(long x) { >>>> this.val = x.toString(); >>>> } >>>> public BIG_INT(string x) { >>>> this.val = x; >>>> } >>>> public BIG_INT add(BIG_INT x); >>>> public BIG_INT add(int x); >>>> public BIG_INT add(long x); >>>> >>>> similarly write methods for other operation also; >>>> >>>> } >>>> >>>> If this question asked for only design testing purpose only all method >>>> declaration will be sufficient. >>>> >>>> -- >>>> Anshuman Mishra | Software Development Engineer | Amazon >>>> >>>> >>>> -- >>>> 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. >>> >> >> -- >> 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. >> > > > > -- > Anshuman Mishra | Software Development Engineer | Amazon > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/pkUNaazktKAJ. 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.
