数据结构上机作业 排序(简单排序 归并排序 堆排序 快速排序 插入排序).docVIP

  • 10
  • 0
  • 约6.66千字
  • 约 7页
  • 2018-03-14 发布于湖北
  • 举报

数据结构上机作业 排序(简单排序 归并排序 堆排序 快速排序 插入排序).doc

数据结构上机作业 排序(简单排序 归并排序 堆排序 快速排序 插入排序)

/*数据结构排序算法 简单排序 快速排序 堆排序 插入排序 归并排序 此程序在DEV下测试成功*/ #include cstdlib #include iostream #define Maxlength 51 struct Compute //用于统计比较和交换的次数 { int compareNum; int swapNum; }; typedef int LIST[Maxlength]; using namespace std; typedef struct { LIST myheap; int count; }Heap; Compute whole,whole1,Com;; void CreateHeap(Heap temp) { temp.count=0; } bool HeapEmpty(Heap temp) { return (!temp.count); } bool HeapFull(Heap temp) { return (temp.count==Maxlength-1); } int GenerateNum() //随机生成1~99之间的一个数并返回 { return rand()%99+1; } void Swap(int x,int

文档评论(0)

1亿VIP精品文档

相关文档