I am mainly looking for a data structure in which requests should occur in O (lg n) time
Use TreeMap . It is supported by a red-black tree , so the access time is O(logN) (my emphasis is on the quote below)
public class TreeMap
extends AbstractMap tools
NavigableMap, Cloneable, Serializable
Implementation of NavigableMap based on Red-Black. The map is sorted in accordance with the natural order of its keys or the comparator, subject to the creation of a map, depending on which constructor is used.
This implementation provides a guaranteed log (n) time value for containsKey, get, put and remove.
Cratylus
source share