Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

implement a binary search tree from scratch ( i . e . , no use of predefined coding routines to perform tree actions ) .

implement a binary search tree from scratch (i.e., no use of predefined coding routines to perform tree actions).There are many ways to print a tree, you can do it any way you want to, but one approach could be to create a 2-dimension array that is originally filled with spaces. Based on the height of the tree and which node you are at in a tree traversal you can determine which location to place the value into the array. Then just print the array values since spaces are already in the array for spacing and locations where children do not exist in the tree you wont have to format it just include a blank line or two between the printed rows. The output should be similar to the picture below. Please help me out i would greatly apprceiate it. Example output after first 6 inserts for BST ... you pick the type of tree display to use!
Test 1: Random Searches Insert [display test number and title of test]
Insert 9
9
[Example tree format]
(9)
[Example list format]
Tree height is: 0
Insert 7
9
7
(9(L7))
Tree height is: 1
image text in transcribed

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

Step: 3

blur-text-image

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

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions

Question

8. Do you want to outsource the entire training function?

Answered: 1 week ago