Summary.txt: Passed: check of BST initialization. Passed: check of BinaryNode initialization. Passed: check of BST insertion. Passed: check of BST isEmpty() function. Passed: check of BST search. Passed: check of BST deletion. Passed: check of BinaryNode cloning. Passed: check of BST cloning. Passed 8 of 8 tests executed. ------------------------------------------------------------------------ TestTreeInitialization.txt: checkTreeInitialization results: Creating a new BST using default constructor. BST root was OK. ------------------------------------------------------------------------ TestNodeInitialization.txt: checkNodeInitialization results: Creating a new BinaryNode using basic constructor. Node contains correct data value. Node's left child pointer was OK. Node's right child pointer was OK. ------------------------------------------------------------------------ TestInsertion.txt: Begin test of BST insertion. Checking insertion of value to empty tree... Root pointer is not null. Root node contains correct data value. Root node pointers are both null. Checking insertion of two children of the current root node... Insertion did not change root address. Root node has two non-null child pointers. Left child stores correct value. Right child stores correct value. Let's see what the tree looks like now: --- 657 667 --- 677 Try inserting a value, 657, that's already in the tree. insert() returned false. Let's see what the tree looks like now: --- 657 667 --- 677 Beginning general insertion test with a new, empty tree... Filling BST with 125 random integer values. Inserted values: 200 498 -518 -606 -492 46 167 -561 -94 -635 -113 -403 -688 596 519 -572 221 -14 803 707 -152 251 -156 -660 121 -507 -783 -958 -211 401 817 -737 -138 4 -192 -303 -645 967 -359 -385 300 53 -453 -265 -863 -637 -752 -126 -589 -619 -918 -790 987 647 591 -580 -541 -823 -633 -495 851 -577 644 90 182 -423 714 395 452 -161 336 479 889 -952 342 -138 -346 -749 471 347 247 942 105 169 165 358 483 -753 181 534 -336 -415 -422 -188 570 -166 -233 -824 -640 -856 864 471 267 -881 -158 376 -618 -775 376 -683 365 205 -304 -3 585 -722 422 -440 -639 -675 -977 291 498 722 -127 Resulting tree follows. If the log ends suddenly, it's likely a pointer exception occurred. --------------------- -977 ------------------ -958 --------------------------- -952 ------------------------ -918 --------------------------- -881 --------------------- -863 --------------------------------- -856 ------------------------------ -824 --------------------------- -823 ------------------------ -790 --------------- -783 --------------------------- -775 ------------------------ -753 --------------------- -752 ------------------------ -749 ------------------ -737 --------------------- -722 ------------ -688 ------------------ -683 --------------------- -675 --------------- -660 ------------------ -645 ------------------------ -640 --------------------------- -639 --------------------- -637 --------- -635 --------------- -633 ------------ -619 --------------- -618 ------ -606 --------------- -589 ------------------ -580 --------------------- -577 ------------ -572 --------- -561 ------------ -541 --- -518 --------- -507 ------------ -495 ------ -492 --------------------- -453 --------------------------- -440 ------------------------ -423 ------------------------------ -422 --------------------------- -415 ------------------ -403 ------------------------------------ -385 --------------------------------- -359 ------------------------------------ -346 --------------------------------------- -336 ------------------------------------------ -304 ------------------------------ -303 --------------------------------- -265 ------------------------------------ -233 --------------------------- -211 ------------------------------ -192 ------------------------------------ -188 --------------------------------------- -166 --------------------------------- -161 ------------------------------------ -158 ------------------------ -156 --------------------- -152 ------------------------ -138 ------------------------------ -127 --------------------------- -126 --------------- -113 ------------ -94 --------------- -14 --------------------- -3 ------------------ 4 --------- 46 ------------------ 53 --------------------- 90 ------------------------ 105 --------------- 121 ------------------ 165 ------------ 167 ------------------ 169 --------------------- 181 --------------- 182 200 --------- 205 ------ 221 ------------ 247 --------- 251 ------------------ 267 --------------------- 291 --------------- 300 --------------------- 336 ------------------------ 342 --------------------------- 347 ------------------------------ 358 ------------------------------------ 365 --------------------------------- 376 ------------------ 395 ------------ 401 ------------------ 422 --------------- 452 --------------------- 471 ------------------ 479 --------------------- 483 --- 498 --------- 519 --------------- 534 ------------------ 570 --------------------- 585 ------------ 591 ------ 596 ------------------ 644 --------------- 647 ------------ 707 --------------- 714 ------------------ 722 --------- 803 ------------ 817 ------------------ 851 ------------------------ 864 --------------------- 889 ------------------------ 942 --------------- 967 ------------------ 987 ------------------------------------------------------------------------ TestIsEmpty.txt: Begin test of isEmpty() function. Building an empty tree... isEmpty() returned true. Inserting a value into the tree... isEmpty() returned false. ------------------------------------------------------------------------ TestSearch.txt: Begin test of BST search. Filling BST with 67 random integer values. Inserted values: -680 -798 -983 339 56 599 -674 324 -977 14 44 -563 538 -986 832 179 641 95 962 -672 -478 -308 973 -649 -808 -104 -304 327 -660 -367 948 903 -92 -722 917 81 -118 936 -44 -950 526 -434 93 -606 207 -374 -404 -561 -74 171 454 127 -699 -222 350 255 -602 753 -34 830 855 -679 800 326 333 980 -533 Resulting tree follows. If the log ends suddenly, it's likely a pointer exception occurred. --------- -986 ------ -983 --------- -977 --------------- -950 ------------ -808 --- -798 ------ -722 --------- -699 -680 ------------ -679 --------- -674 ------------------ -672 ------------------------ -660 --------------------- -649 ------------------------ -606 --------------------------- -602 --------------- -563 --------------------- -561 ------------------------ -533 ------------------ -478 --------------------------- -434 --------------------------------- -404 ------------------------------ -374 ------------------------ -367 --------------------- -308 --------------------------- -304 --------------------------------- -222 ------------------------------ -118 ------------------------ -104 --------------------------- -92 --------------------------------- -74 ------------------------------ -44 --------------------------------- -34 ------------ 14 --------------- 44 ------ 56 ------------------ 81 --------------------- 93 --------------- 95 --------------------- 127 ------------------ 171 ------------ 179 --------------- 207 ------------------ 255 --------- 324 --------------- 326 ------------ 327 --------------- 333 --- 339 ------------------ 350 --------------- 454 ------------ 526 --------- 538 ------ 599 ------------ 641 --------------- 753 --------------------- 800 ------------------ 830 --------- 832 --------------------- 855 ------------------ 903 --------------------- 917 ------------------------ 936 --------------- 948 ------------ 962 --------------- 973 ------------------ 980 Search for some random elements that should be present: searching for: -986 Evidently found! Let's see what we got: -986 searching for: -950 Evidently found! Let's see what we got: -950 searching for: -722 Evidently found! Let's see what we got: -722 searching for: -679 Evidently found! Let's see what we got: -679 searching for: -660 Evidently found! Let's see what we got: -660 searching for: -602 Evidently found! Let's see what we got: -602 searching for: -533 Evidently found! Let's see what we got: -533 searching for: -404 Evidently found! Let's see what we got: -404 searching for: -308 Evidently found! Let's see what we got: -308 searching for: -118 Evidently found! Let's see what we got: -118 searching for: -74 Evidently found! Let's see what we got: -74 searching for: 14 Evidently found! Let's see what we got: 14 searching for: 81 Evidently found! Let's see what we got: 81 searching for: 127 Evidently found! Let's see what we got: 127 searching for: 207 Evidently found! Let's see what we got: 207 searching for: 326 Evidently found! Let's see what we got: 326 searching for: 339 Evidently found! Let's see what we got: 339 searching for: 526 Evidently found! Let's see what we got: 526 searching for: 641 Evidently found! Let's see what we got: 641 searching for: 830 Evidently found! Let's see what we got: 830 searching for: 903 Evidently found! Let's see what we got: 903 searching for: 948 Evidently found! Let's see what we got: 948 searching for: 980 Evidently found! Let's see what we got: 980 Searching for some absent elements: searching for: 1140 not there! searching for: 2271 not there! searching for: 2692 not there! ------------------------------------------------------------------------ TestDeletion.txt: Begin test of BST deletion. Building a one-node tree... Attempting to delete root node.... delete() returned true. Success: tree root deletion with single-node tree passed. Checking deletion with 3-node 2-level tree... Building a 3-node 2-level tree. Let's see what the tree looks like now: --- -877 -867 --- -857 Let's try deleting a value, -767, that's not in the tree. delete() returned false. Let's see what the tree looks like now: --- -877 -867 --- -857 Attempting to delete left leaf... Success: left child deletion passed. Attempting to delete root... Success: root deletion passed. Checking deletion with full tree of 3 levels... Building the tree. Attempting to delete root... (two subtrees) Success: root deletion passed. Now let's delete the rest of the right subtree... Checking results of deletion. Success: deletion of right subtree passed. And, now delete the current root...(left subtree only) Checking results of deletion. Success: deletion of root with only left subtree passed. Beginning test of general random deletion. Building tree with 50 nodes. Filling BST with 50 random integer values. Inserted values: 834 -223 956 649 937 -822 -669 -738 -427 976 -353 158 182 43 -729 -119 274 612 687 187 106 -807 696 645 -308 -757 -78 -209 26 -706 -939 389 -551 -174 597 184 429 289 -923 727 -412 729 -121 63 -751 -846 161 -233 954 -366 Resulting tree follows. If the log ends suddenly, it's likely a seg fault occurred. --------- -939 ------------ -923 --------------- -846 ------ -822 --------------- -807 ------------------ -757 --------------------- -751 ------------ -738 --------------- -729 ------------------ -706 --------- -669 --------------- -551 ------------ -427 ------------------ -412 --------------------- -366 --------------- -353 ------------------ -308 --------------------- -233 --- -223 ------------------ -209 --------------------- -174 ------------------------ -121 --------------- -119 ------------------ -78 --------------------- 26 ------------ 43 ------------------ 63 --------------- 106 --------- 158 --------------- 161 ------------ 182 --------------------- 184 ------------------ 187 --------------- 274 ------------------------ 289 --------------------- 389 --------------------------- 429 ------------------------ 597 ------------------ 612 --------------------- 645 ------ 649 --------- 687 ------------ 696 --------------- 727 ------------------ 729 834 ------ 937 --------- 954 --- 956 ------ 976 Deleting some random elements... deleting: -939 deleting: -846 deleting: -807 deleting: -751 deleting: -729 deleting: -669 deleting: -427 deleting: -366 deleting: -308 deleting: -223 deleting: -174 deleting: -119 deleting: 26 deleting: 63 deleting: 158 deleting: 182 deleting: 187 deleting: 289 deleting: 429 deleting: 612 deleting: 649 deleting: 696 deleting: 729 deleting: 937 deleting: 956 Display resulting BST to check for structure and ordering: --------- -923 ------ -822 --------------- -757 ------------ -738 --------------- -706 --------- -551 --------------- -412 ------------ -353 --------------- -233 --- -209 ------------------ -121 --------------- -78 ------------ 43 --------------- 106 --------- 161 --------------- 184 ------------ 274 ------------------ 389 --------------------- 597 --------------- 645 ------ 687 --------- 727 834 ------ 954 --- 976 Delete remaining elements by repeatedly deleting the root: deleting: 834 deleting: 954 deleting: 976 deleting: -209 deleting: -121 deleting: -78 deleting: 43 deleting: 106 deleting: 161 deleting: 184 deleting: 274 deleting: 389 deleting: 597 deleting: 645 deleting: 687 deleting: 727 deleting: -822 deleting: -757 deleting: -738 deleting: -706 deleting: -551 deleting: -412 deleting: -353 deleting: -233 deleting: -923 Deletion terminated with correct count. ------------------------------------------------------------------------ TestNodeCloning.txt: checkNodeCloning results: Creating a new BinaryNode using basic constructor. Attempting to clone that node. Well, created something new. Clone and original are at different addresses. Clone and original exhibit equal data values. ------------------------------------------------------------------------ TestTreeCloning.txt: Begin test of BST cloning. Filling BST with 45 random integer values. Inserted values: 671 -388 167 709 -790 -251 550 973 -310 595 371 -925 -108 -172 -504 -76 -212 -554 385 943 538 817 920 638 -82 202 -3 -580 273 -647 -631 -906 -268 -402 -509 157 -515 920 -805 740 -576 -642 -458 285 -958 Resulting tree follows. If the log ends suddenly, it's likely a pointer exception occurred. ------------ -958 --------- -925 ------------ -906 --------------- -805 ------ -790 ------------------ -647 ------------------------ -642 --------------------- -631 --------------- -580 ------------------ -576 ------------ -554 ------------------ -515 --------------- -509 --------- -504 --------------- -458 ------------ -402 --- -388 ------------ -310 --------------- -268 --------- -251 ------------------ -212 --------------- -172 ------------ -108 ------------------ -82 --------------- -76 ------------------ -3 --------------------- 157 ------ 167 --------------- 202 ------------------ 273 --------------------- 285 ------------ 371 --------------- 385 ------------------ 538 --------- 550 ------------ 595 --------------- 638 671 --- 709 --------------- 740 ------------ 817 --------------- 920 --------- 943 ------ 973 Calling BST clone() method on tree. Original and clone are at different addresses. Original and clone roots are at different addresses. Now we'll compare structure and values. Original and copy have same values in same locations. Now we'll insert some new values to the original tree, which should not have any effect on the clone. Resulting modified original tree follows. If the log ends suddenly, it's likely a pointer exception occurred. ------------ -958 --------- -925 ------------ -906 --------------- -805 ------ -790 ------------------ -647 ------------------------ -642 --------------------- -631 --------------- -580 ------------------ -576 ------------ -554 ------------------ -515 --------------- -509 --------- -504 --------------- -458 ------------ -402 --- -388 ------------ -310 --------------- -268 --------- -251 ------------------ -212 --------------- -172 ------------ -108 ------------------ -82 --------------- -76 ------------------ -3 --------------------- 157 ------ 167 --------------- 202 ------------------ 273 --------------------- 285 ------------ 371 --------------- 385 ------------------ 538 --------- 550 ------------ 595 --------------- 638 671 --- 709 --------------- 740 ------------ 817 --------------- 920 --------- 943 ------ 973 ------------------------ 4778 --------------------- 4805 ------------------ 4826 --------------------------- 4847 ------------------------ 4860 --------------------- 4868 --------------- 4913 ------------ 4978 --------- 5000 Now, here's a display of the clone: ------------ -958 --------- -925 ------------ -906 --------------- -805 ------ -790 ------------------ -647 ------------------------ -642 --------------------- -631 --------------- -580 ------------------ -576 ------------ -554 ------------------ -515 --------------- -509 --------- -504 --------------- -458 ------------ -402 --- -388 ------------ -310 --------------- -268 --------- -251 ------------------ -212 --------------- -172 ------------ -108 ------------------ -82 --------------- -76 ------------------ -3 --------------------- 157 ------ 167 --------------- 202 ------------------ 273 --------------------- 285 ------------ 371 --------------- 385 ------------------ 538 --------- 550 ------------ 595 --------------- 638 671 --- 709 --------------- 740 ------------ 817 --------------- 920 --------- 943 ------ 973 ------------------------------------------------------------------------