multi-array sort and multi-array merge