What will be the return value of binary search if the element is not found?

Practice Questions

1 question
Q1
What will be the return value of binary search if the element is not found?
  1. -1
  2. 0
  3. 1
  4. n

Questions & Step-by-step Solutions

1 item
Q
Q: What will be the return value of binary search if the element is not found?
Solution: Typically, binary search returns -1 to indicate that the element was not found in the array.
Steps: 5

Related Questions

Soulshift Feedback ×

On a scale of 0–10, how likely are you to recommend The Soulshift Academy?

Not likely Very likely