Question
Someone, please help me check my answers and give me the correct answers explaining where I went wrong. a. Add the following values (in the
Someone, please help me check my answers and give me the correct answers explaining where I went wrong.
a. Add the following values (in the order provided) to a binary search tree object:
Values: 2, 0, 7, 3, 5, 6, 9, 1, 4, 8
For your response to this question, provide the values in the order you would get if you did an in order traversal of your tree.
My Answer = [0, 1, 2, 4, 5, 6, 3, 7, 9, 8]
b.
Add the following values (in the order provided) to a binary search tree object and provide the values in the order you would get if you did a postorder traversal of your tree.
Values: 6, 3, 7, 4, 9, 1, 0, 8, 5, 2
My answer= [0, 2, 1, 5, 4, 3, 8, 9, 7, 6]
c.
Add the following values (in the order provided) to a binary search tree object and provide the values in the order you would get if you did a preorder traversal of your tree.
Values: 4, 8, 6, 9, 0, 1, 2, 3, 5, 7
My Answer= [4, 0, 8, 1, 2, 3, 6, 5 , 7, 9]
I think I have the trees drawn correctly, I just don't know how to traverse them right...
I get that preorder goes [,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started