[algogeeks] Re: divide two extremely large numbers

2009-09-10 Thread Denis
If you can use a library search for GMP or GMPQ and related (depend on the numbers domain ) . Denis On 4 Set, 19:36, ankur aggarwal ankur.mast@gmail.com wrote:  Write an algorithm two divide two extremely large numbers, which cannot be stored in an int, long int, float, double etc. Find

[algogeeks] Re: addition without using arithmetic operators

2009-09-10 Thread Shishir Mittal
On Tue, Sep 8, 2009 at 2:09 AM, ayush chauhan therajput.ay...@gmail.comwrote: Cud u plz explain the logic behind this? On Mon, Sep 7, 2009 at 9:44 PM, Gokul spgo...@gmail.com wrote: you can try this.. int add(int x, int y) { if (!x) return y; else

[algogeeks] Re: N number apples needs to distribute across M num baskets of varying capacity in balanced way

2009-09-10 Thread Dave
Consider the method used to apportion seats in the United States House of Representatives: http://mathdl.maa.org/mathDL/46/?pa=contentsa=viewDocumentnodeId=3163bodyId=3392. Dave On Sep 9, 1:24 am, Sandeep .A.S. reachtosand...@gmail.com wrote: Hi, Please let me know is there any standard

[algogeeks] Re: nth number of k bits

2009-09-10 Thread ashish gupta
I think this should be easy to understand. #includeiostream using namespace std; // this function generated next big number of the list having k bit set. unsigned next_number( unsigned x) { unsigned smallest, ripple, one; smallest = x (-x); ripple = x + smallest ; one = ripple^x;