Data Structures Lerax  v3.0-101-gb1f7
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
avl.h File Reference
#include "binary-tree.h"

Go to the source code of this file.

Macros

#define Type   BINARY_NODE_TYPE
#define AVLT_EMPTY   (AVLTree*) 0

Typedefs

typedef struct BinaryNode AVLTree
 This module define a Abstract Data Type for the structure Binary Search Tree.

Functions

AVLTreeavl_create_node (Type value)
 Creates a new AVL tree node.
AVLTreeavl_create (void)
 Creates an empty AVL tree.
int avl_empty (AVLTree *t)
 Checks if an AVL tree is empty.
int avl_exists (AVLTree *t, Type c)
 Checks if a value exists in an AVL tree.
AVLTreeavl_search (AVLTree *t, Type c)
 Searches for a value in an AVL tree.
void avl_print (AVLTree *t)
 Prints the elements of an AVL tree in in-order traversal.
int avl_height (AVLTree *t)
 Returns the height of an AVL tree.
AVLTreeavl_insert (AVLTree *t, Type c)
 Inserts a value into an AVL tree.
AVLTreeavl_remove (AVLTree *t, Type c)
 Removes a value from an AVL tree.
void avl_free (AVLTree *t)
 Frees the memory allocated for an AVL tree.
void avl_posfix (AVLTree *t)
 Prints the elements of an AVL tree in post-order traversal.
void avl_prefix (AVLTree *t)
 Prints the elements of an AVL tree in pre-order traversal.
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.
int avl_leafs_primes (AVLTree *t)
 Counts the number of leaf nodes in an AVL tree that are prime numbers.
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.
int avl_equals (AVLTree *t1, AVLTree *t2)
 Compares two AVL trees for equality.

Macro Definition Documentation

◆ AVLT_EMPTY

#define AVLT_EMPTY   (AVLTree*) 0

◆ Type

#define Type   BINARY_NODE_TYPE

Typedef Documentation

◆ AVLTree

typedef struct BinaryNode AVLTree

This module define a Abstract Data Type for the structure Binary Search Tree.


    Copyright 2017-2025 Manoel Vilela

    Author: Manoel Vilela
   Contact: manoel_vilela@engineer.com

Organization: UFC


A node in an AVL tree.

Each node contains a value, pointers to its left and right children, and its height.