随笔分类 - [18] 数据结构与算法
计算机软件基础Software Basis。数据结构与算法。
摘要:解读大纲:计算机软件基础 Foundations of Computer Software 课程代码:09100070 学 分:3.5 总学时: 56 学时 讲课学时:34学时 实验学时:0 学时 上机学时:22学时 课程设计:0 周...
阅读全文
摘要://=========================================== // 简单选择排序 // Author:Eman Lee //=========================================== #include #define N 10 void Display(int *a, int n) { int i; for (i = 0;...
阅读全文
摘要://============================================== // 直接插入排序(Straight Selection Sort) // Author: eman lee // 直接插入排序 c语言源程序 //============================================== #define N 5 #include //显示元素...
阅读全文
摘要:P131,第6题之二 参考答案 (1) 快速排序(第一趟) 初始状态 [53 87 12 61 70 68 27 65 21 35 ] Pivot=53 53 ...
阅读全文
摘要:快速排序c语言源程序之一 // 快速排序 // 使用递归调用来实现快速排序 // Author: eman lee /*Quick Sort */ #include void quick_sort(int data[], int low, int high) { int i, j, pivot; if (low =pivot) ...
阅读全文
摘要:Author: Eman Lee P131,第6题之一 参考答案 (1) 直接插入排序 初始状态 [53] [87 12 61 70 68 27 65 21 35 ] 第一趟 [53 87] [12 61 70 68 27 65 21 35 ] 第二趟 [12 53 87] [61 70 68 27 65 21 35 ]...
阅读全文
摘要:Author: Eman Lee 计算机软件基础,教材 P131,第4题 参考答案 (1)查找e的过程 a b c ...
阅读全文
摘要:/* Title: 冒泡排序 Author: eman lee 算法功能:冒泡排序算法实现将一个长度为n的线性表r上的所有元素按关键字升序排列。 */ #include void bubblesort(int r[],int n) { /*elements are stored in r[1] to r[n]*/ int i,j,flag; int temp; flag=1; ...
阅读全文
摘要:/* Title: 直接插入排序 Author: eman lee 算法功能:实现将一个长度为n的线性表r上的所有元素按关键字升序排列。 */ #include void insertsort (int r[] , int n) { /*r[0] is preserved, elements are stored in r[1] to r[n]*/ int i,j; for (...
阅读全文
摘要:实验三 参考源程序 //软件基础 教材 79 页 习题6 答案 //Eman Lee #include #include #define m 5 //队列容量 //定义队列的结构 struct queue { int seq[m];//队列元素 int quelen;//队列中元素个数 int rear;//队列尾指针 }; //初始化队列 struct queue ...
阅读全文
摘要:实验二 参考源程序 /* Author : Eman Lee, 计算机软件基础 教材 P79, ex4 设有一头为head的带头结点的单链表,其数据域为整形数据且递增有序。 试写一算法,将元素插入链表适当的位置,以保持链表的有序性。 */ #include #include typedef int DataType; struct nodetype//Define node 定义节点 { ...
阅读全文
摘要:------------------------------------------------------------------ 实验一 参考源程序 // 线性表的顺序存储(顺序表) // Author: Eman Lee #include void SearchMultipleLocation(char List[],int *ListLength,char key) { int i...
阅读全文
摘要:P111,第3题 参考答案 先序遍历: A B D G H C E I F J 中序遍历: G D H B A E I C F J 后序遍历: G H D B I E J F C A 顺序存储结构: 位置 1 ...
阅读全文
摘要:/*--------------------------------------------- Title: 二叉排序树中查找 Author: eman lee ----------------------------------------------*/ #include #include //定义二叉树的节点结构 struct node { int data;//...
阅读全文
摘要://分块查找,索引顺序查找 #include //定义顺序存储线性表的结点结构 struct student { long Xuehao;//关键字 int Jihao; //非关键字 }; struct indexNode { int address; int maxKey; }; int SearchPosition(struct indexNod...
阅读全文
摘要:/*--------------------------------------------------------- Title: 顺序查找 Author : Eman Lee ----------------------------------------------------------*/ #include //定义顺序存储线性表的结点结构 struct node { ...
阅读全文
摘要:/*--------------------------------------------------------- Title: 二叉排序树(Binary Sorting Tree) 请先阅读教材 91-93,96-99页, 3.2.3, 3.2.7节, (注意以下程序为简化后的,仅供入门学习之用) -----------------------------------------...
阅读全文
摘要:/*--------------------------------------------------------- Title: Link Queue(链队列) 链队列-链式存储结构的队列 请先阅读教材74-77页, 2.4.1-2.4.4节, 队列的定义及基本运算 (注意:以下程序为简化后的,仅供入门学习之用) ----------------------------------...
阅读全文
摘要:/*--------------------------------------------------------- Title: Sequence Queue(顺序队列)顺序队列-顺序存储结构的队列 请先阅读教材74-76页, 2.4.1-2.4.3节, 队列的定义及基本运算 (注意:以下程序为简化后的,仅供入门学习之用) -----------------------------...
阅读全文
摘要:/*--------------------------------------------------------- Title: Link Stack(链栈) 链栈-链式存储结构的栈 请先阅读教材67页, 2.3.2,2.3.4节, 栈的定义及基本运算 (注意以下程序为简化后的,仅供入门学习之用) --------------------------------------------...
阅读全文