datastructure to keep a linear order

O(log N)