알고리즘(버블정렬, 퀵정렬, 쉬트라센)
페이지 정보
작성일 19-06-19 09:37
본문
Download : 알고리즘(버블정렬, 퀵정렬, 쉬트라센).hwp
설명
_hwp_01.gif)
_hwp_02.gif)
_hwp_03.gif)
_hwp_04.gif)
_hwp_05.gif)
_hwp_06.gif)
알고리즘(버블정렬, 퀵정렬, 쉬트라센) , 알고리즘(버블정렬, 퀵정렬, 쉬트라센)기타레포트 , 알고리즘 버블정렬 퀵정렬 쉬트라센
순서
알고리즘,버블정렬,퀵정렬,쉬트라센,기타,레포트
레포트/기타
Download : 알고리즘(버블정렬, 퀵정렬, 쉬트라센).hwp( 99 )
알고리즘(버블정렬, 퀵정렬, 쉬트라센)
bubble sort
#include `stdio.h`
#include `stdlib.h`
#include `time.h`
#define TRUE 1
#define FALSE 0
void swap(int a, int b){
int tmp=a;
a=b;
b=tmp;
}
void bubble_sort(int array){
int i,j;
int isSwaped;
for(i=0; i`999; i++){
isSwaped=FALSE;
for(j=0; j`999-i; j++){
if(array[j]`array[j+1]){
swap(&array[j],&array[j+1]);
isSwaped=TRUE;
}
}
if(isSwapedFALSE) {
break
}
}
for(i=0; i`1000; i++){
printf(`%4dn`,array[i]);
}
}
clock_t start,end;
int main(void){
int array[1000];
clock_t start,end;
srand(time(NULL));
int i;
for(i=0; i`1000; i++){
array[i]=rand()%1000;
}
start = clock();
bubble_sort(array);
end = clock();
printf(`%f`, ((double)end-start)/CLK_TCK);
return 0;
}
각각 배열 값 1000, 5000, 10000개 일 때 처리 시간
quick sort
#include `stdio.h`
#…(drop)
알고리즘(버블정렬, 퀵정렬, 쉬트라센)
다.