Bubble sort · 버블 정렬
Bubble sort
Sort an array into ascending order in place using bubble sort: walk through the array comparing each pair of neighbours and swapping them if they're in the wrong order. After each full pass the largest remaining value has "bubbled" to the end, so repeat until everything is sorted.
버블 정렬
버블 정렬(bubble sort)을 사용하여 배열을 제자리에서 오름차순으로 정렬합니다: 배열 전체를 순회하며 각 이웃 쌍을 비교하고 순서가 잘못되면交换합니다. 완전한 pass마다 남은 가장 큰 값이 "버블"되어 맨 끝으로 이동하므로, 모든 것이 정렬될 때까지 반복합니다.
Complete void bubble_sort(int *a, int n) to sort the n elements into ascending order, in place. Repeatedly pass through the array swapping any out-of-order neighbours. · void bubble_sort(int *a, int n)를 완성하여 n개 요소를 제자리에서 오름차순으로 정렬하십시오. 배열을 반복적으로 통과하면서 순서가 맞지 않는 인접한 요소를教务(바꿔)하십시오.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.