-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path9-main.c
More file actions
27 lines (24 loc) · 692 Bytes
/
9-main.c
File metadata and controls
27 lines (24 loc) · 692 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
#include "binary_trees.h"
/**
* main - Entry point
*
* Return: Always 0 (Success)
*/
int main(void)
{
binary_tree_t *root;
size_t height;
root = binary_tree_node(NULL, 98);
root->left = binary_tree_node(root, 12);
root->right = binary_tree_node(root, 402);
binary_tree_insert_right(root->left, 54);
binary_tree_insert_right(root, 128);
binary_tree_print(root);
height = binary_tree_height(root);
printf("Height from %d: %lu\n", root->n, height);
height = binary_tree_height(root->right);
printf("Height from %d: %lu\n", root->right->n, height);
height = binary_tree_height(root->left->right);
printf("Height from %d: %lu\n", root->left->right->n, height);
return (0);
}