Implemented heuristic pruning sort