hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    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

    RBI Asst Prelims 2026: Quant Advance level Test 01

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

    RBI Asst Prelims 2026: Reasoning Advance level Test 01

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

    NABARD Development Assistant Mains 2026 Full Mock Test -01

    languageIcon English
    • pdpQsnIcon150 Questions
    • pdpsheetsIcon150 Marks
    • timerIcon105 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
    382k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow