-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathesorting.h
More file actions
37 lines (27 loc) · 830 Bytes
/
esorting.h
File metadata and controls
37 lines (27 loc) · 830 Bytes
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
//
// Created by Administrator on 2019/9/9.
// external sorting
#ifndef DATALGORITHM_ESORTING_H
#define DATALGORITHM_ESORTING_H
#include <stdio.h>
typedef struct heapnode{
int data;
int i; // 第i个顺串中的数据记录
} HeapNode;
// 二叉堆(最小堆)
typedef struct heap{
HeapNode *array;
int size;
} Heap;
// 优先队列主要使用到的操作
extern Heap *heap_new(HeapNode *datas, int size);
extern HeapNode *heap_min(Heap *heap);
extern void heap_replace_min(Heap *heap);
// 交换数据记录
extern void swap(HeapNode *a, HeapNode *b);
// 归并排序
extern void msort(int array[], int left, int right);
// 外部排序
extern void external_sort(char *input, char *output, int runs, int run_size);
extern FILE* openFile(char* fileName, char* mode);
#endif //DATALGORITHM_ESORTING_H