|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Classes | |
| struct | From_One |
| The items of an array, numbered from 1. More... | |
Functions | |
| template<class A > | |
| constexpr void | undo_sift_up (A ptr, size_t i, const size_t r) |
| Take back down an item that sift_up() took up. | |
| template<class A > | |
| constexpr void | undo_sift_down (A ptr, size_t i, const size_t l) |
| Take back up an item that sift_down() took down. | |
| template<class A , class Compare > | |
| constexpr size_t | sift_down (A ptr, const size_t l, const size_t r, Compare &cmp) |
Move the element at position l downwards to its place. | |
| template<class A , class Compare > | |
| constexpr decltype(auto) | sift_up (A ptr, const size_t l, const size_t r, Compare &cmp) |
Move the element at position r upwards to its place. | |
|
inlineconstexpr |
Move the element at position l downwards to its place.
What sift_down() does, with its result.
| A | the items numbered from 1: a pointer to the entry 0 of the array, or a From_One. |
| [in,out] | ptr | the items of the heap. |
| [in] | l | left boundary (inclusive) / starting index. |
| [in] | r | right boundary (inclusive). |
| [in] | cmp | comparison criteria. |
l, or one below it. | what | the comparison throws, with the range as it was if the exchange of two items does not throw. |
Definition at line 160 of file tpl_arrayHeap.H.
References Aleph::and, cmp(), l, Aleph::l_index(), r, and undo_sift_down().
Referenced by Aleph::faster_heapsort(), Aleph::heapsort(), Aleph::sift_down(), and Aleph::sift_down_up().
|
inlineconstexpr |
Move the element at position r upwards to its place.
What sift_up() does, on the items of any array numbered from 1.
| A | the items numbered from 1: a pointer to the entry 0 of the array, or a From_One. |
| [in,out] | ptr | the items of the heap. |
| [in] | l | left boundary (inclusive). |
| [in] | r | right boundary (inclusive) / starting index. |
| [in] | cmp | comparison criteria. |
| what | the comparison throws, with the range as it was if the exchange of two items does not throw. |
Definition at line 209 of file tpl_arrayHeap.H.
References Aleph::and, cmp(), l, r, Aleph::u_index(), and undo_sift_up().
Referenced by Aleph::heapsort(), and Aleph::sift_up().
|
inlineconstexpr |
Take back up an item that sift_down() took down.
| A | the items numbered from 1: a pointer to the entry 0 of the array, or a From_One. |
| [in,out] | ptr | the items of the heap. |
| [in] | i | the entry where the item is. |
| [in] | l | the entry where it was: i, or one above it. |
Definition at line 138 of file tpl_arrayHeap.H.
References l, and Aleph::u_index().
Referenced by sift_down(), and Aleph::sift_down_up().
|
inlineconstexpr |
Take back down an item that sift_up() took up.
The item is exchanged with each item of its way, which the indexes give: the ancestors of an entry are its index without its last bits.
| A | the items numbered from 1: a pointer to the entry 0 of the array, or a From_One. |
| [in,out] | ptr | the items of the heap. |
| [in] | i | the entry where the item is. |
| [in] | r | the entry where it was: i, or one below it. |
Definition at line 118 of file tpl_arrayHeap.H.
References r.
Referenced by sift_up().