中国大学MOOC-陈越、何钦铭-数据结构-2018秋
文章平均质量分 91
学习记录
日冕星
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
02-线性结构1 两个有序链表序列的合并
02-线性结构1 两个有序链表序列的合并#include <stdio.h>#include <stdlib.h>typedef int ElementType;typedef struct Node *PtrToNode;struct Node { ElementType Data; PtrToNode Next;};typedef P...原创 2020-01-16 22:27:29 · 235 阅读 · 0 评论 -
02-线性结构2 一元多项式的乘法与加法运算
02-线性结构2 一元多项式的乘法与加法运算#include <stdio.h>#include <stdlib.h>typedef struct PolyNode *Polynomial; struct PolyNode { int coef; int expon; Polynomial link; };Polynomial ReadP...原创 2020-01-17 00:13:32 · 193 阅读 · 0 评论 -
03-树1 树的同构
#include <stdio.h>#define MaxTree 10 #define ElementType char #define Tree int #define Null -1 struct TreeNode { ElementType Element; Tree Left; Tree Right; } T1[MaxTree], T2...原创 2020-01-18 11:34:25 · 216 阅读 · 0 评论 -
03-树2 List Leaves
#include <stdio.h>#define MaxTree 10 #define ElementType char #define Tree int #define Null -1typedef struct QNode *Queue;typedef struct TreeNode Node; struct TreeNode { ElementType...原创 2020-01-18 15:07:01 · 111 阅读 · 0 评论 -
03-树3 Tree Traversals Again
#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <string.h> typedef int ElementType;#define MAX 30int pre[MAX], in[MAX], post[MAX];typedef int Position...原创 2020-01-29 17:50:07 · 123 阅读 · 0 评论 -
04-树4 是否同一棵二叉搜索树
#include <stdio.h>typedef struct TreeNode *Tree;struct TreeNode { int v; Tree Left, Right; int flag;};Tree MakeTree( int N );int Judge( Tree T, int N );void ResetT ( Tree T );void F...原创 2020-01-22 12:14:32 · 194 阅读 · 1 评论 -
04-树5 Root of AVL Tree
#include<stdio.h>typedef struct AVLNode *AVLTree; /* AVL树类型 */typedef int ElementType;struct AVLNode{ ElementType Data; /* 结点数据 */ AVLTree Left; /* 指向左子树 */ AVLTree Right; ...原创 2020-01-22 17:49:17 · 208 阅读 · 0 评论 -
04-树7 二叉搜索树的操作集
#include <stdio.h>#include <stdlib.h>typedef int ElementType;typedef struct TNode *Position;typedef Position BinTree;struct TNode{ ElementType Data; BinTree Left; BinTre...原创 2020-01-23 11:49:03 · 152 阅读 · 0 评论 -
05-树7 堆中的路径
#include <stdio.h>#define MAXN 1001 #define MINH -10001 int H[MAXN], size; void Create () { size = 0; H[0] = MINH; /*设置“岗哨”*/ } void Insert(int x){ ...原创 2020-01-26 15:15:07 · 114 阅读 · 0 评论 -
05-树8 File Transfer
#include <stdio.h>#define MaxSize 1000typedef int ElementType; /*默认元素可以用非负整数表示*/ typedef int SetName;/*默认用根结点的下标作为集合名称*/ typedef ElementType SetType[MaxSize];SetName Find( SetType S, Elem...原创 2020-01-26 17:18:11 · 116 阅读 · 0 评论 -
05-树9 Huffman Codes
#include <stdio.h>#include <stdlib.h>#define MinData 0typedef struct TreeNode* HuffmanTree;struct TreeNode{ int weight; HuffmanTree Left; HuffmanTree Right;};typedef struct He...转载 2020-01-26 20:24:04 · 129 阅读 · 0 评论 -
06-图1 列出连通集
#include <stdio.h>#define MAXN 10#define MAX 20#define false 0#define true 1typedef struct QNode *Queue;int G[MAXN][MAXN], Visited[MAXN], Nv, Ne;struct QNode{ int Data[MAX]; int rear...原创 2020-01-28 17:52:21 · 133 阅读 · 0 评论 -
06-图2 Saving James Bond - Easy Version
#include <stdio.h>#include <stdlib.h>#include <math.h>#include <stdbool.h>#define MaxVertexNum 100 /* 最大顶点数设为100 */typedef int Vertex; /* 用顶点下标表示顶点,为整型 */type...原创 2020-01-28 21:34:04 · 162 阅读 · 0 评论 -
06-图3 六度空间
#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#define MaxVertexNum 1000 #define MAX 20typedef int Vertex; /* 用顶点下标表示顶点,为整型 */typedef int WeightType; ...原创 2020-01-28 22:56:10 · 129 阅读 · 0 评论 -
Forwards on Weibo
#include <cstdio>#include <vector>#include <queue>using namespace std;int n, level, tn, t, m;vector<int> node[1005];int BFS(int root);int main(){ scanf("%d%d", &a...原创 2020-01-29 10:37:59 · 147 阅读 · 0 评论 -
07-图4 哈利·波特的考试
#include <stdio.h>#include <stdlib.h>#define MaxVertexNum 100 /* 最大顶点数设为100 */ #define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/ typedef int Vertex; /* 用顶点下标表示顶点,为整型*/ typedef i...原创 2020-01-31 11:42:13 · 122 阅读 · 0 评论 -
07-图5 Saving James Bond - Hard Version
#include <cstdio>#include <cstdlib>#include <cmath>#include <queue>#include <stack>#define MAX 105using namespace std;int N, D;int dist[MAX], path[MAX];struct ...原创 2020-01-31 23:56:30 · 134 阅读 · 0 评论 -
07-图6 旅游规划
#include <stdio.h>#include <stdlib.h>#define MaxVertexNum 500 /* 最大顶点数设为100 */#define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/typedef int Vertex; /* 用顶点下标表示顶点,为整型 */...原创 2020-02-01 11:55:54 · 201 阅读 · 0 评论 -
08-图7 公路村村通
#include <stdio.h>#include <stdlib.h> #define MaxVertexNum 1000 /* 最大顶点数设为1000 */#define INFINITY 65535 /* ∞设为双字节无符号整数的最大值65535*/typedef int Vertex; /* 用顶点下标表示顶点,为整...原创 2020-02-02 10:22:03 · 253 阅读 · 0 评论 -
08-图8 How Long Does It Take
#include <stdio.h>#include <stdlib.h> #include <stdbool.h>#define MaxVertexNum 100 /* 最大顶点数设为100 */typedef int Vertex; /* 用顶点下标表示顶点,为整型 */typedef int WeightType; ...原创 2020-02-02 19:15:10 · 221 阅读 · 0 评论 -
08-图9 关键活动
在原题上增加一组数据以测试程序,使其完整达到题目要求:输入样例2:8 101 2 41 3 32 4 53 4 34 5 14 6 64 7 45 8 56 8 27 8 4输出样例2:171->22->44->74->66->87->8#include <cstdio>#include <cstdl...原创 2020-02-03 13:17:52 · 182 阅读 · 0 评论 -
09-排序1 排序
#include <stdio.h>#include <stdlib.h> typedef int ElementType;#define MAX 100000void Bubble_Sort( ElementType A[], int N );void InsertionSort( ElementType A[], int N );void ShellSor...原创 2020-02-05 11:05:40 · 226 阅读 · 0 评论 -
09-排序2 Insert or Merge
#include <stdio.h>#include <stdlib.h> typedef int ElementType;#define MAX 100int B[MAX], length;int Judge(ElementType A[], int N);void InsertionSort( ElementType B[], int P ); void...原创 2020-02-05 19:36:50 · 158 阅读 · 0 评论 -
09-排序3 Insertion or Heap Sort
#include <stdio.h>#include <stdlib.h>typedef int ElementType;#define MAX 100int B[MAX];int Judge(ElementType A[], int N);void InsertionSort( ElementType B[], int P ); void HeapSort...原创 2020-02-05 20:19:17 · 145 阅读 · 0 评论 -
11-散列1 电话聊天狂人
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#define KEYLENGTH 11/* 关键词字符串的最大长度*/ #define MAXTABLESIZE 1000000#define MAXD 5 typedef char E...原创 2020-02-09 11:26:37 · 181 阅读 · 0 评论 -
11-散列2 Hashing
#include <stdio.h>#include <stdlib.h>#include <math.h>#define MAXTABLESIZE 10000 typedef int ElementType;typedef int Index; /* 散列地址类型*/typedef struct LNode *PtrToLNode; s...原创 2020-02-09 15:14:28 · 138 阅读 · 0 评论 -
11-散列3 QQ帐户的申请与登陆
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#define KEYLENGTH 17/* 关键词字符串的最大长度*/ #define MAXTABLESIZE 100000#define MAXD 5 typedef char El...原创 2020-02-09 19:53:27 · 219 阅读 · 0 评论 -
11-散列4 Hashing - Hard Version
#include<stdio.h>#include<vector>using namespace std;#define inf 65535#define MAX 1000int visit[MAX];int indegree[MAX];//入度 vector<int>adj[MAX];//邻接表 int main(){ int n,i,...原创 2020-02-09 23:20:03 · 180 阅读 · 0 评论
分享