@sourabh

i guess you need to modify this statement :-

3) Now for each element B[i][0] , do a (modified) binary *search  for
the closest value smaller than equal to (X + B[i][0])* in array B[i
+1... n][0] ,
Say the found index after binary search is j ( which is > i)...

12 + 2 = 12 , closest element found = 10 , closest to X = 10 - 2 = 8 ,  i =
1, j = 3
12 + 3 = 15 , closest element found = 15 , closest to X = 15 - 3 =12 , i =
2, j = 4
12 + 6 = 18 , closest element found = *no element found ??? how *

*Cumulative SUM*

*i*

2

0

3

 1

6

 2

10

 3

*15*

 4

for 12 + 6 =18 , closest element less than equal to 18 = 15 (15 < 18 )
..right ??

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to