数据结构
市井烟火气
sdnu
展开
-
中缀式借栈转后缀式
考点:转换过程中同时保存在栈中的操作符的最大个数。 swust oj 1042 中缀式转后缀式 #include <bits/stdc++.h> using namespace std; map<char, int> isp; ///in stack priority map<char, int> icp; ///in coming priority void init() { isp['('] = 1; isp[')'] = 6;原创 2021-06-17 14:13:42 · 159 阅读 · 0 评论 -
队列
#include #include #include using namespace std; //C++队列Queue类成员函数如下: // //push() 在末尾加入一个元素 queue入队,如例:q.push(x); 将x 接到队列的末端。 // //empty() 如果队列空则返回真 判断queue队列空,如例:q.empty(),当队列...原创 2018-11-14 20:49:05 · 89 阅读 · 0 评论 -
栈
#include #include #include using namespace std; //s.empty() 如果栈为空返回true,否则返回false //s.size() 返回栈中元素的个数 //s.pop() 删除栈顶元素 //s.top() 返回栈顶元素 //...原创 2018-11-14 20:51:05 · 94 阅读 · 0 评论 -
单向链表的建立(封装)
链表在main函数里写是一回事,封装成独立函数会有新问题… #include<bits/stdc++.h> using namespace std; struct Node ///(结点形式) { int data; ///数据域 struct Node * next; ///指针域 }; type...原创 2019-01-09 21:29:11 · 279 阅读 · 0 评论