0 votes 0 votes https://gateoverflow.in/394/gate2008-84 Here option A also leads to infinite loop right? it gets stuch at index 8 because 8 + 9 / 2 = 8 it never reaches 9 A_i_$_h asked Nov 26, 2017 A_i_$_h 337 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Show 3 previous comments A_i_$_h commented Dec 16, 2017 reply Follow Share @ashwin sorry i meant OPTION B actually what if the element we are searching x=0 then it keeps iterating in an infinite loop right ? 0 votes 0 votes Ashwin Kulkarni commented Dec 16, 2017 reply Follow Share In option B assume x =0. then while searching for 0 initially k = 9/2 = 4 j=k again k = 2 j=k again k =1 j=k again k=0 j=k here i=j also and hence won't go into infinite loop 0 votes 0 votes A_i_$_h commented Dec 16, 2017 reply Follow Share @ashwin got it :) i was considering 1 / 2 as 1 by mistake :P like solving mod 1 votes 1 votes Please log in or register to add a comment.