Replace the red-black tree with a binary heap