I wrote this at a time when I was tracking down a bug in backshift. I was suspecting that perhaps treap.py was having a mysterious problem, and realizing that treaps weren't really helping performance because of the large memory requirements of the things Stored in the treap, resulting in a mere 50-element-treap, wrote this module that fakes a treap using a dict, min, max, sort and reverse.