Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a balanced tree in C++ that asks the user the level or depth of the tree a

ID: 3546855 • Letter: W

Question

Write a balanced tree in C++ that asks the user the level or depth of the tree and it builds the tree


the program has to be similar to the pseudocode below.


basic algorithm

In the beggining it asks the user to enter the level or heigh of the tree. So level 0 is the root level 1= 2 nodes
level 2= 4 nodes and so on.


level 0

create root

level 1:

create left node
link node to root
go up (root)

create right node
link node to root
go up (root)

level 2:

move left
   perform level1
go up(root)
moveright
   perfrom level 1
go up(root)

level 3:

move left
move left
perform level2
go up
moveright perform level2
go up

*Basically after this its supposed to make a recursive function so that it creates the amount of nodes the user enters.

Explanation / Answer

A tree where no leaf is much farther away from the root than any other leaf. Different balancing schemes allow different definitions of

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote