console.log(666)
function merge( A, m, B, n ) {
let p = m + n - 1
let pA = m - 1
let pB = n - 1
while(pA >=0 && pB >=0){
if(A[pA] >= B[pB]){
A[p--] = A[pA--]
}else{
A[p--] = B[pB--]
}
}
while(pB >=0 ){
A[p--] = B[pB--]
}
return A
}
function mergeList(arrs){
// 分为两半,然后对这两半进行mergeList,变为两个数组,最后调用merge函数
if(arrs.length === 0) return []
if(arrs.length === 1) return arrs[0].sort((a, b) => a - b)
const len = arrs.length
const mid = Math.ceil(len / 2)
const left = arrs.slice(0, mid)
const right = arrs.slice(mid, len)
const newA = mergeList(left)
const newB = mergeList(right)
return merge(newA.concat(new Array(newB.length).fill(0)), newA.length, newB, newB.length)
}
console.log((mergeList([
[1,2,3],
[2,5,6],
[9,7,5]
])))
console