# Binary Search Tree Exercise

### Objective

To gain experience with binary search trees.

### Task

The tree balancing algorithm we saw in class creates a temporary array to store the nodes in.
To do this, it must know how many nodes are in the tree.
For the example in class, the tree kept a counter and incremented it on each insert and decremented it on each removal.

Instead, we can write a function that counts the number of nodes in the tree without needing to store it as a member variable.
For this lab, you will write a function to do this.

### Details

- Start by downloading bst.cpp
which contains a copy of the binary search tree class we were working with in
class.
- This file has an empty function called count.
- Fill in this function with code to count the nodes in the tree.
- You may want to add another function that takes in a Node* to use with
recursion like the insert and search functions.

### Submitting

When you're done, email the code to ifinlay@umw.edu.
Copyright © 2018 Ian Finlayson | Licensed under a Creative Commons Attribution 4.0 International License.