Is there an efficient (log n) data structure that allows the following operations:
- Return the smallest element that is greater or equal to a given key
- Exchange this element with a smaller one and rearrange the structure accordingly
The number of elements is known and will not change during lifetime.
You could implement a balanced binary tree like a Red-Black Tree
A Red-Black tree has O(log(n)) time complexity for search, insertion and deletion.
You will have to make some modification to return the smallest element that is greater or equal to a given key. But the basic behavior is provided by this data structure I guess.