Re: [algogeeks] Code optimization.

2012-05-04 Thread Sukun Tarachandani
Are you summing the numbers on each set query? Sukun Tarachandani IDD Electrical Engineering(2nd year) IIT Roorkee On Fri, May 4, 2012 at 10:56 PM, vIGNESH v v.v.07121...@gmail.com wrote: Hai Can you brief about the rest of the cases? On 4 May 2012 01:56, Umer Farooq the.um...@gmail.com

Re: [algogeeks] Code optimization.

2012-05-04 Thread Umer Farooq
They haven't shared the rest of test cases. However, the execution time difference is extremely high. It took about 0.3 and 0.6 sec for the cases in which it executed successfully. However, it was taking more than 5 sec on test cases in which it couldn't run. On Fri, May 4, 2012 at 10:26 PM,

Re: [algogeeks] Code optimization.

2012-05-04 Thread Sukun Tarachandani
I meant what is your algorithm, are you summing up the entire numbers A and B every time a set query is made? Sukun Tarachandani IDD Electrical Engineering(2nd year) IIT Roorkee On Fri, May 4, 2012 at 11:32 PM, Umer Farooq the.um...@gmail.com wrote: They haven't shared the rest of test cases.

Re: [algogeeks] Code optimization.

2012-05-04 Thread Sukun Tarachandani
Nevermind i read your code. Your algorithm is wrong. what you are doing here is adding up the complete binary numbers A and B every time a query is made. Instead use something like a bitvector for java to store the two binary numbers and another bit vector to store C, and another to store the

Re: [algogeeks] Code optimization.

2012-05-04 Thread Sukun Tarachandani
http://en.wikipedia.org/wiki/Bit_array Sukun Tarachandani IDD Electrical Engineering(2nd year) IIT Roorkee On Sat, May 5, 2012 at 9:49 AM, Sukun Tarachandani sukun...@gmail.comwrote: Nevermind i read your code. Your algorithm is wrong. what you are doing here is adding up the complete