Purchase Solution

C++ Binary Search Tree

Not what you're looking for?

Ask Custom Question

Use the attached Binary Search Tree template (BST.h) for the following exercises.

1. Write a recursive member function level() for class template BST(Binary Search Tree) that determines the level in the BST at which a specified item is located. The root of the BST is at level 0, its children are at level 1, and so on.

2. Write a recursive member function leafCount() for class template BST to count the leaves in a binary tree.
[Hint: How is the number of leaves in the entire tree related to the number of leaves in the left and right subtrees of that root?]

Purchase this Solution

Solution Summary

Attached 220833.h also fixes some compilation errors in BST.h apart from adding new public functions (getLevel, getLeafCount) and new private functions (level, leafCount).

Purchase this Solution


Free BrainMass Quizzes
Basic Networking Questions

This quiz consists of some basic networking questions.

C# variables and classes

This quiz contains questions about C# classes and variables.

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.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

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.