Added random testing of the heap invariant. Fixed corner case of removing the last element in the heap vector.