A balanced binary tree is a a tree that is explicitly kept balanced.
It has a lookup and insertion complexity of O(log(n)), and an accumulative
complexity of O(n*log(n)). All of them worst case!
I only had a general idea how to implement them, but I was able to find
predefined open-source APIs on the web that could do the job for me:
libavl,
libredblack,
GLib's Balanced Binary Tree.
It turned out to be faster than the sorted array, by about a factor of 2.