33#define Type BINARY_NODE_TYPE
36#define BST_EMPTY (BSTree*) 0
struct BinaryNode BSTree
This module define a Abstract Data Type for the structure Binary Search Tree.
Definition bst.h:30
BSTree * bst_create_node(BSTree *left, BSTree *right, Type value)
Creates a new BST node.
BSTree * bst_create(void)
Creates an empty BST.
int bst_exists(BSTree *t, Type c)
Checks if a value exists in a BST.
BSTree * bst_remove(BSTree *t, Type c)
Removes a value from a BST.
int bst_nodes(BSTree *t)
Counts the number of nodes in a BST.
void bst_infix(BSTree *t)
Prints the elements of a BST in in-order traversal.
int bst_equals(BSTree *t1, BSTree *t2)
Compares two BSTs for equality.
int bst_two_children(BSTree *t)
Counts the number of nodes in a BST that have two children.
int bst_height(BSTree *t)
Returns the height of a BST.
void bst_free(BSTree *t)
Frees the memory allocated for a BST.
void bst_posfix(BSTree *t)
Prints the elements of a BST in post-order traversal.
BSTree * bst_search(BSTree *t, Type c)
Searches for a value in a BST.
int bst_empty(BSTree *t)
Checks if a BST is empty.
int bst_leafs_primes(BSTree *t)
Counts the number of leaf nodes in a BST that are prime numbers.
BSTree * bst_insert(BSTree *t, Type c)
Inserts a value into a BST.
void bst_prefix(BSTree *t)
Prints the elements of a BST in pre-order traversal.
void bst_print(BSTree *t)
Prints the elements of a BST in in-order traversal.
int bst_nodes_equal_height(BSTree *t)
Counts the number of nodes in a BST that have equal branch heights.
#define Type
Definition sort.h:17
A node in a binary tree.
Definition binary-tree.h:29
BINARY_NODE_TYPE value
Definition binary-tree.h:30
struct BinaryNode * left
Definition binary-tree.h:32
struct BinaryNode * right
Definition binary-tree.h:33