Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 [, , ] and such but? when the tree is weird/not full I get lost :/

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Define pay equity.

Answered: 1 week ago