STXXL
1.4-dev
|
Guarded loser tree, using pointers to the elements instead of copying them into the tree nodes.
This is a base class for the LoserTreePointer<true> and <false> classes.
Guarding is done explicitly through one flag sup per element, inf is not needed due to a better initialization routine. This is a well-performing variant.
Definition at line 492 of file losertree.h.
Classes | |
struct | Loser |
Internal representation of a loser tree player/node. More... | |
Public Types | |
typedef LoserTreeCopyBase < ValueType, Comparator > ::size_type | size_type |
size of counters and array indexes More... | |
typedef LoserTreeCopyBase < ValueType, Comparator > ::source_type | source_type |
type of the source field More... | |
Public Member Functions | |
LoserTreePointerBase (size_type _k, Comparator _comp=std::less< ValueType >()) | |
~LoserTreePointerBase () | |
source_type | get_min_source () |
return the index of the player with the smallest element. More... | |
void | init () |
size_type | init_winner (size_type root) |
void | insert_start (const ValueType &key, source_type source, bool sup) |
void | print (std::ostream &os) |
Protected Attributes | |
Comparator | comp |
the comparator object More... | |
const size_type | ik |
number of nodes More... | |
const size_type | k |
log_2(ik) next greater power of 2 More... | |
Loser * | losers |
array containing loser tree nodes More... | |
typedef LoserTreeCopyBase<ValueType, Comparator>::size_type stxxl::parallel::LoserTreePointerBase< ValueType, Comparator >::size_type |
size of counters and array indexes
Definition at line 497 of file losertree.h.
typedef LoserTreeCopyBase<ValueType, Comparator>::source_type stxxl::parallel::LoserTreePointerBase< ValueType, Comparator >::source_type |
type of the source field
Definition at line 500 of file losertree.h.
|
inline |
Definition at line 524 of file losertree.h.
|
inline |
Definition at line 538 of file losertree.h.
|
inline |
return the index of the player with the smallest element.
Definition at line 550 of file losertree.h.
|
inline |
Definition at line 602 of file losertree.h.
|
inline |
Computes the winner of the competition at player root. Called recursively (starting at 0) to build the initial tree.
root | index of the game to start. |
Definition at line 578 of file losertree.h.
|
inline |
Initializes the player source with the element key.
key | the element to insert |
source | index of the player |
sup | flag that determines whether the value to insert is an explicit supremum sentinel. |
Definition at line 563 of file losertree.h.
|
inline |
Definition at line 543 of file losertree.h.
|
protected |
the comparator object
Definition at line 521 of file losertree.h.
|
protected |
number of nodes
Definition at line 515 of file losertree.h.
|
protected |
log_2(ik) next greater power of 2
Definition at line 517 of file losertree.h.
|
protected |
array containing loser tree nodes
Definition at line 519 of file losertree.h.