From 68e5a47eb33e511cb8d60f8db68befababe153bf Mon Sep 17 00:00:00 2001 From: Weber Date: Sat, 27 Apr 2024 19:20:50 +0000 Subject: [PATCH] test --- a3/binary_search_tree.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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);