[자료구조] 알고리즘
- 최초 등록일
- 2003.06.09
- 최종 저작일
- 2003.06
- 20페이지/ 압축파일
- 가격 2,000원
소개글
알고리즘 소스에요.
컴파일 실행환경
heapsort.c
bubble.c
ex1.cpp
binsearc.c
insertso.c
pro2.cpp
quicksor.c
selectso.c
seqsearc.c
shellsor.c
본문내용
#include < stdio.h>
#include < stdlib.h>
#include < time.h>
#define TRUE 1
#define FALSE 0
/*
두 개의 매개 변수 x와 n을 입력하는 루틴 bubble
x는 배열 숫자이고, n은 정렬될 요소 숫자를 나타내는 정수 이다.
*/
bubble(int x[], int n)
{
int temp, j, pass;
int switched = TRUE;
for(pass = 0; pass<n-1 && switched == TRUE; pass++) {
switched = FALSE;
for(j = 0; j<n-pass-1; j++)
if (x[j] > x[j+1]) {
switched = TRUE;
temp = x[j];
x[j] = x[j+1];
x[j+1] = temp;
}
}
}
압축파일 내 파일목록
heapsort.c
bubble.c
ex1.cpp
binsearc.c
insertso.c
pro2.cpp
quicksor.c
selectso.c
seqsearc.c
shellsor.c
참고 자료
없음