Fastutil has nice class IntAVLTreeSet which has #firstInt()
and #lastInt()
method, that I require.
Unfortunately, AVL Tree is O(log N).
Are there O(1) implementations of this? Is it possible at all?
UPDATE
I want O(1) lookups. Finding margins may be slower.