
-
1
-
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
-
35
-
36
-
37
-
38
-
39
-
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
-
48
-
49
-
50


목차
소스코드 포함
1. 프로그램 디자인
2. 주요 소스 코드 설명
3. 알고리즘 분석
4. 실행화면
1. 프로그램 디자인
2. 주요 소스 코드 설명
3. 알고리즘 분석
4. 실행화면
본문내용
보고서 일부서 발췌
1) bubble sort
#define SWAP(x, y, t) ( (t)=(x), (x)=(y), (y)=(t) )
void bubbleSort(int list[], int n)
{
int i, j, temp;
for(i=n-1; i>0; i--){
for(j=0; j /* 앞뒤의레코드를비교한후교체*/
if(list[j]>list[j+1])
SWAP(list[j], list[j+1], temp);
}
}
2) insertion sort
void insertionSort(int list[], int n)
{
int i, j;
int key;
for(i=1; i
key = list[i];
for(j=i-1; j>=0 && (list[j]>key) ; j--) //(list[j]>key): ascending order
list[j+1]=list[j];
list[j+1]=key;
}
}
3) heap sort
#define SWAP(x, y, t) ( (t)=(x), (x)=(y), (y)=(t) )
int heap[100000+1];
void adjust(int heap[], int root, int n)
{
int child, temp;
temp = heap[root]; // 루트값저장
child = 2*root; // 왼쪽자식노드
while(child <= n){ // 마지막노드까지반복
if(child
child++;
if(temp>heap[child]) // 부모노드와자식노드비교
.......
1) bubble sort
#define SWAP(x, y, t) ( (t)=(x), (x)=(y), (y)=(t) )
void bubbleSort(int list[], int n)
{
int i, j, temp;
for(i=n-1; i>0; i--){
for(j=0; j /* 앞뒤의레코드를비교한후교체*/
if(list[j]>list[j+1])
SWAP(list[j], list[j+1], temp);
}
}
2) insertion sort
void insertionSort(int list[], int n)
{
int i, j;
int key;
for(i=1; i
for(j=i-1; j>=0 && (list[j]>key) ; j--) //(list[j]>key): ascending order
list[j+1]=list[j];
list[j+1]=key;
}
}
3) heap sort
#define SWAP(x, y, t) ( (t)=(x), (x)=(y), (y)=(t) )
int heap[100000+1];
void adjust(int heap[], int root, int n)
{
int child, temp;
temp = heap[root]; // 루트값저장
child = 2*root; // 왼쪽자식노드
while(child <= n){ // 마지막노드까지반복
if(child
if(temp>heap[child]) // 부모노드와자식노드비교
.......
소개글