Introduction
,
,
Requirement
In-class Lab #3: Binary Trees
Assigned: 5/24/17
Due: 5/26/17 by 5:00pm
You may work in pairs if you choose!
Notes: As with the other mini-labs your code will not be graded/evaluated closely. If your code does not work you will still receive full credit if: 1) it is clear you attempted to create a complete solution
(no large missing pieces, compiles or has at most minimal compile-time errors);
2) it is well-commented to show your thought process.
Complete Ch. 19, Programming Exercises #1 and #2
The text of each question is copied here for your reference. Code is posted to Canvas for the binaryTreeType and
binarySearchTree classes. Note your test code will need to work for the binarySearchTree class since binaryTreeType
is an abstract class.
1. Write the definition of the function, nodeCount, that returns the number of nodes in the binary tree. Add this
function to the class binaryTreeType and create a program to test this function.
2. Write the definition of the function, leavesCount, that takes as a parameter a pointer to the root node of a
binary tree and returns the number of leaves in a binary tree. Add this function to the class binaryTreeType and
create a program to test this function.