39int keys [] = { 36, 32, 4, 12, 52, 59, 2, 2, 26, 1 };
48# define LLINK(i, n) (2*i)
49# define RLINK(i, n) (2*i + 1)
96 cerr <<
"Error: n must be a positive integer." <<
endl;
109 unsigned int i,
value;
111 for (i = 0; i < n; i++)
115 cout <<
value <<
" ";
133 for (i = 1; i <= heap.
size(); i++)
134 cout << heap[i] <<
" ";
138 for (i = 0; i < n; i++)
141 cout <<
value <<
" ";
148 int *
array1 =
new int [n];
150 int *
array2 =
new int [n];
152 for (
int i = 0; i < n; i++)
159 for (
int i = 0; i < n; i++)
168 for (
int i = 0; i < n; i++)
size_t size_t int32_t value
Fixed-capacity binary heap backed by a raw array.
T & insert(const T &key)
Insert an element into the heap.
T getMin()
Remove the smallest element in the heap and return a copy of its value.
constexpr size_t size() const noexcept
Return the number of elements currently stored.
size_t blossom_maximum_cardinality_matching(const GT &g, DynDlist< typename GT::Arc * > &matching, SA sa=SA())
Alias of compute_maximum_cardinality_general_matching().
Main namespace for Aleph-w library functions.
void heapsort(T *array, const size_t n, const Compare &cmp=Compare())
Sort an array using the heapsort algorithm.
void faster_heapsort(T *array, const size_t n, const Compare &cmp=Compare())
Optimized version of heapsort.
Fixed-capacity binary heap and heapsort algorithms.