数据结构
柔和的冷漠敷衍
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
数据结构期中复习---第四章字符串匹配(BF算法)
第四章 字符串和多维数组 1.字符串匹配(BF算法) #include<iostream> #include<string> using namespace std; int BF(string S,string T) { int i=0,j=0; //设置比较的起始下标 while((S[i]!='\0') && (T[j]!='\0')) { if(S[i]==T[j]) { i++; j++; } else { i=i-j+1; j=0; }原创 2021-01-24 19:35:04 · 264 阅读 · 1 评论 -
数据结构期中复习---第三章栈和队列---程序片段
第三章 栈和队列 1.顺序栈的实现 const int StackSize=100; template <typename DataType> class SeqStack{ private: DataType data[StackSize]; int top; public: SeqStack(){top=-1;} ~SeqStack(){} void push(Da原创 2020-11-15 17:34:32 · 967 阅读 · 0 评论 -
数据结构期中复习---第一章绪论---程序片段
第一章 1.循环左移 void reverseArr(int A[],int start,int rear) { for(int i=start,j=reaer;i<=(start+rear)/2;i++,j++) { int temp=A[i]; A[i]=A[j]; A[j]=temp; } } 2.奇偶数排列 思路:分别设置工作指针i和j,i指向数组的低地址端,j指向数组的高地址端,一旦发现左边是偶数,右边是奇数,则发生交换原创 2020-11-14 11:05:52 · 2855 阅读 · 6 评论 -
数据结构期中复习---第二章线性表---程序片段
第二章 线性表 1.顺序表 插入操作 template <typename DataType> void SeqList<DataType>::Insert(int i,DataType x) //插入操作 { if(length==MaxSize) exit(0); //上溢 if(i<1 || i>length+1) exit(0); //插入位置错误 for(int j=length;j>=i;j--) {原创 2020-11-14 11:07:07 · 632 阅读 · 0 评论
分享