1 实验五查找及排序实验课程名 : 数据结构与算法一、实验目的及要求1、掌握查找的不同方法,并能用高级语言实现查找算法。2、熟练掌握顺序表的查找方法和有序顺序表的折半查找算法。3、掌握常用的排序方法,并能用高级语言实现排序算法。4、深刻理解排序的定义和各种排序方法的特点,并能加以灵活运用。5、了解各种方法的排序过程及依据的原则,并掌握各种排序方法的时间复杂度的分析方法。二、实验内容任务一:顺序表的顺序查找。有序表的折半查找。完成下列程序,该程序实现高考成绩表(如下表所示)的顺序查找,在输出结果中显示查找成功与查找不成功信息。解答:(1)源代码 :#include
// EOF(=^Z或 F6),NULL #include // atoi() #include // eof() #include // floor(),ceil(),abs() #include // exit() #include // cout,cin // 函数结果状态代码 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 // #define OVERFLOW -2 因为在 math.h 中已定义 OVERFLOW的值为 3, 故去掉此行 typedef int Status; // Status是函数的类型 , 其值是函数结果状态代码,如 OK等 typedef int Boolean; // Boolean是布尔类型 , 其值是 TRUE或 FALSE #define MAX_LENGTH 100 #include 准考证号姓名各科成绩总分政治语文外语数学物理化学生物179328 何芳芳85 89 98 100 93 80 47 592179325 陈红85 86 88 100 92 90 45 586179326 陆华78 75 90 80 95 88 37 543179327 张平82 80 78 98 84 96 40 558179324 赵小怡76 85 94 57 77 69 44 5022 #include #include // malloc()等 #include // INT_MAX等 #include // EOF(=^Z或 F6),NULL #include // atoi() #include // eof() #include // floor(),ceil(),abs() #include // exit() #include // cout,cin // 函数结果状态代码 #define TRUE 1 #define FALSE 0 #define OK 1 #define ERROR 0 #define INFEASIBLE -1 // #define OVERFLOW -2 因为在 math.h 中已定义 OVERFLOW的值为 3, 故去掉此行 typedef int Status; // Status是函数的类...