Exemple #1
0
void Test2()
{
	int a[] = { 5, 3, 4, 1, 7, 8, 2, 6, 0, 9 };
	BSTree<int, int> bst;
	for (int i = 0; i < (sizeof(a) / sizeof(a[0])); ++i)
	{
		bst.InsertR(a[i], i);
	}
	bst.Inorder();
	cout << bst.FindR(0)->_key << endl;
	cout << bst.RemoveR(3) << endl;
}
void Test1()
{
	BSTree<int, int> b;
	int a[] = { 1, 3, 6, 7, 2, 8, 0 };
	for (int i = 0; i < sizeof(a) / sizeof(a[0]); ++i)
	{
		b.InsertR(a[i], i);
	}
	b.InOder();
	cout<<b.IsBlanceTree()<<endl;
	b.RemoveR(7);
	b.RemoveR(6);
	b.RemoveR(8);
	b.RemoveR(0);
	b.RemoveR(3);
	b.RemoveR(2);
	b.RemoveR(1);
	b.InOder();
	return;
}