Use tabulate to implement the per-pass merge path search.