Graphviz  2.41.20170921.2350
Macros | Functions
BinaryHeap.c File Reference
#include "BinaryHeap.h"
Include dependency graph for BinaryHeap.c:

Go to the source code of this file.

Macros

#define ParentPos(pos)   (pos - 1)/2
 
#define ChildrenPos1(pos)   (2*(pos)+1)
 
#define ChildrenPos2(pos)   (2*(pos)+2)
 

Functions

BinaryHeap BinaryHeap_new (int(*cmp)(void *item1, void *item2))
 
void BinaryHeap_delete (BinaryHeap h, void(*del)(void *item))
 
int BinaryHeap_insert (BinaryHeap h, void *item)
 
void * BinaryHeap_get_min (BinaryHeap h)
 
void * BinaryHeap_extract_min (BinaryHeap h)
 
void * BinaryHeap_extract_item (BinaryHeap h, int id)
 
int BinaryHeap_reset (BinaryHeap h, int id, void *item)
 
void * BinaryHeap_get_item (BinaryHeap h, int id)
 
void BinaryHeap_sanity_check (BinaryHeap h)
 
void BinaryHeap_print (BinaryHeap h, void(*pnt)(void *))
 

Macro Definition Documentation

#define ChildrenPos1 (   pos)    (2*(pos)+1)

Definition at line 65 of file BinaryHeap.c.

#define ChildrenPos2 (   pos)    (2*(pos)+2)

Definition at line 66 of file BinaryHeap.c.

#define ParentPos (   pos)    (pos - 1)/2

Definition at line 64 of file BinaryHeap.c.

Referenced by BinaryHeap_sanity_check().

Function Documentation

void BinaryHeap_delete ( BinaryHeap  h,
void(*)(void *item del 
)
void* BinaryHeap_extract_item ( BinaryHeap  h,
int  id 
)
void* BinaryHeap_extract_min ( BinaryHeap  h)
void* BinaryHeap_get_item ( BinaryHeap  h,
int  id 
)
void* BinaryHeap_get_min ( BinaryHeap  h)

Definition at line 164 of file BinaryHeap.c.

References BinaryHeap_struct::heap.

int BinaryHeap_insert ( BinaryHeap  h,
void *  item 
)
BinaryHeap BinaryHeap_new ( int(*)(void *item1, void *item2)  cmp)
void BinaryHeap_print ( BinaryHeap  h,
void(*)(void *)  pnt 
)
int BinaryHeap_reset ( BinaryHeap  h,
int  id,
void *  item 
)
void BinaryHeap_sanity_check ( BinaryHeap  h)