// Qustion#13.(i):
// Briefly
explain the purpose of the following
// two lines of compiler directives and the #endif
// compiler directive in the
end.
#ifndef MY_BINARY_SEARCH_
#define MY_BINARY_SEARCH_
#include <iostream>
#include "DateType.h"
using namespace std;
struct TreeNode
{
DateType Value;
TreeNode * Left;
TreeNode * Right;
};
class Tree
{
public:
Tree();
~Tree();
void Display();
void Insert(DateType Val);
bool Search(DateType Val);
void DeleteItem(DateType Val);
// Delete a value from tree.
private:
TreeNode * Root;
void InsertTree(TreeNode * & SubtreeRoot, DateType Val);
void DisplayTree(TreeNode * SubtreeRoot);
bool SearchTree(TreeNode * SubtreeRoot, DateType Val);
void DeleteCompleteTree(TreeNode * SubtreeRoot);
// Find the predecessor of the root node in SubtreeRoot.
// If there is one, return true and store the predecessor data in data
//Otherwise, return false.
bool GetPredecessor(TreeNode * SubtreeRoot, DateType& data);
void Delete(TreeNode * & SubtreeRoot, DateType item);
void DeleteNode(TreeNode * & SubtreeRoot);
};
#endif