Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE-CS-2015 (Set 3) | Question 23

  • Last Updated : 10 Sep, 2018
Geek Week

While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is

(A) 65
(B) 67
(C) 69
(D) 83


Answer: (B)

Explanation: Here is The Insertion Algorithm For a Binary Search Tree :

Insert(Root,key)
{
    if(Root is NULL)
        Create a Node with value as key and return
    Else if(Root.key >= key)
        Insert(Root.left,key)
    Else
        Insert(Root.right,key)
}

Creating the BST one by one using the above algorithm in the below given image :

pranjul_23

This solution is contributed by Pranjul Ahuja.


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 :