This section describes the API to generic heap with O(log(n)) access.
More...
|
xbt_heap_t | xbt_heap_new (int init_size, void_f_pvoid_t const free_func) |
| Creates a new heap. More...
|
|
void | xbt_heap_free (xbt_heap_t H) |
| kilkil a heap and its content More...
|
|
int | xbt_heap_size (xbt_heap_t H) |
| returns the number of elements in the heap More...
|
|
void | xbt_heap_push (xbt_heap_t H, void *content, double key) |
| Add an element into the heap. More...
|
|
void * | xbt_heap_pop (xbt_heap_t H) |
| Extracts from the heap and returns the element with the smallest key. More...
|
|
void | xbt_heap_rm_elm (xbt_heap_t H, void *content, double key) |
| Remove an arbitrary element from the heap. More...
|
|
double | xbt_heap_maxkey (xbt_heap_t H) |
| returns the smallest key in the heap (heap unchanged) More...
|
|
void * | xbt_heap_maxcontent (xbt_heap_t H) |
| returns the value associated to the smallest key in the heap (heap unchanged) More...
|
|
void | xbt_heap_set_update_callback (xbt_heap_t H, void(*update_callback)(void *, int)) |
| Set the update callback function. More...
|
|
void * | xbt_heap_remove (xbt_heap_t H, int i) |
| Extracts from the heap and returns the element at position i. More...
|
|
void | xbt_heap_update (xbt_heap_t H, int i, double key) |
| Updates an element of the heap with a new value. More...
|
|
This section describes the API to generic heap with O(log(n)) access.
Creates a new heap.
- Parameters
-
init_size | initial size of the heap |
free_func | function to call on each element when you want to free the whole heap (or NULL if nothing to do). |
Creates a new heap.
kilkil a heap and its content
- Parameters
-
returns the number of elements in the heap
- Parameters
-
H | the heap we're working on |
- Returns
- the number of elements in the heap
Add an element into the heap.
- Parameters
-
H | the heap we're working on |
content | the object you want to add to the heap |
key | the key associated to this object |
The element with the smallest key is automatically moved at the top of the heap.
Extracts from the heap and returns the element with the smallest key.
- Parameters
-
H | the heap we're working on |
- Returns
- the element with the smallest key
Extracts from the heap and returns the element with the smallest key. The element with the next smallest key is automatically moved at the top of the heap.
Remove an arbitrary element from the heap.
- Parameters
-
H | the heap we're working on |
content | the object you want to add to the heap |
key | the key associated to this object |
returns the smallest key in the heap (heap unchanged)
- Parameters
-
H | the heap we're working on |
- Returns
- the smallest key in the heap without modifying the heap.
returns the value associated to the smallest key in the heap (heap unchanged)
- Parameters
-
H | the heap we're working on |
- Returns
- the value associated to the smallest key in the heap without modifying the heap.
Set the update callback function.
- Parameters
-
H | the heap we're working on |
update_callback | function to call on each element to update its index when needed. |
Extracts from the heap and returns the element at position i.
- Parameters
-
H | the heap we're working on |
i | element position |
- Returns
- the element at position i if ok, NULL otherwise
Extracts from the heap and returns the element at position i. The heap is automatically reordered.
Updates an element of the heap with a new value.
- Parameters
-
H | the heap we're working on |
i | element position |
key | new value for the element |
Updates an element of the heap with a new value.