const rec = arr => {
if (arr.length < 2) return arr
let L = [];
let R = []
let M = arr[0]
for (let i = 1; i < arr.length; i++) {
arr[i] < M ? L.push(arr[i]) : R.push(arr[i])
}
return rec(L).concat(M,rec(R))
}