|
cdcontainers
0.1.1
Library of data containers and collections for C programming language.
|
The cdc_binomial_heap is a struct and functions that provide a binomial heap. More...
#include <cdcontainers/common.h>#include <cdcontainers/status.h>#include <assert.h>#include <stdarg.h>#include <stdbool.h>#include <stdlib.h>Go to the source code of this file.
Data Structures | |
| struct | cdc_binomial_heap_node |
| The cdc_binomial_heap_node struct. More... | |
| struct | cdc_binomial_heap |
| The cdc_binomial_heap struct. More... | |
| struct | cdc_binomial_heap_iter |
| The cdc_binomial_heap_iter struct. More... | |
Functions | |
| enum cdc_stat | cdc_binomial_heap_ctor (struct cdc_binomial_heap **h, struct cdc_data_info *info) |
| Constructs an empty binomial heap. More... | |
| enum cdc_stat | cdc_binomial_heap_ctorl (struct cdc_binomial_heap **h, struct cdc_data_info *info,...) |
| Constructs a binomial heap, initialized by an arbitrary number of pointers. The last item must be NULL. More... | |
| enum cdc_stat | cdc_binomial_heap_ctorv (struct cdc_binomial_heap **h, struct cdc_data_info *info, va_list args) |
| Constructs a binomial heap, initialized by args. The last item must be NULL. More... | |
| void | cdc_binomial_heap_dtor (struct cdc_binomial_heap *h) |
| Destroys the binomial heap. More... | |
| static void * | cdc_binomial_heap_top (struct cdc_binomial_heap *h) |
| Returns a pointer to the binomial heap's top item. This function assumes that the binomial heap isn't empty. More... | |
| static size_t | cdc_binomial_heap_size (struct cdc_binomial_heap *h) |
| Returns the number of items in the binomial heap. More... | |
| static bool | cdc_binomial_heap_empty (struct cdc_binomial_heap *h) |
| Returns true if the binomial heap has size 0; otherwise returns false. More... | |
| enum cdc_stat | cdc_binomial_heap_extract_top (struct cdc_binomial_heap *h) |
| Extracts the top item from the binomial heap. This function assumes that the binomial heap isn't empty. More... | |
| enum cdc_stat | cdc_binomial_heap_riinsert (struct cdc_binomial_heap *h, void *key, struct cdc_binomial_heap_iter *ret) |
| Inserts element key to the binomial heap. Write an iterator pointing to a new element in the ret. More... | |
| static enum cdc_stat | cdc_binomial_heap_insert (struct cdc_binomial_heap *h, void *key) |
| Inserts element key to the binomial heap. More... | |
| void | cdc_binomial_heap_change_key (struct cdc_binomial_heap *h, struct cdc_binomial_heap_iter *pos, void *key) |
| Changes the item key on the pos position in the binomial heap. More... | |
| void | cdc_binomial_heap_clear (struct cdc_binomial_heap *h) |
| Removes all the elements from the binomial heap. More... | |
| void | cdc_binomial_heap_swap (struct cdc_binomial_heap *a, struct cdc_binomial_heap *b) |
| Swaps binomial heaps a and b. This operation is very fast and never fails. More... | |
| void | cdc_binomial_heap_merge (struct cdc_binomial_heap *h, struct cdc_binomial_heap *other) |
| Merges two heaps. In the heap h will be the result of the merger, and the heap other will remain empty. More... | |
| bool | cdc_binomial_heap_is_heap (struct cdc_binomial_heap *h) |
| Checks the heap property. More... | |
| static void * | cdc_binomial_heap_iter_data (struct cdc_binomial_heap_iter *it) |
| Returns a pointer to the key of current item. More... | |
| static bool | cdc_binomial_heap_iter_is_eq (struct cdc_binomial_heap_iter *it1, struct cdc_binomial_heap_iter *it2) |
| Returns false if the iterator it1 equal to the iterator it2, otherwise returns false. More... | |
The cdc_binomial_heap is a struct and functions that provide a binomial heap.
| enum cdc_stat cdc_binomial_heap_ctor | ( | struct cdc_binomial_heap ** | h, |
| struct cdc_data_info * | info | ||
| ) |
Constructs an empty binomial heap.
| h | - cdc_binomial_heap |
| info | - cdc_data_info |
| enum cdc_stat cdc_binomial_heap_ctorl | ( | struct cdc_binomial_heap ** | h, |
| struct cdc_data_info * | info, | ||
| ... | |||
| ) |
Constructs a binomial heap, initialized by an arbitrary number of pointers. The last item must be NULL.
| h | - cdc_binomial_heap |
| info | - cdc_data_info |
| enum cdc_stat cdc_binomial_heap_ctorv | ( | struct cdc_binomial_heap ** | h, |
| struct cdc_data_info * | info, | ||
| va_list | args | ||
| ) |
Constructs a binomial heap, initialized by args. The last item must be NULL.
| h | - cdc_binomial_heap |
| info | - cdc_data_info |
| void cdc_binomial_heap_dtor | ( | struct cdc_binomial_heap * | h | ) |
Destroys the binomial heap.
| h | - cdc_binomial_heap |
|
inlinestatic |
Returns a pointer to the binomial heap's top item. This function assumes that the binomial heap isn't empty.
| h | - cdc_binomial_heap |
|
inlinestatic |
|
inlinestatic |
Returns true if the binomial heap has size 0; otherwise returns false.
| h | - cdc_binomial_heap |
| enum cdc_stat cdc_binomial_heap_extract_top | ( | struct cdc_binomial_heap * | h | ) |
Extracts the top item from the binomial heap. This function assumes that the binomial heap isn't empty.
| h | - cdc_binomial_heap |
| enum cdc_stat cdc_binomial_heap_riinsert | ( | struct cdc_binomial_heap * | h, |
| void * | key, | ||
| struct cdc_binomial_heap_iter * | ret | ||
| ) |
Inserts element key to the binomial heap. Write an iterator pointing to a new element in the ret.
| h | - cdc_binomial_heap |
| key | |
| ret | - pointer to iterator where an iterator will be written indicating the inserted element |
|
inlinestatic |
Inserts element key to the binomial heap.
| h | - cdc_binomial_heap |
| key |
| void cdc_binomial_heap_change_key | ( | struct cdc_binomial_heap * | h, |
| struct cdc_binomial_heap_iter * | pos, | ||
| void * | key | ||
| ) |
Changes the item key on the pos position in the binomial heap.
| h | - cdc_binomial_heap |
| pos | - iterator that indicates the item with key that you want to change |
| key |
| void cdc_binomial_heap_clear | ( | struct cdc_binomial_heap * | h | ) |
Removes all the elements from the binomial heap.
| h | - cdc_binomial_heap |
| void cdc_binomial_heap_swap | ( | struct cdc_binomial_heap * | a, |
| struct cdc_binomial_heap * | b | ||
| ) |
Swaps binomial heaps a and b. This operation is very fast and never fails.
| a | - cdc_binomial_heap |
| b | - cdc_binomial_heap |
| void cdc_binomial_heap_merge | ( | struct cdc_binomial_heap * | h, |
| struct cdc_binomial_heap * | other | ||
| ) |
Merges two heaps. In the heap h will be the result of the merger, and the heap other will remain empty.
| h | - cdc_binomial_heap |
| other | - cdc_binomial_heap |
| bool cdc_binomial_heap_is_heap | ( | struct cdc_binomial_heap * | h | ) |
|
inlinestatic |
Returns a pointer to the key of current item.
|
inlinestatic |
Returns false if the iterator it1 equal to the iterator it2, otherwise returns false.
1.8.13