Hi,
is there a data structure, which stores its elements uniquely (for a given compare-Functor) but answers queries for the highest element in that data structure with respect to another compare-Function ?
For Example: I have a class with two properties :
1) the size
2) the value
I'd like to have a data structure which stores all elements uniquely regarding its size but answers queries for the element with the highest value.
Using std::set with a compare functor for the sizes gives me uniqueness but queries for the highest value will have linear runtime...
Is there a better way?
(I'll 'add elements then ask for the highest value' and keep iterating this until a certain termination point is reached)
Any information would be appreciated (papers etc)