3 3 votes closed with the note: Sorted.Misconception Regarding Calculation Of mid element. In this given question I find all answers false because while implementing binary seach or tracing it for an example we need to follow same approach Right? if we are taking ceil for evaluation then it should be considered throughout and if we are taking floor accordingly it should be traced.Therefore applying both operating individually I find none of the options matching. Correct Me If I am wrong here. Algorithms binary-search algorithms + – saxena0612 1.6k views comment Share Follow Print See all 5 Comments 5 5 Comments reply joshi_nitish commented Nov 16, 2017 reply Follow flag option 1 is correct, see below, bolded keys show target array for binary search and bolded key show target key. mid = floor(10+1/2) = 5 3(1) 5(2) 6(3) 8(4) 11(5) 12(6) 14(7) 15(8) 17(9) 18(10) mid = floor(1+4/2) = 2 3(1) 5(2) 6(3) 8(4) 11(5) 12(6) 14(7) 15(8) 17(9) 18(10) mid = floor(3+4/2) = 3 3(1) 5(2) 6(3) 8(4) 11(5) 12(6) 14(7) 15(8) 17(9) 18(10) mid = floor(4+4/2) = 4 3(1) 5(2) 6(3) 8(4) 11(5) 12(6) 14(7) 15(8) 17(9) 18(10) 2 2 replyShare saxena0612 commented Nov 16, 2017 reply Follow flag In second step a[5]>8 Then lb=1 same and ub=5 then mid =(5+1)/2=3 Though you started with 1 given is 0 but this solution also doesnt follow any sequence Chek it please. 0 0 replyShare joshi_nitish commented Nov 16, 2017 reply Follow flag it does'nt matter either you take start index=0 or 1, next mid should be (1+4)/2, why are you taking (1+5)/2, new target array is from A[1...4], because A[5] is already checked. 1 1 replyShare saxena0612 commented Nov 16, 2017 reply Follow flag Yes thanks! I was considering that while implementing also. 0 0 replyShare nandini gupta commented Dec 26, 2017 reply Follow flag Both sequence a and b are possible. 0 0 replyShare Please log in or register to add a comment.