인프런 커뮤니티 질문&답변
이것도 버블 정렬이 맞을까요,,?
작성
·
180
0
function bubbleSort([length, numbers]) {
const nums = [...numbers];
for (let idx = 1; idx < length; idx++) {
for (let jdx = idx; jdx > 0; jdx--) {
if (nums[jdx] < nums[jdx-1])
[nums[jdx-1], nums[jdx]] = [nums[jdx], nums[jdx-1]]
}
}
return nums;
}





