Fix a bug in the ugly line in heap. Add pqueue.

pqueue is (obviously) a simple wrapper around the heap, but it includes some
more interesting test code (random cases with dicts)

heap bug was related to my misunderstanding of the sorted 'cmp' param
(which is apparently deprecated, anyways).