πŸ“’ 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 for searching an

    element in a general (unbalanced) binary tree?
    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, a general binary tree can degenerate into a skewed tree (like a linked list), where searching for an element might require traversing all 'n' nodes, leading to O(n) time complexity.

    Practice Next
    ask-question