[algogeeks] Re: Cashbox withdrawal

2006-01-04 Thread sudhakar-aluri
oops.. 500,200 and 50,20 are values in the table. so the algo doesnt work for this case

[algogeeks] Re: TSP JAVA code Needed

2005-12-21 Thread sudhakar-aluri
what if we use backtracking to find the hamiltonian cycles and finding the min of that. It reduces the space required.since we need to store only one cycle at one shot. am i missing the stack space required of recursion of backtrack.?? Dhyanesh, what about time. does it reduces the time as well??

[algogeeks] Re: 1 to 1 Lack numbers in a stream .. find the missing number

2005-12-20 Thread sudhakar-aluri
one correction --- while ( k 0) this should be while ( k 0)

[algogeeks] Re: Given N numbers z value , find x, y such that x + y = z

2005-12-19 Thread sudhakar-aluri
my idea is like this: 1/ find a number k in the array where k-z is minimum. 2/ then arrange the array in such a way that array[1...r] contains the numbers less than z, a[r] contains the k , a[r+1, .. n] contains the numbers greater than z. ( like one iteration of quick sort, if i remember

[algogeeks] Re: Given N numbers z value , find x, y such that x + y = z

2005-12-19 Thread sudhakar-aluri
yes. you are calucation is wrong in You are againing need to do n/2 * n/2 comparing... . moving heads in step 3 will take only O(n). T(n) = O(n). please see the step 3 again/.