+1 vote
in Data Structures & Algorithms I by (88.2k points)
What will be the correct sequence of insertion for the following k-d tree?

(a) (30,40),(5,25),(70,70),(10,12),(50,30),(35,45)

(b) (40,30),(5,25),(12,10),(70,70),(30,50),(45,35)

(c) (30,40),(5,25),(10,12),(70,70),(50,30),(35,45)

(d) (40,30),(25,5),(12,10),(70,70),(50,30),(45,35)

My doubt stems from Trees in section Trees of Data Structures & Algorithms I

I got this question during an online exam.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
Right answer is (c) (30,40),(5,25),(10,12),(70,70),(50,30),(35,45)

Explanation: The correct sequence of insertion of the above given tree is (30,40),(5,25),(10,12),(70,70),(50,30),(35,45). The insertion is given by, first left, then right.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.