Transcript
-
99 -- 2010.10
-
2~4()24 / 06() (12) (2) (14)(02)
-
99
-
(1~2)
1. 2.24 1. 2.3. 4.461. 2.8141. 2.281. 2.06
-
(2)
1. 2.610 1. 2.3.8121.2. 3.4.5.10121.2.1012
-
1. 2.
-
1. 1-1 1-2 1-3 1-4 1-5 2. 2-1 2-2 2-3 2-4
-
1.(Sorting)2. VS 3. VS
1.2. VS
-
(Sorting)()
-
VS
-
(Stable Sort)88(88)8888 8 6 9 876 7 8 896 7 8 89
-
VS (Time complexity) 1.(Best Case)(Worst Case) (Average Case) 2. () 3. ()(Space complexity) 1. 2. 3.
-
1. 22.() 26,5,37,1,611,5,26,37,61 3.()23,36,5,14,9()()
- ()void Bubble_Sort(int n, int *Data) { /* NData[0].Data[n-1] */ int i, j, temp; for (i=0;i
-
1. 1. 2.O(n2) 3. 4. 2.(26,5,37,1,61)3.()33,17,6,24,9()
- ()void Select_Sort(int n, int *Data){ /* NData[0]...Data[n-1] */ int i,j,k,temp; for (i=0;i
- 1. nR1R2R3Rnk1k2k3kn (1)K (2)KiKi>K (3)KjKj
-
2.
- () void q_sort(int *data,int m,int n){ int k,temp,i,j; /* */ if(m
-
1.(Search) 2. VS 3. VS 1.()2.()3.()1.2.
-
VS 1. 2.B-tree VS 1. 2.
-
1. 2. 3. (n+1)/2 1. n O(n) 2.
- ()int search(int *data, int n, int key) { /* */ int i; for(i=0; i
-
() 1. [log2n]+1O(log2n) 2. ()()
-
2358911121618 11(1)9
(2)119()12
(3)1112()11
(4)11=11
- 11()int binary(int *k, int n, int key){ int u, l, m; u=n; l=0; while(u>=l) { /**/ m=(u+l)/2; if(k[m]==key) return m; else if(k[m]
-
12 1. (1) (2)1n() (3)O(n)2. (1) (2)1(log2n)+1 (3)O(log2n)O(n)
-
2
-
vs
****