Re: [algogeeks] Number of keys in root of B Tree have?

2012-11-19 Thread Sonu
Whats the formula used here? Can someone explain please. On Mon, Nov 19, 2012 at 12:25 PM, Sambhavna Singh wrote: > n here denotes the degree of the btree > > > On Mon, Nov 19, 2012 at 12:25 PM, Sambhavna Singh > wrote: > >> maximum number of keys in root of btree with n=3 is 2. >> >> >> On Sun,

[algogeeks] Re: Repeating element with constraints

2012-11-19 Thread Don
This is O(n) and uses two local variables. It does not fail if n>65536 as the solutions which use the sum of the elements will. And I believe that it is simpler and more understandable. It pigeonholes each element until it finds one which is already in its spot, and that one is the duplicate. Each

[algogeeks] Re: swap objects without temp variable

2012-11-19 Thread Don
*Sigh* On Nov 19, 6:24 am, Gaurav Gulzar wrote: > one liner > a^=b^=a^=b > > On Mon, Nov 19, 2012 at 4:30 PM, abhinav gupta wrote: > > > > > > > > > we need to use + and - as operator overloading. so, that i will work f9 > > for ur objects. > > > so make operator overloading for + and - opera

[algogeeks] Announcing Hacker Weekly - Abacus: Ongoing programming contest

2012-11-19 Thread Vivek Prakash
Hi there! HackerEarth is conducting an online programming contest — Hacker Weekly — Abacus, with a mix of real world problems. HackerEarth is a platform to solve interesting problems, win attractive prizes, and get rec

Re: [algogeeks] Re: swap objects without temp variable

2012-11-19 Thread Gaurav Gulzar
one liner a^=b^=a^=b On Mon, Nov 19, 2012 at 4:30 PM, abhinav gupta wrote: > we need to use + and - as operator overloading. so, that i will work f9 > for ur objects. > > so make operator overloading for + and - operator. > > > On Sat, Nov 17, 2012 at 9:12 PM, AISHWARYA KUMAR wrote: > >

Re: [algogeeks] Re: swap objects without temp variable

2012-11-19 Thread abhinav gupta
we need to use + and - as operator overloading. so, that i will work f9 for ur objects. so make operator overloading for + and - operator. On Sat, Nov 17, 2012 at 9:12 PM, AISHWARYA KUMAR wrote: > > in one line > a=a^b^(b=a) ; > > -- > > > -- *Thanks and Regards,* Ab

[algogeeks] Re: swap objects without temp variable

2012-11-19 Thread AISHWARYA KUMAR
in one line a=a^b^(b=a) ; --

Re: [algogeeks] Repeating element with constraints

2012-11-19 Thread shady
yes, correct, both solutions are correct, but here there is a chance of overflow. On Mon, Nov 19, 2012 at 3:11 PM, shashi kant wrote: > @RushirajPatel if you happen to have looked at the page ..3rd solution is > the XOR one which is may be a solution for 2 missing numbers > but the trick ca

Re: [algogeeks] Repeating element with constraints

2012-11-19 Thread shashi kant
@RushirajPatel if you happen to have looked at the page ..3rd solution is the XOR one which is may be a solution for 2 missing numbers but the trick can well be used here.. have a close look there --

Re: [algogeeks] Repeating element with constraints

2012-11-19 Thread atul anand
yes correct...missed that :( , But we can use method given in the above geekforgeeks link to find those 2 elements : set_bit_no = xor & ~(xor-1); /* Now divide elements in two sets by comparing rightmost set bit of xor with bit at same position in each element. */ for(i = 0; i < size; i++)