随笔分类 -  数据结构

摘要:#include <iostream> #include <vector> #include <string> #include <cstring> #include <queue> #include <stack> #define MAX 999 using namespace std; int 阅读全文
posted @ 2020-12-15 17:45 ananasaa 阅读(180) 评论(0) 推荐(0)
摘要:一定要注意,外部变量【数组】开的大小,太大了会溢出,太小了提交的时候会溢出,这是一门学问啊 #include <iostream> #include <vector> #include <string> #include <queue> #include <cstring> #define MAX 阅读全文
posted @ 2020-12-14 21:28 ananasaa 阅读(111) 评论(0) 推荐(0)
摘要:#include <iostream> #include <vector> #include <string> #include <cstring> #define MAX 10000 using namespace std; int tree[MAX]; void preverse(int x) 阅读全文
posted @ 2020-12-14 19:40 ananasaa 阅读(170) 评论(0) 推荐(0)
摘要:#include <iostream> #include <vector> #include <string> #include <queue> #include <cstring> #define MAX 10000 using namespace std; struct tree { int d 阅读全文
posted @ 2020-12-14 19:37 ananasaa 阅读(170) 评论(0) 推荐(0)
摘要:①用递归做,会超时 #include <iostream> #include <string> #include <stack> #include <queue> using namespace std; int maze[1005][1005]; int mark[1005][1005]; int 阅读全文
posted @ 2020-11-17 13:38 ananasaa 阅读(117) 评论(0) 推荐(0)
摘要:## 有缺陷,待改进,等我再学学::>_<:: #include <iostream> #include <string> #include <queue> #include <stack> using namespace std; int maze[105][105]; bool mark[105 阅读全文
posted @ 2020-10-14 23:27 ananasaa 阅读(127) 评论(0) 推荐(0)
摘要:#include <iostream> #include <string> #include <queue> using namespace std; int main() { queue<int> q; q.push(1); q.push(1); int n; cin>>n; int head=0 阅读全文
posted @ 2020-10-14 09:24 ananasaa 阅读(74) 评论(0) 推荐(0)
摘要:#include <iostream> #include <fstream> #include <cassert> using namespace std; const int defaultSize=2000; template<class T> class Stack { private: T* 阅读全文
posted @ 2020-10-07 09:51 ananasaa 阅读(150) 评论(0) 推荐(0)
摘要:嘿嘿嘿写出来啦!!开心!!!用单循环链表实现的 #include <iostream> #include <string> using namespace std; struct PersonNode //成员结点 { string name; int num; string sex; int ag 阅读全文
posted @ 2020-10-07 08:21 ananasaa 阅读(132) 评论(0) 推荐(0)
摘要:(一)线性表 1.擅长存取任一指定序号的元素+对第一个和最后一个元素插入删除 2.支持随机存取 3.插入和删除元素时,移动元素的个数与该元素的位置有关 4.逻辑上相邻的元素,其物理位置必定相邻 5.插入:1≤i≤n+1,移动n-i+1个元素 6.删除:移动n-i个元素 (二)单链表 1.(❌)将N个 阅读全文
posted @ 2020-10-03 16:49 ananasaa 阅读(1806) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-10-03 15:32 ananasaa 阅读(89) 评论(0) 推荐(0)
摘要:①C++实现顺序栈 #include <iostream> #include <fstream> #include <cassert> using namespace std; ///顺序栈 const int defaultSize=200; template<class T> class Sta 阅读全文
posted @ 2020-10-03 10:39 ananasaa 阅读(208) 评论(0) 推荐(0)
摘要:C++实现带头结点的静态链表 #ifndef STATICLIST_H #define STATICLIST_H #include <cassert> #include <iostream> using namespace std; ///带头结点的静态链表 const int defaultSiz 阅读全文
posted @ 2020-10-02 13:15 ananasaa 阅读(149) 评论(0) 推荐(0)
摘要:(Ⅰ) 顺序表实现相加 ①C方法(很简单的对应相加。。 #include <iostream> #include <stdlib.h> using namespace std; typedef struct PolyNode *Poly; struct PolyNode { int a; int n 阅读全文
posted @ 2020-10-02 09:37 ananasaa 阅读(262) 评论(0) 推荐(0)
摘要:①C++实现循环链表(带头节点) #include <iostream> #include <cassert> //文件操作 #include <fstream> //对文件进行操作 ///有头结点的循环链表 using namespace std; //枚举:第一个成员默认为0,后面依次+1 en 阅读全文
posted @ 2020-10-02 09:13 ananasaa 阅读(153) 评论(0) 推荐(0)
摘要:①不带头结点的单链表的实现(类模板) 1 #include <iostream> 2 #include <cstdlib> 3 #include <ctime> 4 ///无头结点 5 using namespace std; 6 //typedef int T; 7 8 template <cla 阅读全文
posted @ 2020-09-29 08:42 ananasaa 阅读(154) 评论(0) 推荐(0)
摘要:C++代码实现顺序表 1 #include <iostream> 2 #include <cassert> 3 #include <cstdlib> 4 #include <ctime> 5 using namespace std; 6 typedef int T; 7 const int defa 阅读全文
posted @ 2020-09-26 10:24 ananasaa 阅读(184) 评论(0) 推荐(0)