![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
图论
一起来玩玩呗
just to fun...
展开
-
贪心策略之最小生成树中的kruskal 算法
在算法设计里面一个重要的策略就是贪心算法。贪心算法较之于动态规划是每一步求得的解是当前局部最优的解,这样一步步求下去那么所得到的解就会无限接近于全局的最优解,在某些情况下会等于最优解。 在这里主要谈谈贪心策略中的最小生成树。在嵌入式设计中,我们都会用线将各个component 连接起来,这里我们要保证每一个component 的每一个针脚我们都必须连上,这里做一个合理的假设,假设图论中的每原创 2013-11-19 22:54:17 · 2812 阅读 · 6 评论 -
图论:回路判断和拓扑排序(DFS)
拓扑排序的定义是:将有向图中的顶点以线性方式进行排序。即对于任何连接自顶点u到顶点v的有向边uv,在最后的排序结果中,顶点u总是在顶点v的前面。适用范围:有向无环图(DAG),如果图中存在环路的话那么讨论就没有意义,当然在编程中需要对图是否有环进行判断。#include #include #include using namespace std;const int MAX = 5原创 2014-02-28 17:05:30 · 11248 阅读 · 3 评论 -
UVa 10054 - The Necklace 欧拉回路
Problem D: The Necklace My little sister had a beautiful necklace made of colorful beads. Two successive beads in the necklace shared a common color at their meeting point. The figure belo原创 2014-03-12 09:54:06 · 1005 阅读 · 1 评论 -
UVa 10596 - Morning Walk 有向图的欧拉回路
Problem HMorning WalkTime Limit3 Seconds Kamal is a Motashota guy. He has got a new job in Chittagong. So, he has moved to Chittagong from Dinajpur. He was getting fa原创 2014-03-12 10:39:46 · 1271 阅读 · 2 评论 -
UVa 10305 - Ordering Tasks 拓扑排序
Problem FOrdering TasksInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MB John has n tasks to do. Unfortunately, the tasks are not independent and the ex原创 2014-03-12 11:18:22 · 1093 阅读 · 2 评论 -
UVa 10129 - Play on Words 欧拉道路
Play on WordsSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzz原创 2014-03-11 19:56:37 · 1381 阅读 · 1 评论 -
poj 1419 Graph Coloring 图着色问题
Graph ColoringTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3829 Accepted: 1710 Special JudgeDescriptionYou are to write a program that tries to f原创 2014-03-19 20:02:19 · 1999 阅读 · 0 评论