图
文章平均质量分 72
jmspan
这个作者很懒,什么都没留下…
展开
-
LeetCode 261. Graph Valid Tree(判断图是否为树)
原题网址:https://leetcode.com/problems/graph-valid-tree/Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these原创 2016-04-10 06:50:47 · 8097 阅读 · 0 评论 -
LeetCode 317. Shortest Distance from All Buildings(最短建筑距离)
原题网址:https://leetcode.com/problems/shortest-distance-from-all-buildings/You want to build a house on an empty land which reaches all buildings in the shortest amount of distance. You can only原创 2016-04-23 09:18:04 · 3446 阅读 · 0 评论 -
HackerRank Breadth First Search: Shortest Reach
原题网址:https://www.hackerrank.com/challenges/bfsshortreachGiven an undirected graph consisting of nodes (labelled 1 to N) where a specific given node represents the start position and原创 2016-06-23 08:08:43 · 917 阅读 · 0 评论 -
图论相关问题(提纲)
一、欧拉图(七桥问题)七桥问题:给定一个图,能否从某个顶点出发,不重复地遍历所有的边,并且回到起点。欧拉图:图G是欧拉图的充要条件是,G连通且没有奇定顶点。二、一笔画问题。一个图能一笔画成的充要条件是,图G连通且奇顶点数为0或2.一笔画算法参考:http://blog.csdn.net/jmspan/article/details/51279044三、哈密尔原创 2016-06-18 01:07:44 · 1214 阅读 · 0 评论 -
LeetCode 310. Minimum Height Trees(最小高度树)
原题网址:https://leetcode.com/problems/minimum-height-trees/For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all po原创 2016-04-21 06:51:54 · 2952 阅读 · 0 评论 -
LeetCode 269. Alien Dictionary(外星人字典)
原题网址:https://leetcode.com/problems/alien-dictionary/There is a new alien language which uses the latin alphabet. However, the order among letters are unknown to you. You receive a list of words原创 2016-04-13 02:23:36 · 5315 阅读 · 0 评论 -
LeetCode 332. Reconstruct Itinerary(重构行程)
原题网址:https://leetcode.com/problems/reconstruct-itinerary/Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order.原创 2016-04-29 08:06:51 · 1568 阅读 · 0 评论 -
关于图的常用算法——Dijkstra单源最短路径、Floyd多源最短路径、Prim和Kruskal最小生成树算法
Dijkstra最短路径算法是计算某一点到其它点的最短距离的算法。Floyd算法是用来计算图中所有点之间的最短距离,可参考:http://developer.51cto.com/art/201403/433874.htm最小生成树(Minimium Spanning Tree)如果要在N个城市中铺设网络,每个城市之间的网络建设成本不同,如何找到一个建设方案,使得原创 2016-06-10 15:29:52 · 5098 阅读 · 0 评论 -
LeetCode 323. Number of Connected Components in an Undirected Graph(连通分量)
原题网址:https://leetcode.com/problems/number-of-connected-components-in-an-undirected-graph/Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), wr原创 2016-04-25 02:50:21 · 2117 阅读 · 0 评论 -
LeetCode 210. Course Schedule II(课程安排)
原题网址:https://leetcode.com/problems/course-schedule-ii/There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take cour原创 2016-05-04 17:09:45 · 778 阅读 · 0 评论 -
LeetCode 207. Course Schedule(课程安排)
原题网址:https://leetcode.com/problems/course-schedule/There are a total of n courses you have to take, labeled from 0 to n - 1.Some courses may have prerequisites, for example to take course原创 2016-05-04 10:03:07 · 971 阅读 · 0 评论 -
LeetCode 133. Clone Graph(克隆图)
原题网址:https://leetcode.com/problems/clone-graph/Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors.OJ's undirected graph serialization:Nodes ar原创 2016-05-27 00:22:58 · 797 阅读 · 0 评论 -
LeetCode 463. Island Perimeter
原题网址:https://leetcode.com/problems/island-perimeter/You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizon原创 2016-11-21 04:00:43 · 1472 阅读 · 0 评论