|
Aleph-w 7.10.0
A C++ Library for Data Structures and Algorithms
|
Classes | |
| struct | Way |
| The places that an item passes, in order, when it is sifted. More... | |
Functions | |
| template<typename T , class Compare > | |
| size_t | up_index (DynArray< T > &a, const size_t l, const size_t r, T &x, Compare &cmp, Way< T > &way) noexcept(Aleph::NothrowPredicateWith< Compare &, T &, T & >) |
| Find where an item that enters at the end of a heap goes. | |
| template<typename T , class Compare > | |
| size_t | down_index (DynArray< T > &a, const size_t l, const size_t r, T &x, Compare &cmp, Way< T > &way) noexcept(Aleph::NothrowPredicateWith< Compare &, T &, T & >) |
| Find where an item that enters at the root of a heap goes. | |
| template<typename T > | |
| void | shift (T &first, const Way< T > &way, T &x) |
| Move an item along its way. | |
|
inlinenoexcept |
Find where an item that enters at the root of a heap goes.
The comparisons of sift_down(), which move nothing and do not read the entry l.
| [in] | a | the array of the heap. |
| [in] | l | the index where x enters, the root of the heap [l, r]. |
| [in] | r | the last index of the heap. |
| [in] | x | the item that enters; not constant, as in up_index(). |
| [in] | cmp | the comparison. |
| [out] | way | the children that x passes, in order. |
x goes. | what | the comparison throws; nothing when it is noexcept. |
Definition at line 137 of file tpl_dynArrayHeap.H.
References cmp(), l, Aleph::l_index(), and r.
Referenced by Aleph::DynArrayHeap< T, Compare >::getMin(), and Aleph::sift_down().
|
inline |
Move an item along its way.
Each item of the way takes the place of the one before it, the first one that of first, and x takes the last place.
| [in,out] | first | the place where x enters. |
| [in] | way | the places that x passes, from up_index() or down_index(). |
| [in,out] | x | the item, left moved from. It must not be first nor a place of the way, which lose their items before x is moved. |
Definition at line 184 of file tpl_dynArrayHeap.H.
References Aleph::dynarrayheap_detail::Way< T >::at, k, and Aleph::dynarrayheap_detail::Way< T >::len.
Referenced by Aleph::DynArrayHeap< T, Compare >::enter(), Aleph::DynArrayHeap< T, Compare >::getMin(), Aleph::DynArrayHeap< T, Compare >::insert(), Aleph::DynArrayHeap< T, Compare >::insert_direct(), Aleph::sift_down(), and Aleph::sift_up().
|
inlinenoexcept |
Find where an item that enters at the end of a heap goes.
The comparisons of sift_up(), which move nothing.
| [in] | a | the array of the heap. |
| [in] | l | the first index of the heap. |
| [in] | r | the index where x enters, after the heap [l, r - 1]. |
| [in] | x | the item that enters. It is not constant, as the items of the array are not: the comparison takes both in the same way, the one that the noexcept specification looks at. |
| [in] | cmp | the comparison. |
| [out] | way | the parents that x passes, in order. |
x goes. | what | the comparison throws; nothing when it is noexcept. |
Definition at line 99 of file tpl_dynArrayHeap.H.
References cmp(), l, r, and Aleph::u_index().
Referenced by Aleph::DynArrayHeap< T, Compare >::enter(), Aleph::DynArrayHeap< T, Compare >::insert(), Aleph::DynArrayHeap< T, Compare >::insert_direct(), and Aleph::sift_up().