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


    Question

    The time complexity of building a heap from an unsorted

    array of n elements is:
    A O(n log n) Correct Answer Incorrect Answer
    B O(n²) Correct Answer Incorrect Answer
    C O(n) Correct Answer Incorrect Answer
    D O(log n) Correct Answer Incorrect Answer
    E O(n √n) Correct Answer Incorrect Answer

    Solution

    Bottom-up heapify builds a heap in linear time because lower levels require fewer comparisons.

    Practice Next
    ask-question