•	Add a 95 to the tree from last class, we get a more complicated case. See the board.
•	Clock-wise rotation:
•	root of left subtree is the new root
•	old root is the right child of new root
•	old right child of new root is now the left child of old root
•	Counter Clock-wise rotation:
•	root of right subtree is the new root
•	old root is the left child of new root
•	old left child of new root is now the right child of old root
•	Sample tree related problems
•	Derive a new type from BSTree, with one new operation called edges. edges() returns number of edges in the tree.
•	There is a simple algorithm return Size() - 1;
•	You can also write another algorithm that uses global variable and uses one of the traversals.
•	Don’t use either of the above algorithms. Write a recursive function.
::::::::::::::
edge.cpp
::::::::::::::
#include <stdlib.h>

#include "edge.h"

void main(void)
{
        EdgeTree<int> b;
        for(int i = 0; i < 10; i++)
        {
                b.Insert(rand()%100);
        }
        cout << "Number of edges = " << b.edges() << endl;
}
::::::::::::::
edge.h
::::::::::::::
# include "bstree.h"

template <class T>
class EdgeTree : public BSTree<T>
{
        int edges(BinaryTreeNode<T>* t);
        public:
        int edges(){return edges(root);}
};

template <class T>
int EdgeTree<T>::edges(BinaryTreeNode<T>* t)
{
        if(!t) return 0;
        int e = 0;
        if(t->LeftChild) e += 1 + edges(t->LeftChild);
        if(t->RightChild) e += 1 + edges(t->RightChild);
        return e;
}
•	Derive a new Type from BSTree<int> that has two additional functions called odd() and even() that return number of odd numbers and number of even numbers in the tree.
•	Write odd() functions using a traversal.
•	Write even() using recursions
::::::::::::::
oddeven.cpp
::::::::::::::
#include <stdlib.h>

#include "oddeven.h"

void main(void)
{
        OddEvenTree b;
        for(int i = 0; i < 10; i++)
        {
                b.Insert(rand()%100);
        }
        b.Insert(1);
        b.InOutput();
        cout << "Number of odds = " << b.odd() << endl;
        cout << "Number of evens = " << b.even() << endl;
}
::::::::::::::
oddeven.h
::::::::::::::
# include "bstree.h"

class OddEvenTree : public BSTree<int>
{
        int even(BinaryTreeNode<int>* t);

        public:
        int even(){return even(root);}
        int odd();
};

int OddEvenTree::even(BinaryTreeNode<int>* t)
{
        if(!t) return 0;
        int e = 0;
        if(t->data%2 == 0) e++;
        e += even(t->LeftChild);
        e += even(t->RightChild);
        return e;
}

int num_odd;
void count_odd(BinaryTreeNode<int>* t)
{
        if(t->Data()%2)num_odd++;
}

int OddEvenTree::odd()
{
        num_odd = 0;
        BinaryTree<int>::InOrder(count_odd);
        return num_odd;
}