I have a set
(key, value) pairs and a large number of subsets of
S. I'm looking for a data structure that would efficiently execute the following operations :
(key, value)pair to
Sand to a collection of subsets.
(key, value)pair from a collection of subsets containing this pair (not all of them).
Return the max value of a subset.
Right now my solution is to have, for every subset, a binary heap coupled with a hash table (so I can access the element I want to delete in constant time).
I wonder if there's a more efficient way to do this that would capitalize on the fact that these subsets have elements in common (so sorting them for every subset sounds like a bit of a waste).