Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE CS 2013 | Question 7

  • Last Updated : 28 Jun, 2021

Which one of the following is the tightest upper bound that represents the time complexity of inserting an object into a binary search tree of n nodes?
(A) O(1)
(B) O(Logn)
(C) O(n)
(D) O(nLogn)


Answer: (C)

Explanation: To insert an element, we need to search for its place first. The search operation may take O(n) for a skewed tree like following.

To insert 50, we will have to traverse all nodes.
        10
         \
          20
            \
             30
               \
                40


Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :