Data Structure Time Complexity Question #15242
Single Choice Easy

QWhat is the time complexity of searching for an element in a sorted array using binary search?

ID: #15242 Time Complexity 156 views
Question Info
#15242Q ID
EasyDifficulty
Time ComplexityTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A O(log n)
  • B O(n)
  • C O(n log n)
  • D O(1)
Correct Answer

Explanation

Binary search is an efficient search algorithm that operates on sorted arrays by repeatedly dividing the search interval in half. In each iteration, it compares the middle element with the target element and adjusts the search range accordingly. This process continues until the target element is found or the search range becomes empty. Since each comparison reduces the search space by half, the time complexity of binary search is logarithmic with respect to the number of elements in the array, denoted as O(log n).

No Previous Next Question

Share This Question

Challenge a friend or share with your study group.