Keeping Trees of Losers rather than Trees of Winners II
Algorithm for updating a selection tree of losers:
T is a pointer to an internal node in the tree of losers
topoftree is a flag indicating if updating has reached the root
T <-- parent of Buffer[s]
topoftree <-- false
repeat if key(Buffer(loser(T))) < key(Buffer[s])
then interchange loser(T) and s
if T = root
then topoftree <-- true
else T <-- parent of node pointed to by T
until topoftree