|
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#define TRUE 1
#define FALSE 0
#define max_heapsize 200
typedef struct heap {
int data[max_heapsize];
int size;
} heap;
int init_heap(heap *);
int insert_heap(heap *,
|
- 페이지 1페이지
- 가격 1,300원
- 등록일 2012.11.13
- 파일종류 기타
- 참고문헌 없음
- 최근 2주 판매 이력 없음
|
|
heapsort (n); //n개의 데이터에 대한 heapsort함수 호출
if(n>=500) //데이터의 크기가 500보다 클때 앞뒤로 30개씩 출력한다.
{
for(i = 1 ; i <= 30 ; i++)
{
if(i % 5 == 0) printf("%10.4f \n", list[i]); //출력할때 줄을 맞추기 위해서
//"%10.4f "를 썼다.
else
{
printf("앞
|
- 페이지 9페이지
- 가격 2,000원
- 등록일 2004.10.05
- 파일종류 한글(hwp)
- 참고문헌 없음
- 최근 2주 판매 이력 없음
|
|
heap의 name을 결정한다 */
second = compare(b); /* 현 heap의 name을 결정한다 */
heap[second].count = heap[first].count; /* heap의 원소의 갯수를 복사한다. */
for(count=0; count < MAX_ELEMENTS ; count++){
heap[second].key[count] = heap[first].key[count]; /* heap의 key값을 하나하나 차
|
- 페이지 6페이지
- 가격 1,000원
- 등록일 2003.09.28
- 파일종류 한글(hwp)
- 참고문헌 없음
- 최근 2주 판매 이력 없음
|
|
for(i=1; i<=6 ; i++) {
printf("%d번째 값: %d\n",i,heap1.heap[i]);
}
printf("------------------------------\n");
printf("우선순위가 높은 값 부터 출력\n");
printf("%d\n",delete_max_heap(&heap1)); //우선순위큐 반환
printf("%d\n",delete_max_heap(&heap1));
printf("%d\n",delete_max_heap(&heap1));
p
|
- 페이지 3페이지
- 가격 3,000원
- 등록일 2009.09.25
- 파일종류 한글(hwp)
- 참고문헌 없음
- 최근 2주 판매 이력 없음
|
|
MAX_SIZE){
fprintf(stderr, "The heap is full\n");
exit(1);
}
if(n == 2)
deap[2] = x;
else switch(max_heap(n)){
case FALSE :
i = max_partner(n);
if(x.key > deap[i].key){
deap[n] = deap[i];
max_insert(deap,i,x);
}
else
min_insert(deap,n,x);
break;
case TRUE :
i = min_partner(n);
if(x.key < deap[
|
- 페이지 5페이지
- 가격 1,000원
- 등록일 2007.04.06
- 파일종류 한글(hwp)
- 참고문헌 없음
- 최근 2주 판매 이력 없음
|