+1 714-215-3097

(Solved) : Using C Given Degenerate Tree Tree Nodes Less Greater Root Perform Place Rotations Constru Q35597131

Using C++

Given a degenerate tree (a tree where all the nodes are less orgreater than the root, perform ‘in-place’ rotations to construct acomplete tree. ‘In-Place’ means cycle existing nodes instead ofcreating new nodes. Splicing may also be used, but preferrotations.

An ‘in-place’ rotation means do NOT construct a new tree.Reassemble the degenerate tree to a complete tree using existingnodes. To verify the nodes are complete, create a degenerate treewith the number of nodes being a power of 2 + 1 for the root.

Test your algorithm on binary trees with nodes > 8, but yourcode should work with any size degenerate tree. To demonstrate thatyour tree is complete, write a level order output function thatoutput’s each level of the tree before printing the next level. Seethe midterm question#5 for some hints on printing a tree in levelorder.

Leave a Reply

Your email address will not be published. Required fields are marked *