while循环的目的是“合并+排序”数组,为什么不用 es6写法?
来源:11-5 JavaScript 实现:归并排序
			我是传奇1122
2021-05-28
      if (orderLeft.length && orderRight.length) {
        res.push(
          orderLeft[0] < orderRight[0] ? orderLeft.shift() : orderRight.shift()
        );
      } else if (orderLeft.length) {
        res.push(orderLeft.shift());
      } else if (orderRight.length) {
        res.push(orderRight.shift());
      }
    }
替换成:
res = res.concat(orderLeft, orderRight).sort((a, b) => a - b);
写回答
	1回答
- 
				
						lewis
2021-05-28
因为算法考试是不允许用现成的API的
112021-05-29 
相似问题