
数据结构
Phoenix0z
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
c++中栈stack、queue的使用
包含头文件 #include<stack> 和命名空间 using namespace std定义一个栈的语句:stack<int> stackOne,则:入栈操作:int number = 3; stackOne.push(number);出栈操作:stackOne.pop();获取栈顶元素:stackOne.top();判断栈是否为空:stackO...原创 2018-10-14 15:44:42 · 784 阅读 · 0 评论 -
二叉树,中序遍历+后序遍历输出前序遍历
引用:https://blog.youkuaiyun.com/m0_37698652/article/details/79218014#include <iostream>#include <string>using namespace std;struct TreeNode{ struct TreeNode* left; struct TreeNode* ri...原创 2018-12-14 14:39:34 · 1201 阅读 · 0 评论 -
哈希表
1。#include <iostream>using namespace std;struct Hash{ int k; struct Hash*next;};int main(){ int n; cin>>n; int q=11; Hash**group=new Hash*[q]; for(in...原创 2018-12-04 01:22:37 · 271 阅读 · 0 评论 -
二叉排序树
#include <iostream>using namespace std;typedef struct Node{ int key; struct Node* Lchild; struct Node* Rchild;}BSTNode;int EQ(int a,int b){ if(a==b){ return 1; ...原创 2018-11-27 21:57:27 · 248 阅读 · 0 评论 -
最小树
#include<iostream>#include<string>using namespace std;const int Max=20;const int Mlen=9999;struct zp{int k;int value;};struct ma{ int h1; int h2; int v;};zp mar[...原创 2018-11-13 02:10:40 · 628 阅读 · 0 评论 -
图
#include<iostream>using namespace std;const int MaxLen=20;void SetMatrix(int n,int Ma[MaxLen][MaxLen]) { for (int i = 0; i< MaxLen; i++) { for (int j = 0; j<MaxLen; j++) { Ma[i]...原创 2018-10-29 20:28:12 · 230 阅读 · 0 评论 -
链表,不用类
#include<iostream>#define ok 0#define error -1using namespace std;int num ;struct ListNode { int data; ListNode*next;};void LL_display(ListNode*head) { ListNode *p = head->next;...原创 2018-10-19 09:59:55 · 282 阅读 · 0 评论 -
STL学习
1.sort(a,a+n)排序函数https://blog.youkuaiyun.com/w_linux/article/details/76222112#include<iostream>#include<algorithm>using namespace std;bool Ascending(int i, int j) { return i < j;...原创 2018-10-15 17:03:00 · 259 阅读 · 0 评论 -
树
#include<iostream>using namespace std;//函数定义在 main 之前不用声明typedef int TelemType;//方便替换成其他类型的数据typedef struct BinaryTreeBode { TelemType data; struct BinaryTreeBode *left; struct Bina...原创 2018-10-15 16:05:53 · 230 阅读 · 0 评论 -
数据结构串的应用,实验
#include<iostream>#include<string.h>using namespace std;const int MAXNUM = 1000;int main() { int t; cin >> t; char chars[MAXNUM]; char chart[MAXNUM]; while (t--) { memset...原创 2018-10-14 15:41:44 · 690 阅读 · 0 评论 -
数据结构 二叉树《c++版》
二叉树节点BinNode模板类#define BinNodePosi(T) BinNode<T> * //节点位置#define stature(p) ((p) ? (p)->height : -1) //节点高度(与“空树高度为-1”的约定相统一)typedef enum { RB_RED, RB_BLACK } RBColor; //节点颜色template &...原创 2018-10-15 09:49:52 · 376 阅读 · 0 评论 -
复习:DS顺序表插入删除查找
#include<iostream>using namespace std;const MaxLen=1000;struct SeqList{ int*list; int Len;}Se;void insert(int i,Se&se,int item){ if(i<1||i>Len+1){ cout<<"error"<&...原创 2018-12-22 22:31:19 · 346 阅读 · 0 评论