4 node Binary Search tree: 2143. there are 3 ways to insert and get the same result.
What are those 3 possible ways?
1<-2->4 and then 3 would branch left of 4.
I do not see any other possible insertion permuations.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
different orders of insertion can result in different layouts:
vs:
If you are wondering how you can get to the same layout as the one obtained by the insertion sequence 2->1->4->3
You get: 1->2->4->3, 2->1->4->3, 2->4->3->1