ATLAS Offline Software
Loading...
Searching...
No Matches
binary-heap.h
Go to the documentation of this file.
1/*
2
3Copyright (c) 2005-2008, Simon Howard
4
5Permission to use, copy, modify, and/or distribute this software
6for any purpose with or without fee is hereby granted, provided
7that the above copyright notice and this permission notice appear
8in all copies.
9
10THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
14CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
15LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
16NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
17CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
19 */
20
37
38#ifndef ALGORITHM_BINARY_HEAP_H
39#define ALGORITHM_BINARY_HEAP_H
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
52
62
66
67typedef void *BinaryHeapValue;
68
72
73#define BINARY_HEAP_NULL ((void *) 0)
74
84
86 BinaryHeapValue value2);
87
91
92typedef struct _BinaryHeap BinaryHeap;
93
103
105 BinaryHeapCompareFunc compare_func);
106
112
114
124
126
134
136
143
145
146#ifdef __cplusplus
147}
148#endif
149
150#endif /* #ifndef ALGORITHM_BINARY_HEAP_H */
151
void * BinaryHeapValue
A value stored in a BinaryHeap.
Definition binary-heap.h:67
int(* BinaryHeapCompareFunc)(BinaryHeapValue value1, BinaryHeapValue value2)
Type of function used to compare values in a binary heap.
Definition binary-heap.h:85
struct _BinaryHeap BinaryHeap
A binary heap data structure.
Definition binary-heap.h:92
int binary_heap_num_entries(BinaryHeap *heap)
Find the number of values stored in a binary heap.
int binary_heap_insert(BinaryHeap *heap, BinaryHeapValue value)
Insert a value into a binary heap.
BinaryHeap * binary_heap_new(BinaryHeapType heap_type, BinaryHeapCompareFunc compare_func)
Create a new BinaryHeap.
void binary_heap_free(BinaryHeap *heap)
Destroy a binary heap.
BinaryHeapValue binary_heap_pop(BinaryHeap *heap)
Remove the first value from a binary heap.
BinaryHeapType
Heap type.
Definition binary-heap.h:53
@ BINARY_HEAP_TYPE_MAX
A maximum heap.
Definition binary-heap.h:60
@ BINARY_HEAP_TYPE_MIN
A minimum heap.
Definition binary-heap.h:56