I am looking for a simple ordered set library (function, code sample) in C (NOT in C++). It should be based on some balanced tree or similar O(log(n))-based algorithm, hashes aren't okay.
The required operations what it needs to have:
- support user-defined ordering function
- an insert operation (anywhere in the set)
- pop-ping the minimal element.
The solution isn't okay if the tree which it uses isn't balanced.
It doesn't have to be a whole library, a copy-pastable code sample would be also enough. It is a big advantage if it is tested and surely working code.