Which searching algorithm is most suitable for a sorted array?

Options

  • A. Linear search
  • B. Binary search
  • C. Depth First Search
  • D. More than one of the above
  • E. None of the above

Correct Answer (Detailed Explanation is Below)

B. Binary search

Detailed Explanation

Correct Answer: B. Binary search

Explanation: Binary search efficiently searches a sorted array by repeatedly dividing the search interval into two halves.

  • It compares the target with the middle element.
  • It eliminates half of the remaining elements in each step.
  • Time complexity: O(log n).