


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Out: 11/ Due: 12/1 by 11:59 PM
In Lecture # 21-22, we introduced an implementation of a parameterized binary search tree abstract data type. There are several strategies for im- plementing the BST ADT. In the code, the preorderTraverse function was implemented. Your task in this project includes implementing two addi- tional traversal functions: inorderTraverse and postorderTraverse. These are pretty much analogous to preorderTraverse and they should ordinarily not cause you much grief! You will also implement three additional recursive functions: fullify, trim() and countOneChildNodes. Like the traversal func- tions, these will be implemented using two functions each: a public wrapper function and a private auxiliary function that does most of the computation. The wrapper function should call its auxiliary function, passing it the root of the tree. You will have to write the main function. There are three files in this application: A client file, usebstree.cpp, the binary search tree implemen- tation file, bstree.cpp, and an interface for the Binary Search Tree class, bstree.h. I have also included usebstreeexe, a working executable version of the program. This project has substantially more code than we have seen in this course. However, most of it is already completed. Your task will be to complete parts of the code I have left out. Once you complete those parts and write the client program, the code should run correctly. In many instances, I have implemented a function analogous to the ones you have to write. So it will be a matter of figuring out how the ones I have written work. To make the recursion work properly, you will need to implement a wrapper method that provides the public interface to the client and an auxiliary private method that actually does the bulk of the computation via recursion. Only the fol- lowing additional functions must be added with public access. Any auxiliary function you choose to implement must be private, for internal use only.
/**
/**
/**
Definition 1. Full Binary Tree: a binary tree in which each node has zero or two children.
Definition 2. Leaf (or terminal node): a node in a binary tree that has no children.
In this project, you will add code to bstree.h, bstree.cpp, and rewrite the main function of usebstree.cpp. You may completely remove the other functions from usebstree.cpp.
/** @file filename @author your name @date 9999-99- Description: describe what this file does Course: CS1254. Logon ID: cs1254xx Project #: 5 Instructor: Duncan */