
浙大数据结构学习
浅浅雨墨
这个作者很懒,什么都没留下…
展开
-
六度空间
#include <iostream>#include <queue>#include <iomanip>using namespace std;#define MAXSIZE 1001int g[MAXSIZE][MAXSIZE] = { 0 };int visited[MAXSIZE] = { 0 };void initVisited(int ...原创 2020-04-07 15:13:12 · 207 阅读 · 0 评论 -
列出连通集
#include <iostream>#include <queue>using namespace std;const int MAX_N = 10;int g[MAX_N][MAX_N];int visited[MAX_N];//用来标记节点是否已经输出void BFS(int x,int N){ queue<int>q; q.push(x...原创 2020-04-06 22:30:26 · 222 阅读 · 0 评论 -
03-树3 Tree Traversals Again (25分)
#include <iostream>#include <stack>#include <string>using namespace std;const int maxn = 30;int pre[maxn];int in[maxn];int post[maxn];void solve(int preL, int inL, int postL,...原创 2020-03-30 23:24:08 · 117 阅读 · 0 评论 -
有序链表的合并
#include <iostream>#include <cstdlib>using namespace std;typedef int ElementType;typedef struct Node *PtrNode;struct Node{ ElementType data;//存储结点数据 PtrNode next;//指向下一个结点的指针};ty...原创 2020-03-22 00:56:15 · 148 阅读 · 0 评论 -
树的同构
#include <iostream>using namespace std;#define MaxTree 100#define ElementType char#define Tree int#define Null -1//用结构数组表示二叉树struct TreeNode{ ElementType Element; Tree left; Tree rig...原创 2020-03-22 00:55:25 · 101 阅读 · 0 评论 -
一元多项式的加法与乘法实现
#include <iostream>using namespace std;typedef struct PolyNode *Polynomial;//结点结构struct PolyNode{ int coef;//系数 int expon;//指数 Polynomial next;};void Attach(int c, int e, Polynomial *p...原创 2020-03-18 18:16:58 · 475 阅读 · 0 评论