Data Structures Lerax  v3.0-104-ge031
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
avl.h
Go to the documentation of this file.
1
12
13#ifndef AVLT_H
14#define AVLT_H
15
21
22
23/* Binary Search Tree DataType Definition */
24#include "binary-tree.h"
25
32typedef struct BinaryNode AVLTree;
33#ifndef Type
34#define Type BINARY_NODE_TYPE
35#endif
36
37#define AVLT_EMPTY (AVLTree*) 0
38
47
55
64
74
85
93
102
112
122
130
138
146
154
163
172
181
191
201
202#endif
struct BinaryNode AVLTree
This module define a Abstract Data Type for the structure Binary Search Tree.
Definition avl.h:32
AVLTree * avl_create(void)
Creates an empty AVL tree.
int avl_two_children(AVLTree *t)
Counts the number of nodes in an AVL tree that have two children.
int avl_nodes_equal_height(AVLTree *t)
Counts the number of nodes in an AVL tree that have equal branch heights.
AVLTree * avl_remove(AVLTree *t, Type c)
Removes a value from an AVL tree.
void avl_infix(AVLTree *t)
Prints the elements of an AVL tree in in-order traversal.
int avl_nodes(AVLTree *t)
Counts the number of nodes in an AVL tree.
void avl_free(AVLTree *t)
Frees the memory allocated for an AVL tree.
int avl_empty(AVLTree *t)
Checks if an AVL tree is empty.
int avl_leafs_primes(AVLTree *t)
Counts the number of leaf nodes in an AVL tree that are prime numbers.
int avl_equals(AVLTree *t1, AVLTree *t2)
Compares two AVL trees for equality.
int avl_height(AVLTree *t)
Returns the height of an AVL tree.
int avl_exists(AVLTree *t, Type c)
Checks if a value exists in an AVL tree.
AVLTree * avl_insert(AVLTree *t, Type c)
Inserts a value into an AVL tree.
void avl_posfix(AVLTree *t)
Prints the elements of an AVL tree in post-order traversal.
void avl_print(AVLTree *t)
Prints the elements of an AVL tree in in-order traversal.
AVLTree * avl_search(AVLTree *t, Type c)
Searches for a value in an AVL tree.
AVLTree * avl_create_node(Type value)
Creates a new AVL tree node.
void avl_prefix(AVLTree *t)
Prints the elements of an AVL tree in pre-order traversal.
#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