1.
다음 C 언어 함수에 의해 구현된 정렬 방식은?
void whatsort(int a[ ], int size)
{
int i, j, temp;
for (i = (size-1); i > 0; i--) {
for (j = 1; j <= i; j++) {
if (a[j-1] > a[j]) {
temp = a[j-1];
a[j-1] = a[j];
a[j] = temp;
}
}
}
}- ①삽입 정렬(insertion sort)
- ②선택 정렬(selection sort)
- ③힙 정렬(heap sort)
- ④버블 정렬(bubble sort)
정답 보기
정답 ④ · 해설 보기




