
学习笔记之数据结构
文章平均质量分 81
MOOC上学习浙大陈越老师数据结构课程时的一些笔记和PTA作业,大家一起交流成长。
鸿雁丨红豆灬
这个作者很懒,什么都没留下…
展开
-
MOOC 数据结构 11-散列2 Hashing
PTA习题原创 2022-05-28 22:54:13 · 163 阅读 · 0 评论 -
MOOC 数据结构 09-排序2 Insert or Merge
PTA习题原创 2022-05-26 11:25:52 · 174 阅读 · 0 评论 -
数据结构 排序 (图解+C语言)
排序原创 2022-05-20 23:45:18 · 1314 阅读 · 0 评论 -
数据结构 拓扑排序拓展 如何判断DAG
有向无环图 DAG(Directed Acyclic Graph)在学习拓扑排序的时候,我们知道如果一个有向图存在合理的拓扑序,那么这个图一定是DAG;以下是拓扑排序的伪码描叙:伪码描叙: void TopSort() { for(图中的每一个顶点V){ if(Indegree[V]==0){ AddQ( Q,V ); }} while(IsEmpty( Q )){ V = DeleteQ( Q ); 输出V,或者记录V的输出序号;cnt++; for(V 的原创 2022-05-17 13:07:14 · 828 阅读 · 0 评论 -
MOOC 数据结构 08-图8 How Long Does It Take——C语言
DAG,拓扑排序原创 2022-05-17 11:07:00 · 670 阅读 · 0 评论 -
MOOC 数据结构 08-图7 公路村村通——C语言
Prim,Kruskal原创 2022-05-15 18:24:48 · 708 阅读 · 0 评论 -
数据结构 Dijkstra算法 改良版 多条最短路径问题通用解决方案——C语言实现
Dijkstra,多条最短路径问题原创 2022-05-13 11:36:47 · 2105 阅读 · 0 评论 -
MOOC 数据结构 1003 Emergency
Dijkstra算法;多条最短路径问题原创 2022-05-12 19:15:36 · 423 阅读 · 0 评论 -
MOOC 数据结构 07-图6 旅游规划
有了一张自驾旅游路线图,你会知道城市间的高速公路长度、以及该公路要收取的过路费。现在需要你写一个程序,帮助前来咨询的游客找一条出发地和目的地之间的最短路径。如果有若干条路径都是最短的,那么需要输出最便宜的一条路径。输入格式:输入说明:输入数据的第1行给出4个正整数N、M、S、D,其中N(2≤N≤500)是城市的个数,顺便假设城市的编号为0~(N−1);M是高速公路的条数;S是出发地的城市编号;D是目的地的城市编号。随后的M行中,每行给出一条高速公路的信息,分别是:城市1、城市2、高速公路长度、收费额原创 2022-05-10 10:57:23 · 2382 阅读 · 0 评论 -
MOOC 07-图4 哈利·波特的考试
哈利·波特要考试了,他需要你的帮助。这门课学的是用魔咒将一种动物变成另一种动物的本事。例如将猫变成老鼠的魔咒是haha,将老鼠变成鱼的魔咒是hehe等等。反方向变化的魔咒就是简单地将原来的魔咒倒过来念,例如ahah可以将老鼠变成猫。另外,如果想把猫变成鱼,可以通过念一个直接魔咒lalala,也可以将猫变老鼠、老鼠变鱼的魔咒连起来念:hahahehe。现在哈利·波特的手里有一本教材,里面列出了所有的变形魔咒和能变的动物。老师允许他自己带一只动物去考场,要考察他把这只动物变成任意一只指定动物的本事。于是他来原创 2022-05-08 11:34:20 · 309 阅读 · 0 评论 -
MOOC PTA 1076 Forwards on Weibo
Weibo is known as the Chinese version of Twitter. One user on Weibo may have many followers, and may follow many other users as well. Hence a social network is formed with followers relations. When a user makes a post on Weibo, all his/her followers can vi原创 2022-05-04 20:56:13 · 284 阅读 · 0 评论 -
MOOC 06-图3 六度空间
“六度空间”理论又称作“六度分隔(Six Degrees of Separation)”理论。这个理论可以通俗地阐述为:“你和任何一个陌生人之间所间隔的人不会超过六个,也就是说,最多通过五个人你就能够认识任何一个陌生人。”如图1所示:“六度空间”理论虽然得到广泛的认同,并且正在得到越来越多的应用。但是数十年来,试图验证这个理论始终是许多社会学家努力追求的目标。然而由于历史的原因,这样的研究具有太大的局限性和困难。随着当代人的联络主要依赖于电话、短信、微信以及因特网上即时通信等工具,能够体现社交网原创 2022-05-04 16:15:40 · 300 阅读 · 0 评论 -
MOOC 07-图5 Saving James Bond - Hard Version
This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he原创 2022-05-09 13:02:58 · 672 阅读 · 0 评论 -
MOOC 06-图2 Saving James Bond - Easy Version
This time let us consider the situation in the movie "Live and Let Die" in which James Bond, the world's most famous spy, was captured by a group of drug dealers. He was sent to a small piece of land at the center of a lake filled with crocodiles. There he原创 2022-05-03 14:36:32 · 359 阅读 · 0 评论 -
MOOC 05-树9 Huffman Codes
哈夫曼树、哈夫曼编码原创 2022-04-24 22:09:29 · 509 阅读 · 0 评论 -
MOOC 课后讨论5.2 判别是否是前缀码的算法
问题:如何判断一个字符集是否采用前缀码【重要】前缀码:任何一个字符的编码都不是同一个字符集中另一个字符的编码的前缀对于给出的一个字符集,请判断这个字符集是否是前缀码;InputSpecification:输入包含若干行测试数据。每组数据的第一行给出正整数N 为该字符集的字符个数 和MAXbit 为该编码最多位数 随后给出N行 每行为该字符集每个字符的二进制编码OutputSpecification:如果该字符集是前缀码,输出"Yes"否则输出"No"Sample Inp...原创 2022-04-20 21:29:15 · 1492 阅读 · 0 评论 -
MOOC 04-树6 Complete Binary Search Tree
A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties:The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater th原创 2022-04-18 23:51:34 · 458 阅读 · 0 评论 -
MOOC 04-树5 Root of AVL Tree
MOOC TPA作业 学习笔记原创 2022-04-16 10:25:58 · 296 阅读 · 0 评论 -
MOOC 04-树4 是否同一棵二叉搜索树
MOOC,PTA作业原创 2022-04-14 23:13:11 · 201 阅读 · 0 评论 -
MOOC 03-树3 Tree Traversals Again
An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stack operations are: push(1); push(2); push(3); pop(); pop(原创 2022-05-05 14:23:18 · 622 阅读 · 0 评论 -
MOOC 02-线性结构3 Reversing Linked List
MOOC 数据结构 学习笔记原创 2022-04-05 18:04:53 · 1217 阅读 · 0 评论