aboutsummaryrefslogtreecommitdiff
path: root/binary_search_tool/full_bisect_test/preorder.c
blob: 11fe93a3daf7a8272ff0a2b73a1efe37707aa46f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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");
}