Mescal
Loading...
Searching...
No Matches
type_abr.h
Go to the documentation of this file.
1
10
11#ifndef ABR_H
12#define ABR_H
13
14
15 /* ___ ___ */
16 /* / \ \ / / | ___ */
17 /* / _ \ \ / /| | / __| */
18 /* / ___ \ V / | |___\__ \ */
19 /* /_/ \_\_/ |_____|___/ */
20
21#include <stdbool.h>
22#include <stdlib.h>
23#include <stdarg.h>
24#include <stdio.h>
25#include "type_basic.h"
26#include "type_dequeue.h"
27#include "alloc.h"
28
29/*******************/
30/* Generic version */
31/*******************/
32
33
38typedef struct avlnode {
39 int height;
40 void* value;
41 struct avlnode* left;
42 struct avlnode* right;
44
45
46
55avlnode* avl_search(void*,
56 avlnode*,
57 int (*f)(void*, void*)
58);
59
67avlnode* avl_insert(void*,
68 avlnode*,
69 int (*f)(void*, void*),
70 void (*d)(void*)
71);
72
81);
82
83
93 void (*f)(void*)
94);
95
97);
98
99
100/***********************************************/
101/* Light version specific to unsigned integers */
102/***********************************************/
103
104
115
126);
127
137);
138
147);
148
155 dequeue*
156);
157
158#endif
Macros and functions to help memory allocation.
Type used to represent a single node in a generic AVL.
Definition type_abr.h:38
int height
Height of the AVL rooted in this node.
Definition type_abr.h:39
struct avlnode * left
Pointer to left child (NULL if no left child).
Definition type_abr.h:41
struct avlnode * right
Pointer to right child (NULL if no right child).
Definition type_abr.h:42
void * value
Value of the node.
Definition type_abr.h:40
Type used to represent a dequeue of unsigned integers.
Definition type_dequeue.h:26
Type used to represent a single node in a light AVL.
Definition type_abr.h:109
int height
Height of the AVL rooted in this node.
Definition type_abr.h:110
struct uint_avlnode * left
Pointer to left child (NULL if no left child).
Definition type_abr.h:112
uint value
Value of the node.
Definition type_abr.h:111
struct uint_avlnode * right
Pointer to right child (NULL if no right child).
Definition type_abr.h:113
void uint_avl_to_dequeue(uint_avlnode *, dequeue *)
Extracts all values in a light AVL tree and stores on the right of the input dequeue in increasing or...
Definition type_abr.c:385
int getsize_avl(avlnode *)
Computes the size of a generic AVL tree.
Definition type_abr.c:157
uint_avlnode * uint_avl_insert(uint, uint_avlnode *)
Insertion of a value inside a light AVL tree.
Definition type_abr.c:347
avlnode * avl_search(void *, avlnode *, int(*f)(void *, void *))
Searches for a value inside an generic AVL tree.
Definition type_abr.c:108
void avl_free_strong(avlnode *, void(*f)(void *))
Release of a generic AVL tree.
Definition type_abr.c:204
int avl_height(avlnode *)
Definition type_abr.c:216
avlnode * avl_insert(void *, avlnode *, int(*f)(void *, void *), void(*d)(void *))
Insertion of a value inside a generic AVL tree.
Definition type_abr.c:126
int getsize_uint_avl(uint_avlnode *)
Computes the size of a light AVL tree.
Definition type_abr.c:375
uint_avlnode * uint_avl_search(uint, uint_avlnode *)
Searches for a value inside an light AVL tree.
Definition type_abr.c:329
Basic types.
Implementation of dequeues of unsigned integers.