摘要: 暑假,小哼准备去一些城市旅游。有些城市之间有公路,有些城市之间则没有,如下图。为了节省经费以及方便计划旅程,小哼希望在出发之前知道任意两个城市之前的最短路程。 上图中有4个城市8条公路,公路上的数字表示这条公路的长短。请注意这些公路是单向的。我们现在需要求任意两个城市之间的最短路程,也就是求任意两个 阅读全文
posted @ 2021-05-04 21:03 wind_bell 阅读(45) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstring> #include<string> #include<stdio.h> using namespace std; void print(int n,char *x,char *y) { if(n<=0) return; int 阅读全文
posted @ 2021-05-03 21:06 wind_bell 阅读(53) 评论(0) 推荐(0)
摘要: #include<iostream> #include<cstring> #include<cstdlib> using namespace std; typedef int TreeData; typedef struct node{ TreeData data; struct node * le 阅读全文
posted @ 2021-04-27 23:56 wind_bell 阅读(71) 评论(0) 推荐(0)
摘要: 最近的学习任务中,用到KMP算法,初次学习确实在过程中遇到了很多的困难,多方比对之后有了一点自己的心得体会。其实KMP算法的原理并不会很难,关键问题就在于模式串的回溯较难理解。 讲到KMP,不得不先提到暴力求解方法。在求字符串的子串匹配问题中,暴力求解是最简单易懂的,直观上就是当模式串和主串不相匹配 阅读全文
posted @ 2021-04-11 13:59 wind_bell 阅读(78) 评论(0) 推荐(0)