随笔分类 -  数据结构

摘要:解法1. : 解法2: 快慢指针,环 {3,1,2,0,2,5,3} index {0,1,2,3,4,5,6} 这是一个环:3->0->3->0 {1,4,6,6,6,2,3} 1->4->6->3>6 是个环:慢指针一步一步,快指针两步两步,等他们一样的时候,快指针回到起点,一步一步,等他们一样 阅读全文
posted @ 2019-09-09 10:53 式微胡不归 阅读(436) 评论(0) 推荐(0)
摘要:#include #define MaxSize 50 typedef struct{ char data[MaxSize]; int top; }SqStack; void InitStack(SqStack &S){ S.top = -1; } int StackEmpty(SqStack &S){ if(S.top == -1) ... 阅读全文
posted @ 2017-08-05 21:50 式微胡不归 阅读(295) 评论(0) 推荐(0)
摘要:切割钢管问题 最原始的代码: 自带备忘录的: 从底到上的: 完整代码: 阅读全文
posted @ 2016-07-20 11:15 式微胡不归 阅读(126) 评论(0) 推荐(0)
摘要:http://wenku.baidu.com/link?url=g-tuMDOFjmeiwKLBybwJTgOL3ebIULtLCc1dKm_o06nPyVb6zbGnDURJDwc3GUcDot47qxIROdLK3zLMpop88DUhbj0jXi5ALFV7rQZScwa 阅读全文
posted @ 2016-07-19 09:25 式微胡不归 阅读(218) 评论(0) 推荐(0)
摘要:恢复内容开始 1.回溯法 http://wenku.baidu.com/link?url=y_vux4adjkIfiRiI-Q_RU7kTdaWJeRnmtIHXEYHCeWyMcSHQ-ADHtaI66GNfm5rWied6ScyzMKOyNZ5Lt_-vhk8qScI2Sb3xiAwlWpbGA 阅读全文
posted @ 2016-07-18 09:24 式微胡不归 阅读(144) 评论(0) 推荐(0)
摘要:35,15,+,80,70,-,*,20,///后缀表达方式(((35+15)*(80-70))/20)=25//中缀表达方式/,*,+,35,15,-,80,70,20//前缀表达方式人的思维方式很容易固定~~!正如习惯拉10进制。就对2,3,4,8,16等进制不知所措一样~~!人们习惯的运算方... 阅读全文
posted @ 2016-01-03 12:07 式微胡不归 阅读(163) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#includeusing namespace std;#define MAX 20typedef struct node{ struct node * nextarc; char Info;}... 阅读全文
posted @ 2015-11-29 13:04 式微胡不归 阅读(127) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#define MAX 20typedef struct node{ struct node * nextarc; char Info;}ArcNode,*pArcNode;typedef st... 阅读全文
posted @ 2015-11-29 09:34 式微胡不归 阅读(252) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#include#define MAX 20#define INFINITY 0x7ffffffftypedef struct{ int U[MAX][MAX]; char adj[MAX][10]; in... 阅读全文
posted @ 2015-11-29 08:35 式微胡不归 阅读(148) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#include#includeusing namespace std;typedef struct node{ //哈夫曼树int weight;char data;int parent, lchild,... 阅读全文
posted @ 2015-11-18 19:18 式微胡不归 阅读(115) 评论(0) 推荐(0)
摘要:void traverse(pBitree root){ queueT; T.push(root); while (!T.empty()) { printf("%c", T.front()->data); if (T.front()->lchild!=NULL) T.push(T.front(... 阅读全文
posted @ 2015-11-14 11:24 式微胡不归 阅读(154) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#includeusing namespace std;typedef struct tree{ char data; tree *lchild; tree *rchild;}Bitree, *pBitre... 阅读全文
posted @ 2015-11-14 09:59 式微胡不归 阅读(527) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include#includeusing namespace std;typedef struct tree{ char data; int ltag; int rtag; tree *lchild; tree *rch... 阅读全文
posted @ 2015-11-08 10:36 式微胡不归 阅读(238) 评论(0) 推荐(0)
摘要:/*学号:2014329620069 姓名:张卓鹏 班级:14计科2*/#define _CRT_SECURE_NO_WARNINGS#include#include#include#include#include#include#include#includeusing namespace std... 阅读全文
posted @ 2015-11-06 10:59 式微胡不归 阅读(383) 评论(0) 推荐(0)
摘要:#define _CRT_SECURE_NO_WARNINGS#include#include #include#includechar maze[100][100];int step[15][15];int n, m;int sm,sn,em,en;int dn[4]={ 0, 1, 0, -1 ... 阅读全文
posted @ 2015-11-04 14:31 式微胡不归 阅读(232) 评论(0) 推荐(0)
摘要:两个链表#define _CRT_SECURE_NO_WARNINGS#include#include#includestruct Student{ int Grade; char Major[50]; int Class; int ID; char Name[20]; struct Student... 阅读全文
posted @ 2015-11-04 14:29 式微胡不归 阅读(198) 评论(0) 推荐(0)
摘要:---恢复内容开始---#define _CRT_SECURE_NO_WARNINGS#include#include#includeusing namespace std;typedef struct tree{ char data; tree *lchild; tree *rchild;}Bit... 阅读全文
posted @ 2015-11-04 14:23 式微胡不归