加/**/表示另一种二叉排序树的创建方法
第一类
#include <iostream>
using namespace std;
class TreeNode {
public:
int data;
TreeNode *LeftChild;
TreeNode *RightChild;
TreeNode() :LeftChild(NULL), RightChild(NULL) {}
};
class BiSortTree {
private:
TreeNode *root;
int *info;
int size;
int loc;
TreeNode *CreateTree();
TreeNode* InsertNode(TreeNode *p, int d);
TreeNode* Search(TreeNode *p, int d);
void Delete(int d);
public:
BiSortTree(int s, int arr[]);
void CreateBiSortTree();
void InsertBiSortTree(int d);
void InOder(TreeNode *p);
void InOderTree();
void SearchData(int d);
void DeleteData(int d);
};
BiSortTree::BiSortTree(int s, int arr[]) {
/*
loc = 1;
*/
loc = 0;
count = 0;
size = s;
info = new int[size];
for (int i = 0; i < size; i++)
info[i] = arr[i];
}
void BiSortTree::CreateBiSortTree() {
/*
root = new TreeNode();
if (size)
root->data = info[0];
CreateTree(root);
*/
Creat