做OJ需要用到搜索最短路径的题,于是整理了一下关于图的搜索算法: 图的搜索大致有三种比较常用的算法: 迪杰斯特拉算法(Dijkstra算法) 弗洛伊德算法(Floyd算法) SPFA算法 Dijkstra算法使用了广度优先搜索解决赋权有向图或者无向图的单源最短路径问题,算法最终得到一个最短路径树。 ...
分类:
编程语言 时间:
2018-11-15 18:27:24
阅读次数:
229
Description Description Find K-th largest element in an array. Example In array [9,3,2,4,8], the 3rd largest element is 4. In array [1,2,3,4,5], the 1 ...
分类:
其他好文 时间:
2018-11-13 13:03:33
阅读次数:
144
https://leetcode.com/problems/pascals-triangle-ii/description/ Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's tri ...
分类:
其他好文 时间:
2018-11-10 12:53:57
阅读次数:
182
一、行为树 行为树是一种控制结构,在相关论文资料中通常会与有限状态机进行比较,并认为其比有限状态机更适合复杂条件下的控制,目前多用于游戏开发中(主要用于NPC行为),工业领域的应用研究正逐渐增多,主要面向移动机器人/AGV/无人驾驶等等。 相关论文资料可以参考:http://kth.diva-por ...
分类:
编程语言 时间:
2018-11-06 15:14:37
阅读次数:
537
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th... ...
分类:
其他好文 时间:
2018-11-06 11:16:38
阅读次数:
156
Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table? Given the ... ...
分类:
其他好文 时间:
2018-11-06 11:09:22
阅读次数:
109
分析 难度 易 来源 https://leetcode.com/problems/pascals-triangle-ii/ 题目 Given a non-negative index k where k ≤ 33, return the kth index row of the Pascal's t ...
分类:
其他好文 时间:
2018-11-02 13:02:18
阅读次数:
122
【23】 Merge k Sorted Lists 【215】 Kth Largest Element in an Array (无序数组中最小/大的K个数) 给了一个无序数组,可能有重复数字,找到第 k 个最大的元素并且返回这个元素值。 题解:直接用直接用个堆保存数组中最大的 K 个数。时间复杂度 ...
分类:
其他好文 时间:
2018-10-30 00:26:09
阅读次数:
207
SP913 QTREE2 Query on a tree II 给定一棵n个点的树,边具有边权。要求作以下操作: DIST a b 询问点a至点b路径上的边权之和 KTH a b k 询问点a至点b有向路径上的第k个点的编号 有多组测试数据,每组数据以DONE结尾。 裸的LCA。 在处理第二个操作时 ...
分类:
其他好文 时间:
2018-10-27 00:26:08
阅读次数:
439
Description 给定一棵n个点的树,边具有边权。要求作以下操作: DIST a b 询问点a至点b路径上的边权之和 KTH a b k 询问点a至点b有向路径上的第k个点的编号 有多组测试数据,每组数据以DONE结尾。 Input 第一组数据包含一个整数$T$,代表有$T$组测试数据。$1\ ...
分类:
其他好文 时间:
2018-10-20 22:09:26
阅读次数:
216