Exemplo n.º 1
0
void testPart4(){
	BinarySearchTree<BSTNode1<int>, int> tree = treeMaker(1);
	// Created print method in DLList
	tree.getLE(5).print();
	tree.getLE(30).print();
	tree.getLE(-1).print();
	cout << endl;
	BinarySearchTree<BSTNode1<int>, int> tree2 = treeMaker(2);
	tree2.getLE(50).print();
	tree2.getLE(20).print();
	tree2.getLE(0).print();
	cout << "END4" << endl;
}
Exemplo n.º 2
0
bool TestPartFour() {
  BinarySearchTree<BSTNode1<int>, int> tree;
    tree.add(15);
    tree.add(10);
    tree.add(14);
    tree.add(17);
    tree.add(20);
    tree.add(16);
    tree.add(19);
    tree.add(26);
    tree.add(7);
    tree.add(9);
    tree.add(5);

    DLList<int> list1 = tree.getLE(17);
    DLList<int> list2 = tree.getLE(9);

    return ((list1.size() == 8 && list2.size() == 3)) ? true : false;
}
Exemplo n.º 3
0
void testPart4() {
	cout << "Part 4" << endl;
		BinarySearchTree<BSTNode1<int>, int> tree;
		tree.add(15);
		tree.add(5);
		tree.add(3);
		tree.add(12);
		tree.add(10);
		tree.add(6);
		tree.add(7);
		tree.add(13);
		tree.add(16);
		tree.add(20);
		tree.add(18);
		tree.add(23);
		cout << "Test 1:" << endl;
		DLList<int> treeTester1 = tree.getLE(5);
		cout << "Test 2:" << endl;
		DLList<int> treeTester2 = tree.getLE(12);
		cout << "Test 3:" << endl;
		DLList<int> treeTester3 = tree.getLE(18);
		cout << "Test 4:" << endl;
		DLList<int> treeTester4 = tree.getLE(23);
		cout << "Test 5:" << endl;
		DLList<int> treeTester5 = tree.getLE(50);

		BinarySearchTree<BSTNode1<int>, int> tree2;
		tree2.add(10);
		tree2.add(5);
		tree2.add(3);
		tree2.add(7);
		tree2.add(20);
		tree2.add(15);
		tree2.add(22);
		cout << "Test 6:" << endl;
		DLList<int> tree2Tester = tree2.getLE(20);

}
Exemplo n.º 4
0
void TestBinarySearchTreeGetLE() {
  BinarySearchTree<BSTNode1<int>, int> b;

  b.add(4);
  b.add(2);
  b.add(5);
  b.add(1);
  b.add(3);
  b.add(6);

  DLList<int> l = b.getLE(3);

  assert(l.contains(1));
  assert(l.contains(2));
  assert(l.contains(3));
  assert(!l.contains(4));
  assert(!l.contains(5));
  assert(!l.contains(6));
}