Interative Mergesort
in-place sort groups of 4;
merge sorted groups of 4 in A into sorted groups of 8 in B;
merge sorted groups of 8 in B into sorted groups of 16 in A;
merge sorted groups of 16 in A into sorted groups of 32 in B;
in the end if the sorted array is B then copy it to A;
Sort small groups in-place.
Alternate the roles of A and B as the source of the merging passes.
Copy B to A if needed at the end.