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:

  1. support user-defined ordering function
  2. an insert operation (anywhere in the set)
  3. 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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.