What is the condition for binary search to be unsuccessful where Beg is the…

2021

What is the condition for binary search to be unsuccessful where Beg is the beginning and End is ending location of sorted array?

  1. A.

    End > Beg

  2. B.

    End == Beg

  3. C.

    End < Beg

  4. D.

    End != Beg

Attempted by 158 students.

Show answer & explanation

Correct answer: C

Binary search terminates when the search range becomes invalid. This happens when the beginning index (Beg) becomes greater than the ending index (End). At this point, the target element cannot exist in the array, and the search is unsuccessful.

The condition for failure is: End < Beg.

Explore the full course: Up Lt Grade Assistant Teacher 2025