Solve "Mousetrap" Google Code Jam problem

This solution is not quite fast enough to solve the large-input problem
set in eight minutes on my 5-year-old workstation.
Speed up soln for "Mousetrap" Google Code Jam problem

This patch replaces the node-based binary tree with one based on heaps,
leading to a 20X speed-up.  The heaps are built over Python array values
containing unsigned longs, which are much more compact than lists (which
are heterogeneous and thus must have tagged values) or the original
node-based tree implementation.

Also the algorithms for assigning a card to an index and for finding
the card at an index have been made iterative, instead of recursive.