aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/full_bisect_test/preorder.c
diff options
context:
space:
mode:
Diffstat (limited to 'binary_search_tool/full_bisect_test/preorder.c')
-rw-r--r--binary_search_tool/full_bisect_test/preorder.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/binary_search_tool/full_bisect_test/preorder.c b/binary_search_tool/full_bisect_test/preorder.c
new file mode 100644
index 00000000..11fe93a3
--- /dev/null
+++ b/binary_search_tool/full_bisect_test/preorder.c
@@ -0,0 +1,23 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "bin-trees.h"
+
+static void
+real_preorder (tree_ptr root)
+{
+ if (root == NULL)
+ return;
+
+ printf ("%d ", root->data);
+ real_preorder (root->left);
+ real_preorder (root->right);
+}
+
+
+void
+pre_order_traverse (tree_ptr root)
+{
+ printf ("pre-order traversal, with recursion: \n");
+ real_preorder (root) ;
+ printf ("\n");
+}