Re: [algogeeks] MS Design Ques

2012-07-07 Thread Anshu Mishra
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 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 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 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 .
> 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+unsubscribe@**
 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+unsubscribe@**
>>> 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 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.



Re: [algogeeks] MS Design Ques

2012-07-07 Thread sravanreddy001
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 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  wrote:
>>
>>> thnx...4 d rply..
>>>
>>> Regards,
>>> PAYAL GUPTA,
>>> NIT-B.
>>>
>>>
>>> On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra >> > 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+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.
>>>
>>
>>  -- 
>> 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.
>>
>
>
>
> -- 
> 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.



Re: [algogeeks] MS Design Ques

2012-07-06 Thread Anshu Mishra
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  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  wrote:
>
>> thnx...4 d rply..
>>
>> Regards,
>> PAYAL GUPTA,
>> NIT-B.
>>
>>
>> On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra 
>> 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+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.
>>
>
>  --
> 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.
>



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



Re: [algogeeks] MS Design Ques

2012-07-06 Thread Mithun Kumar
@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  wrote:

> thnx...4 d rply..
>
> Regards,
> PAYAL GUPTA,
> NIT-B.
>
>
> On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra 
> 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+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.
>

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



Re: [algogeeks] MS Design Ques

2012-07-05 Thread payal gupta
thnx...4 d rply..

Regards,
PAYAL GUPTA,
NIT-B.

On Fri, Jul 6, 2012 at 12:43 AM, Anshu Mishra 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+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.



Re: [algogeeks] MS Design Ques

2012-07-05 Thread Anshu Mishra
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+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS Design Ques

2012-07-03 Thread Mithun Kumar
can you elaborate question...what is BIG_INT?



On Sun, Jul 1, 2012 at 8:13 PM, payal gupta  wrote:

> design a BIG_INT library...
>
> Regards,
> PAYAL GUPTA,
> NIT-B.
>
> --
> 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/-/EHIiPPFJ4t0J.
> 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.



[algogeeks] MS Design Ques

2012-07-01 Thread payal gupta
design a BIG_INT library...

Regards,
PAYAL GUPTA,
NIT-B.

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