📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is the worst-case time complexity of a linear

    search algorithm on an array of 'N' elements?
    A O(1) Correct Answer Incorrect Answer
    B O(log N) Correct Answer Incorrect Answer
    C O(N) Correct Answer Incorrect Answer
    D O(N log N) Correct Answer Incorrect Answer
    E O(N^2) Correct Answer Incorrect Answer

    Solution

    In the worst case for linear search, the target element is either at the very end of the array or not present at all. In both scenarios, the algorithm has to iterate through all 'N' elements of the array, leading to a time complexity of O(N).

    Practice Next
    ask-question