Best will be storing BIG_INT in array of integers.

int [] val; //store actual number
int size; // required length of val array.

take the string as input for constructors and convert it into 2's
complement form, maintaining little endian order or big endian order.
Perform other operation keeping order in mind.



On Sat, Jul 7, 2012 at 5:23 PM, sravanreddy001 <sravanreddy...@gmail.com>wrote:

> 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 <mithunsi...@gmail.com>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 <gpt.pa...@gmail.com>wrote:
>>>
>>>> thnx...4 d rply..
>>>>
>>>> Regards,
>>>> PAYAL GUPTA,
>>>> NIT-B.
>>>>
>>>>
>>>> On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra <
>>>> anshumishra6...@gmail.com> 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 algogeeks@googlegroups.com.
>>>>> To unsubscribe from this group, send email to algogeeks+unsubscribe@**
>>>>> googlegroups.com <algogeeks%2bunsubscr...@googlegroups.com>.
>>>>> For more options, visit this group at http://groups.google.com/**
>>>>> group/algogeeks?hl=en <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+unsubscribe@**
>>>> googlegroups.com <algogeeks%2bunsubscr...@googlegroups.com>.
>>>> For more options, visit this group at http://groups.google.com/**
>>>> group/algogeeks?hl=en <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+unsubscribe@**
>>> googlegroups.com <algogeeks%2bunsubscr...@googlegroups.com>.
>>> For more options, visit this group at http://groups.google.com/**
>>> group/algogeeks?hl=en <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 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.
>



-- 
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 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.

Reply via email to