-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy path114-main.c
More file actions
37 lines (32 loc) · 763 Bytes
/
114-main.c
File metadata and controls
37 lines (32 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include <stdlib.h>
#include <stdio.h>
#include "binary_trees.h"
/**
* main - Entry point
*
* Return: 0 on success, error code on failure
*/
int main(void)
{
bst_t *tree;
int array[] = {
79, 47, 68, 87, 84, 91, 21, 32, 34, 2,
20, 22, 98, 1, 62, 95
};
size_t n = sizeof(array) / sizeof(array[0]);
tree = array_to_bst(array, n);
if (!tree)
return (1);
binary_tree_print(tree);
tree = bst_remove(tree, 79);
printf("Removed 79...\n");
binary_tree_print(tree);
tree = bst_remove(tree, 21);
printf("Removed 21...\n");
binary_tree_print(tree);
tree = bst_remove(tree, 68);
printf("Removed 68...\n");
binary_tree_print(tree);
binary_tree_delete(tree);
return (0);
}