알고리즘 - 합병정렬, 퀵정렬
본 자료는 2페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
해당 자료는 2페이지 까지만 미리보기를 제공합니다.
2페이지 이후부터 다운로드 후 확인할 수 있습니다.

소개글

알고리즘 - 합병정렬, 퀵정렬에 대한 보고서 자료입니다.

목차

1. 프로그램 소스
합병정렬(링크를 사용하는) : lec4-5, 퀵정렬(순환버전) : lec5-1 사용

CompareMeasure.java
MergeSortClass.java
QuickSortClass.java


2. 수행 결과

본문내용

e elements a[p],..., a[q] which reside in
// the global array a[1:n] into ascending order; a[n+1]
// is considered to be defined and must be >= all the
// elements in a[1:n].
{
if (p < q) { // If there are more than one element
// divide P into two subproblems.
int j = Partition(a, p, q + 1);
// j is the position of the
// partitioning element.
// Solve the subproblems.
QuickSort(p, j - 1);
QuickSort(j + 1, q);
// There is no need for combining solutions.
}
}
int Partition(int a[], int m, int p)
// Within a[m], a[m+1],..., a[p-1] the elements
// are rearranged in such a manner that if
// initially t==a[m], then after completion
// a[q]==t for some q between m and p-1, a[k]<=t
// for m<=k=t for q {
// int v=a[m]; int i=m, j=p;
int v = a[m];
int i = m, j = p;
do {
do
i++;
while (a[i] < v);
do
j--;
while (a[j] > v);
if (i < j)
Interchange(a, i, j);
} while (i < j);
a[m] = a[j];
a[j] = v;
return (j);
}
void Interchange(int a[], int i, int j) {
int temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
2. 수행 결과
<성능측정표>
인자 수
1,000
5,000
10,000
20,000
50,000
100,000
합병정렬
1.587
1.933
1.608
3.397
9.460
21.620
퀵 정렬
0.564
1.921
1.238
2.579
7.031
14.160
<성능 측정에 따른 그래프>
  • 가격1,500
  • 페이지수6페이지
  • 등록일2015.04.27
  • 저작시기2015.4
  • 파일형식한글(hwp)
  • 자료번호#965216
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니