|
Re: Challenging Programming Problem - "Pinball Ranking"
Apart from a balanced binary tree, you could probably use a red-black tree, radix tree or skip list. I think a radix tree might be easiest...
The STL has built in red-black tree implementations for sets and maps, but unfortunately there's no fast function giving the number of elements (<x) in a multiset.
The Java TreeSet class has a tailSet function which would work perfectly, except that there is no time guarantee, and I don't know whether Java supports multisets.
|