summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..5e16d8b
--- /dev/null
+++ b/main.c
@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "trees.h"
+
+int main(){
+ tree_t *t1 = createTree();
+ addNode(t1->root, 1, 'l');
+ addNode(t1->root, 2, 'r');
+ addNode(t1->root->left, 11, 'l');
+ addNode(t1->root->left->left, 111, 'l');
+ addNode(t1->root->right, 22, 'r');
+ addNode(t1->root->right, 21, 'l');
+ printTree(*t1);
+ printf("\nDepth: %d\n", treeDepth(*t1));
+ printf("End node count: %d\n", endNodeCount(*t1));
+ printf("Tree contains 2? %d\n", treeContainsN(*t1, 2));
+ printf("Tree contains 3? %d\n", treeContainsN(*t1, 3));
+ printf("Total number of nodes: %d\n", nodeCount(*t1));
+
+ sortTree(t1);
+ printf("Sorted tree:\n");
+ printTree(*t1);
+ printf("\n");
+ return 0;
+
+}