资源简介
南昌航空大学的十次试验代码,每次的实验代码都实现了主要需求!!!

代码片段和文件信息
#include “stdio.h“
#include “malloc.h“
#include “stdlib.h“
#define ERROR 0
#define OK 1
#define OVERFLOW -1
#define MAXSIZE 20
typedef int ElemType;
typedef struct
{
ElemType *elem;
int length;
}SqList;
int InitList(SqList *L int n);
int CreateList(SqList *L int n);
int Partition(SqList *L int low int high);
int QSort(SqList *L int low int high);
int QuickSort(SqList *L);
int printList(SqList L);
void main()
{
SqList L;
int n;
printf(“Enter the data numbers:“);
scanf(“%d“ &n);
InitList(&L n);
CreateList(&L n);
QuickSort(&L);
printf(“The sort data is:“);
printList(L);
}
int InitList(SqList *L int n)
{
L->elem=(ElemType *)malloc((n+1)*sizeof(ElemType));
if(!L->elem)
return OVERFLOW;
L->length=n;
return OK;
}
int CreateList(SqList *L int n)
{
int i;
printf(“Enter the %d datas:“ n);
for(i=1; i<=n; i++)
{
scanf(“%d“ &L->elem[i]);
}
return OK;
}
int Partition(SqList *L int low int high)
{
int pivotkey;
L->elem[0]=L->elem[low];
pivotkey=L->elem[low];
while(low {
while(lowelem[high]>=pivotkey)
high--;
L->elem[low]=L->elem[high];
while(lowelem[low]<=pivotkey)
low++;
L->elem[high]=L->elem[low];
}
L->elem[low]=L->elem[0];
return low;
}
int QSort(SqList *L int low int high)
{
int pivotloc;
if(low {
pivotloc=Partition(L low high);
QSort(L low pivotloc-1);
QSort(L pivotloc+1 high);
}
return OK;
}
int QuickSort(SqList *L)
{
QSort(L 1 L->length);
return OK;
}
int printList(SqList L)
{
int i;
for(i=1; i<=L.length; i++)
printf(“%3d“ L.elem[i]);
printf(“\n“);
return OK;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1729 2003-02-02 05:45 10201118_黄辉波\lab101.c
文件 1601 2003-02-02 06:34 10201118_黄辉波\lab102.c
文件 1826 2012-03-19 16:59 10201118_黄辉波\lab11.c
文件 3850 2012-03-19 18:06 10201118_黄辉波\lab12.c
文件 2279 2012-01-11 10:49 10201118_黄辉波\LAB21.C
文件 3223 2012-01-11 11:32 10201118_黄辉波\LAB22.C
文件 4287 2012-04-17 12:52 10201118_黄辉波\lab31.c
文件 1427 2012-04-17 21:11 10201118_黄辉波\lab32.c
文件 1273 2012-01-25 11:40 10201118_黄辉波\lab41.c
文件 5267 2012-04-25 13:35 10201118_黄辉波\lab42.c
文件 2940 2012-02-08 10:27 10201118_黄辉波\lab51.c
文件 3034 2012-02-15 11:30 10201118_黄辉波\lab61.c
文件 3675 2012-02-22 10:58 10201118_黄辉波\LAB71.c
文件 2521 2012-02-29 11:40 10201118_黄辉波\lab81.c
文件 2985 2012-05-29 21:54 10201118_黄辉波\lab82.c
文件 1354 2012-06-05 18:52 10201118_黄辉波\lab91.c
文件 2192 2012-03-07 10:40 10201118_黄辉波\lab92.c
目录 0 2012-06-20 21:36 10201118_黄辉波
----------- --------- ---------- ----- ----
45463 18
相关资源
- 数据结构年终考题范围和答案 耿国华
- 数据结构 朱战力 习题解答 数据结构
- 数据结构课程设计 6 1 彩票系统
- 教学计划编制系统
- 大数(链表、数组)实现
- 自己写的航空订票系统c 版--数据结构
- 数据结构实验魔王语言
- 航空订票系统_数据结构课程设计
- 多项式求和(数据结构C 版)
- 尚观培训linux董亮老师关于数据结构的
- 数据结构 知识点总结
- 华南理工大学数据结构复习提纲二
- 华南理工大学数据结构复习提纲一
- 数据结构用C 写的停车场系统源代码
- 数据结构(河北科技大学)
- 数据结构考前习题 清华大学出版社
- 数据结构课件(北邮)
- 数据结构实验 基于栈的表达式求值
- 数据结构课程设计——图书管理系统
- 成绩管理系统(数据结构)
- 数据结构-最小通信网问题
- 数据结构课程设计同学通讯录系统
- 数据结构课程设计 公园导游图
- 数据结构殷人昆版的课后答案
- 2006年湖北工业大学409数据结构试题
- 数据结构实验-魔王语言-源码加实验报
- 简单计算器的实现(数据结构)
- 简单计算器的实现(数据结构 修正版
- Fundamentals of Data Structure in C
- 北京邮电大学数据结构历年考研真题
评论
共有 条评论