Which searching algorithm can find an element in O(log n) time in a sorted array?

Options

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

Correct Answer (Detailed Explanation is Below)

B. Binary Search

Detailed Explanation

Binary Search can search a sorted array in O(log n) time. It repeatedly compares the target value with the middle element and eliminates approximately half of the remaining search space after each comparison. The important requirement is that the data must be appropriately sorted. In contrast, ordinary Linear Search checks elements sequentially and has O(n) worst-case complexity. Binary Search is therefore an important example of how an appropriate algorithm can significantly reduce search time.