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


    Question

    When comparing two algorithms, Algorithm A has O(N log

    N) complexity and Algorithm B has O(N² ) complexity. For very large input sizes N:
    A Algorithm B will always be faster. Correct Answer Incorrect Answer
    B Algorithm A will always be faster. Correct Answer Incorrect Answer
    C Their performance will be similar. Correct Answer Incorrect Answer
    D The choice of programming language will be the dominant factor. Correct Answer Incorrect Answer
    E Only constant factors matter. Correct Answer Incorrect Answer

    Solution

    For sufficiently large input sizes, an algorithm with a lower asymptotic complexity (like O(N log N)) will always outperform an algorithm with a higher asymptotic complexity (like O(N² )), regardless of constant factors or hardware. The growth rate dominates.

    Practice Next
    ask-question