[자료구조]정렬 sorting 모음
- 최초 등록일
- 2003.11.06
- 최종 저작일
- 2003.11
- 9페이지/ 압축파일
- 가격 1,500원
소개글
버블 정렬, 퀵정렬, 삽입정렬, 합병정렬, 등등
소팅(sorting ) 프로그램 모음
컴파일 실행환경
<압축파일 목록>
실습12_정렬.dsp
실습12_정렬.dsw
실습12_정렬.opt
실습12_정렬.plg
bubblesort.c
heapsort.c
insertsort.c
mergesort.c
quicksort.c
selectionsort.c
sort.h
sort_main.c
util.c
본문내용
(heapsort.c)
#include "sort.h"
void adjust(int list[], int root, int n)
// root부터 시작: 부분트리의 root임- 1이 아닐 수도 있슴, n=마지막 노드
{
int childindex, rootkey;
int temp = list[root]; //교환에 대비하여 임시 저장
rootkey = list[root];
childindex = 2 * root; //왼쪽 자식을 지정
while (childindex <= n) { //자식이 존재함을 의미- n=끝 노드임에 유의
//if ((childindex < n) && (list[childindex] < list[childindex + 1]) )//오름차순
if ((childindex < n) && (list[childindex] > list[childindex + 1]) )//내림차순
childindex++; //자식중 더 큰 키 값을 가진 자식 선택
//if (rootkey > list[childindex]) //오름차순
if (rootkey < list[childindex]) //내림차순
break; //root가 더 크면 while loop 종료
압축파일 내 파일목록
실습12_정렬.dsp
실습12_정렬.dsw
실습12_정렬.opt
실습12_정렬.plg
bubblesort.c
heapsort.c
insertsort.c
mergesort.c
quicksort.c
selectionsort.c
sort.h
sort_main.c
util.c
참고 자료
없음