Transforms heapsort from 4 to 2 spaces