摘要: 说明 想要给Typecho文章一个独立的url,或按照自己的格式来 这时候我们就要设置永久链接 Typecho设置文章永久链接 设置伪静态 伪静态设置要取决于是nginx还是apache,详情请参考《Typecho设置伪静态》 永久链接格式 登陆博客后台 设置-〉永久链接 是否使用地址重写功能:选择 阅读全文
posted @ 2021-10-26 22:59 CairBin 阅读(286) 评论(0) 推荐(0) 编辑
摘要: 代码 /* 快速排序 对low至high的位置进行排序 */ void QuickSort(int R[], int low, int high) { int temp, i = low, j = high; if(i<j) { temp = R[low]; //下面将小于temp的数放置在temp 阅读全文
posted @ 2021-10-25 13:30 CairBin 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 代码 /* * 冒泡排序 * 参数: 参与排序的数组, 数组元素个数 */ void BubbleSort(int R[], int n) { int i, j; bool flag; for(i = n-1; i>=1; i--) { flag = false; //用于标记本次循环是否发生交换 阅读全文
posted @ 2021-10-17 09:32 CairBin 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 本文为了方便理解,先上代码再做解释 插入排序代码 void InsertSort(int R[], int n) { int i,j, temp; for(i = 1; i<n; i++) { temp = R[i]; j = i-1; while(j >= 0 && temp < R[j]) { 阅读全文
posted @ 2021-10-14 00:01 CairBin 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 链栈的定义 #include <iostream> using namespace std; //链栈,理论上只要内存够大不存在上溢,只存在下溢(栈空后继续取出元素) typedef struct _QNode { int data; struct _QNode *next; }StNode; 链栈 阅读全文
posted @ 2021-10-10 15:19 CairBin 阅读(49) 评论(0) 推荐(0) 编辑
摘要: 栈的定义 #include <iostream> #define MAXSIZE 1000 using namespace std; //顺序栈 typedef struct { int data[MAXSIZE]; //存放栈顶元素 int top; //栈顶指针 }SqStack; 栈的操作 初 阅读全文
posted @ 2021-10-07 21:42 CairBin 阅读(61) 评论(0) 推荐(0) 编辑
摘要: 说明 共享双链表意义在于,可以用一套函数维护不同数据类型的双链表 准备 定义双链表 #include <iostream> #include <string> using namespace std; //此处并不包含数据域,仅有指针域用于连接结点 typedef struct _DbLinkLis 阅读全文
posted @ 2021-10-05 14:24 CairBin 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 栈的基本概念 栈的定义 栈是一种只能在一端进行插入或删除的线性表。其中插入被称作进栈,删除被称作出栈。 允许进行插入或删除操作的一端被称为栈顶,另一段被称为栈底,栈底固定不变。其中,栈顶由一个称为栈顶指针的位置指示器来指示。 (PS:栈顶指针并非传统意义上的指针,比如顺序栈用的是一个整型变量来指示, 阅读全文
posted @ 2021-09-28 21:40 CairBin 阅读(1086) 评论(0) 推荐(0) 编辑
摘要: 双链表的代码定义 #include <iostream> using namespace std; typedef struct _DLNode { int data; //结点数据域 struct _DLNode *next; //指向后继的指针 struct _DLNode *prev; //指 阅读全文
posted @ 2021-09-28 11:43 CairBin 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 顺序表应用——逆置问题 问题描述 给定一个顺序表,将其中的元素逆置 例子 给定一个顺序表,其中有0至10共11个元素从小至大排列,请将这11个元素逆置使其从大到小排列 以下是解题代码 代码 #include <iostream> #define MAXSIZE 100 typedef struct{ 阅读全文
posted @ 2021-09-25 11:09 CairBin 阅读(161) 评论(0) 推荐(0) 编辑