arrow
arrow
arrow
Which searching algorithm has a worst-case time complexity of O(log n)?
Question



Which searching algorithm has a worst-case time complexity of O(log n)?

A.

Linear Search

B.

Binary Search

C.

Depth First Search

D.

Breadth First Search

E.

Exponential Search

Correct option is B

Binary Search works by repeatedly dividing a sorted array or list in half and comparing the target value to the middle element. This results in a logarithmic time complexity of O(log n) in the worst case.
Important Key Points:
1. Binary Search is efficient when dealing with sorted arrays or lists.
2. The search space is halved after each comparison, which results in O(log n) time complexity in the worst case.
3. Binary search is ideal for scenarios where data is organized in a way that allows for this divide and conquer approach.
4. The logarithmic time complexity makes binary search far more efficient than linear search for large datasets.
Knowledge Booster:
· Linear Search (O(n)): Scans each element in the list one by one, making it less efficient with a time complexity of O(n) in the worst case.
· Depth First Search (O(V + E)): Used for graph traversal and not relevant for array searches.
· Breadth First Search (O(V + E)): Also used for graph traversal, and it doesn't have O(log n) time complexity.
· Exponential Search (O(log n)): While exponential search is related to binary search, its time complexity can vary depending on the scenario, but it’s typically used for unbounded arrays.

Free Tests

Free
Must Attempt
Video Solutions

RBI Assistant Pre 2026 Full Mock Test -01

languageIcon English
  • pdpQsnIcon100 Questions
  • pdpsheetsIcon100 Marks
  • timerIcon60 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Asst Prelims 2026 : Reasoning Section Test 01

languageIcon English
  • pdpQsnIcon35 Questions
  • pdpsheetsIcon35 Marks
  • timerIcon20 Mins
languageIcon English
Free
Must Attempt
Video Solutions

RBI Office Attendant 2026 Full Mock Test - 01

languageIcon English
  • pdpQsnIcon120 Questions
  • pdpsheetsIcon120 Marks
  • timerIcon90 Mins
languageIcon English
test-prime-package

Access ‘IBPS RRB SO IT Officer (Scale-II)’ Mock Tests with

  • 60000+ Mocks and Previous Year Papers
  • Unlimited Re-Attempts
  • Personalised Report Card
  • 500% Refund on Final Selection
  • Largest Community
students-icon
353k+ students have already unlocked exclusive benefits with Test Prime!
Our Plans
Monthsup-arrow