non-destructive sorting with adaptive-merge