diff --git a/a3/binary_search_tree.c b/a3/binary_search_tree.c index 69d4a11..89824ea 100644 --- a/a3/binary_search_tree.c +++ b/a3/binary_search_tree.c @@ -47,6 +47,12 @@ static void inorder_traversal(node_t *root, int *sorted_array, size_t *index) { } } +static size_t count_nodes_helper(node_t *root); + +size_t count_nodes(node_t *tree) { + return count_nodes_helper(tree); +} + static size_t count_nodes_helper(node_t *root) { if (root == NULL) { return 0; @@ -54,10 +60,6 @@ static size_t count_nodes_helper(node_t *root) { return 1 + count_nodes_helper(root->left) + count_nodes_helper(root->right); } -size_t count_nodes(node_t *tree) { - return count_nodes_helper(tree); -} - int *sorted_data(node_t *tree) { size_t index = 0; size_t num_nodes = count_nodes(tree);