upperPart
(min heap) and lowerPart
(max heap).add(name, score)
is called:
a. If upperPart
is not empty, compare the new location with the top of upperPart
.
b. If the new location is better, pop the top of upperPart
, push it to lowerPart
, and insert the new location into upperPart
.
c. If the new location is not better, push it to lowerPart
.get()
is called:
a. Pop the top of lowerPart
and push it to upperPart
.
b. Return the name of the new top of upperPart
.