merge sort with single swap buffer