Implementation completed with red-black tree.