Purchase Solution

Binary Tree Data Structure Questions using C++ and STL

Not what you're looking for?

Ask Custom Question

Binary Trees:
10.26

Use the following tree, in its original from, for each part of this question:

----
See Attached.

---

(a). If the value 33 is inserted into the tree, which node would be its parent?
(b). If the value 72 is inserted into the tree, which node would be its parent?
(c). If the root node 50 is deleted, the erase algorithm selects which node as the replacement node?
(d). If the node 30 is deleted, the erase algorithm selects which node as the replacement node?
(e). Traverse the tree, and list the nodes, via a preorder scan.
(f). Traverse the tree, and list the nodes, via an inorder scan.
(g). Traverse the tree, and list the nodes, via an postorder scan
(h). Traverse the tree, and list the nodes, via an level-order scan

Attachments
Purchase this Solution

Solution Summary

This solution provides detailed answers to several questions related to a binary tree. This includes tree inserts, deletes, and various tree traversals.

Solution Preview

(a). If the value 33 is inserted into the tree, which node would be its parent?

Starting at the root we can find where 33 should go. Since 33 is less than 50 it must go on the left-hand subtree. Since it is greater than 25 it goes to the right child of the 25 node. Since 33 is less than 35 it goes to the left. And finally, since 30 is a leaf node, 33 is added below it. So the parent for 33 is 30.

(b). If the value 72 is inserted into the tree, which node would be its parent?

Using the same method as above we find ...

Purchase this Solution


Free BrainMass Quizzes
Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

C# variables and classes

This quiz contains questions about C# classes and variables.