-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path102-main.c
45 lines (38 loc) · 1.26 KB
/
102-main.c
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
38
39
40
41
42
43
44
45
#include <stdlib.h>
#include <stdio.h>
#include "binary_trees.h"
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
binary_tree_t *root;
int complete;
root = binary_tree_node(NULL, 98);
root->left = binary_tree_node(root, 12);
root->right = binary_tree_node(root, 128);
root->left->right = binary_tree_node(root->left, 54);
root->right->right = binary_tree_node(root, 402);
root->left->left = binary_tree_node(root->left, 10);
binary_tree_print(root);
complete = binary_tree_is_complete(root);
printf("Is %d complete: %d\n", root->n, complete);
complete = binary_tree_is_complete(root->left);
printf("Is %d complete: %d\n", root->left->n, complete);
root->right->left = binary_tree_node(root->right, 112);
binary_tree_print(root);
complete = binary_tree_is_complete(root);
printf("Is %d complete: %d\n", root->n, complete);
root->left->left->left = binary_tree_node(root->left->left, 8);
binary_tree_print(root);
complete = binary_tree_is_complete(root);
printf("Is %d complete: %d\n", root->n, complete);
root->left->right->left = binary_tree_node(root->left->right, 23);
binary_tree_print(root);
complete = binary_tree_is_complete(root);
printf("Is %d complete: %d\n", root->n, complete);
binary_tree_delete(root);
return (0);
}