======================================================== PROCESSING DATA SET: 1 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Preorder traversal of tree data: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Postorder traversal of tree data: 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 TOTAL element in tree is: 20 -------------------------------------------------------- Node: 1 has: 1 son Node: 2 has: 1 son Node: 3 has: 1 son Node: 4 has: 1 son Node: 5 has: 1 son Node: 6 has: 1 son Node: 7 has: 1 son Node: 8 has: 1 son Node: 9 has: 1 son Node: 10 has: 1 son Node: 11 has: 1 son Node: 12 has: 1 son Node: 13 has: 1 son Node: 14 has: 1 son Node: 15 has: 1 son Node: 16 has: 1 son Node: 17 has: 1 son Node: 18 has: 1 son Node: 19 has: 1 son Node: 20 has: 0 son Insert: 21 into tree Delete: 1 from tree code: 0 Deleting Root node .. Insert: 0 into tree Delete: 10 from tree code: 3 Deleting parent with right son . . Delete: 11 from tree code: 3 Deleting parent with right son . . Delete: 5 from tree code: 3 Deleting parent with right son . . Delete: 2 from tree code: 0 Deleting Root node .. Insert: 10 into tree -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 0 3 4 6 7 8 9 10 12 13 14 15 16 17 18 19 20 21 Preorder traversal of tree data: 3 0 4 6 7 8 9 12 10 13 14 15 16 17 18 19 20 21 Postorder traversal of tree data: 0 10 21 20 19 18 17 16 15 14 13 12 9 8 7 6 4 3 TOTAL element in tree is: 18 -------------------------------------------------------- Node: 0 has: 0 son Node: 3 has: 2 son Node: 4 has: 1 son Node: 6 has: 1 son Node: 7 has: 1 son Node: 8 has: 1 son Node: 9 has: 1 son Node: 10 has: 0 son Node: 12 has: 2 son Node: 13 has: 1 son Node: 14 has: 1 son Node: 15 has: 1 son Node: 16 has: 1 son Node: 17 has: 1 son Node: 18 has: 1 son Node: 19 has: 1 son Node: 20 has: 1 son Node: 21 has: 0 son FREETREE: freeing all nodes in the binary tree Freeing memory for Node: 0 Freeing memory for Node: 10 Freeing memory for Node: 21 Freeing memory for Node: 20 Freeing memory for Node: 19 Freeing memory for Node: 18 Freeing memory for Node: 17 Freeing memory for Node: 16 Freeing memory for Node: 15 Freeing memory for Node: 14 Freeing memory for Node: 13 Freeing memory for Node: 12 Freeing memory for Node: 9 Freeing memory for Node: 8 Freeing memory for Node: 7 Freeing memory for Node: 6 Freeing memory for Node: 4 Deleting final root/Node of: 3 * Total nodes deleted: 18 -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 2 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 1 3 5 Preorder traversal of tree data: 3 1 5 Postorder traversal of tree data: 1 5 3 TOTAL element in tree is: 3 -------------------------------------------------------- Node: 1 has: 0 son Node: 3 has: 2 son Node: 5 has: 0 son Delete: 3 from tree code: 0 Deleting Root node .. Delete: 1 from tree code: 1 Deleting left leaf . . -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 5 Preorder traversal of tree data: 5 Postorder traversal of tree data: 5 TOTAL element in tree is: 1 -------------------------------------------------------- Node: 5 has: 0 son FREETREE: freeing all nodes in the binary tree Deleting final root/Node of: 5 * Total nodes deleted: 1 -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 3 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: Preorder traversal of tree data: Postorder traversal of tree data: TOTAL element in tree is: 0 -------------------------------------------------------- Delete: 15 from tree: ** 15 Does not exit on a NULL TREE!! Insert: 30 into tree Insert: 5 into tree Insert: 10 into tree Insert: 20 into tree Delete: 20 from tree code: 2 Deleting right leaf . . Delete: 10 from tree code: 2 Deleting right leaf . . Delete: 5 from tree code: 1 Deleting left leaf . . Delete: 15 from tree Node: 15 for deletion NOT FOUND! Delete: 30 from tree code: 0 Deleting Root node .. Alert! Root Node Deleted -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: Preorder traversal of tree data: Postorder traversal of tree data: TOTAL element in tree is: 0 -------------------------------------------------------- Freetree ABORTED: NULL tree received for processing! -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 4 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 2 Preorder traversal of tree data: 2 Postorder traversal of tree data: 2 TOTAL element in tree is: 1 -------------------------------------------------------- Node: 2 has: 0 son Delete: 2 from tree code: 0 Deleting Root node .. Alert! Root Node Deleted -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: Preorder traversal of tree data: Postorder traversal of tree data: TOTAL element in tree is: 0 -------------------------------------------------------- Freetree ABORTED: NULL tree received for processing! -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 5 DUPLICATE node of: 12, insertion aborted DUPLICATE node of: 35, insertion aborted ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 12 19 25 32 35 37 45 55 60 68 80 87 89 95 Preorder traversal of tree data: 12 25 19 35 32 37 60 45 55 80 68 89 87 95 Postorder traversal of tree data: 19 32 55 45 68 87 95 89 80 60 37 35 25 12 TOTAL element in tree is: 14 -------------------------------------------------------- Node: 12 has: 1 son Node: 19 has: 0 son Node: 25 has: 2 son Node: 32 has: 0 son Node: 35 has: 2 son Node: 37 has: 1 son Node: 45 has: 1 son Node: 55 has: 0 son Node: 60 has: 2 son Node: 68 has: 0 son Node: 80 has: 2 son Node: 87 has: 0 son Node: 89 has: 2 son Node: 95 has: 0 son Delete: 37 from tree code: 3 Deleting parent with right son . . Delete: 13 from tree Node: 13 for deletion NOT FOUND! Insert: 40 into tree Insert: 99 into tree -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 12 19 25 32 35 40 45 55 60 68 80 87 89 95 99 Preorder traversal of tree data: 12 25 19 35 32 60 45 40 55 80 68 89 87 95 99 Postorder traversal of tree data: 19 32 40 55 45 68 87 99 95 89 80 60 35 25 12 TOTAL element in tree is: 15 -------------------------------------------------------- Node: 12 has: 1 son Node: 19 has: 0 son Node: 25 has: 2 son Node: 32 has: 0 son Node: 35 has: 2 son Node: 40 has: 0 son Node: 45 has: 2 son Node: 55 has: 0 son Node: 60 has: 2 son Node: 68 has: 0 son Node: 80 has: 2 son Node: 87 has: 0 son Node: 89 has: 2 son Node: 95 has: 1 son Node: 99 has: 0 son FREETREE: freeing all nodes in the binary tree Freeing memory for Node: 19 Freeing memory for Node: 32 Freeing memory for Node: 40 Freeing memory for Node: 55 Freeing memory for Node: 45 Freeing memory for Node: 68 Freeing memory for Node: 87 Freeing memory for Node: 99 Freeing memory for Node: 95 Freeing memory for Node: 89 Freeing memory for Node: 80 Freeing memory for Node: 60 Freeing memory for Node: 35 Freeing memory for Node: 25 Deleting final root/Node of: 12 * Total nodes deleted: 15 -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 6 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 10 20 30 40 50 60 70 80 90 Preorder traversal of tree data: 50 40 30 20 10 60 70 80 90 Postorder traversal of tree data: 10 20 30 40 90 80 70 60 50 TOTAL element in tree is: 9 -------------------------------------------------------- Node: 10 has: 0 son Node: 20 has: 1 son Node: 30 has: 1 son Node: 40 has: 1 son Node: 50 has: 2 son Node: 60 has: 1 son Node: 70 has: 1 son Node: 80 has: 1 son Node: 90 has: 0 son Delete: 30 from tree code: 3 Deleting parent with left son . . Delete: 20 from tree code: 3 Deleting parent with left son . . Delete: 10 from tree code: 1 Deleting left leaf . . Delete: 50 from tree code: 0 Deleting Root node .. -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 40 60 70 80 90 Preorder traversal of tree data: 60 40 70 80 90 Postorder traversal of tree data: 40 90 80 70 60 TOTAL element in tree is: 5 -------------------------------------------------------- Node: 40 has: 0 son Node: 60 has: 2 son Node: 70 has: 1 son Node: 80 has: 1 son Node: 90 has: 0 son FREETREE: freeing all nodes in the binary tree Freeing memory for Node: 40 Freeing memory for Node: 90 Freeing memory for Node: 80 Freeing memory for Node: 70 Deleting final root/Node of: 60 * Total nodes deleted: 5 -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 7 ======================================================== Elements in Tree BEFORE insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 10 20 30 40 50 Preorder traversal of tree data: 30 20 10 40 50 Postorder traversal of tree data: 10 20 50 40 30 TOTAL element in tree is: 5 -------------------------------------------------------- Node: 10 has: 0 son Node: 20 has: 1 son Node: 30 has: 2 son Node: 40 has: 1 son Node: 50 has: 0 son Insert: 30 into tree DUPLICATE node of: 30, insertion aborted Delete: 55 from tree Node: 55 for deletion NOT FOUND! Delete: 40 from tree code: 3 Deleting parent with right son . . Insert: 50 into tree DUPLICATE node of: 50, insertion aborted Insert: 40 into tree Delete: 40 from tree code: 1 Deleting left leaf . . Insert: 15 into tree Insert: 25 into tree Delete: 30 from tree code: 0 Deleting Root node .. Delete: 15 from tree code: 2 Deleting right leaf . . -------------------------------------------------------- Elements in Tree AFTER insertion/deletion of nodes -------------------------------------------------------- Inorder traversal of tree data: 10 20 25 50 Preorder traversal of tree data: 50 20 10 25 Postorder traversal of tree data: 10 25 20 50 TOTAL element in tree is: 4 -------------------------------------------------------- Node: 10 has: 0 son Node: 20 has: 2 son Node: 25 has: 0 son Node: 50 has: 1 son FREETREE: freeing all nodes in the binary tree Freeing memory for Node: 10 Freeing memory for Node: 25 Freeing memory for Node: 20 Deleting final root/Node of: 50 * Total nodes deleted: 4 -------------------------------------------------------- ======================================================== PROCESSING DATA SET: 8