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


    Question

    Which of the following sorting algorithms has a

    worst-case time complexity of O(N log N)?
    A Bubble Sort Correct Answer Incorrect Answer
    B Selection Sort Correct Answer Incorrect Answer
    C Insertion Sort Correct Answer Incorrect Answer
    D Merge Sort Correct Answer Incorrect Answer
    E Quick Sort (worst case) Correct Answer Incorrect Answer

    Solution

    Merge Sort consistently achieves O(N log N) time complexity in its best, average, and worst cases because it always divides the array into two halves and then merges them. Bubble Sort, Selection Sort, and Insertion Sort have O(N^2) worst-case complexity. Quick Sort has an average-case O(N log N) but a worst-case O(N^2) if the pivot selection is consistently poor.

    Practice Next
    ask-question