随笔分类 -  Intruduction to Algorithms

摘要:Dijkstra算法 又称迪杰斯特拉算法,是一个经典的最短路径算法,主要特点是以起始点为中心向外层层扩展,直到扩展到终点为止,使用了广度优先搜索解决赋权有向图的单源最短路径问题,算法最终得到一个最短路径树。时间复杂度为O(N^2) 执行动画: 实例: 抽象步骤: 1.将起点A放入集合中,A点的权值为 阅读全文

posted @ 2017-07-17 11:20 Wujunde 阅读(134) 评论(0) 推荐(0)

摘要:Kruskal’s algorithm always union the lightest link if two sets haven't been linked Prim’s algorithm maintain a key of each vertex to represent the lig 阅读全文

posted @ 2017-07-13 16:15 Wujunde 阅读(154) 评论(0) 推荐(0)

摘要:拓扑排列可以指明除了循环以外的所有指向,当反过来还有路可以走的话,说明有刚刚没算的循环路线,所以反过来能形成的所有树都是循环 阅读全文

posted @ 2017-07-10 22:13 Wujunde 阅读(296) 评论(0) 推荐(0)

摘要:A topological sortof a dag G is a linear ordering of all its vertices such that if G contains anedge(u,v) then u appears before  in the ordering. (If 阅读全文

posted @ 2017-07-10 21:34 Wujunde 阅读(140) 评论(0) 推荐(0)

摘要:Besides creating a depth-first forest, depth-first search also timestamps each vertex.Each vertex  has two timestamps: the first timestamp :d record 阅读全文

posted @ 2017-07-10 21:16 Wujunde 阅读(323) 评论(0) 推荐(0)

摘要:given a graph G and a distinguished source vertex s, breadth-firstsearch systematically explores the edges of G to “discover” every vertex that isreac 阅读全文

posted @ 2017-07-07 22:04 Wujunde 阅读(166) 评论(0) 推荐(0)

摘要:We can choose between two standard ways to represent a graph as a collection of adjacency lists or as an adjacency matrix. Either way appliesto both d 阅读全文

posted @ 2017-07-07 22:00 Wujunde 阅读(202) 评论(0) 推荐(0)

摘要:MAKE-SET.x/ creates a new set whose only member (and thus representative) is x. Since the sets are disjoint, we require that x not already be in some 阅读全文

posted @ 2017-07-06 16:17 Wujunde 阅读(426) 评论(0) 推荐(0)

摘要:van Emde Boas trees 支持所有优先级优先级队列的操作,并且巧妙的是它对于SEARCH, INSERT,DELETE,MINIMUM,MAXMUN,SUCCESSOR,和PREDECESSOR这些操作的支持都在最坏复 杂度O(lglgn)之内。不过有些限制的是,所有的Kye值都必须在 阅读全文

posted @ 2017-06-28 20:11 Wujunde 阅读(1049) 评论(0) 推荐(0)

摘要:Mergeable heapsA mergeable heap is any data structure that supports the following five operations,in which each element has a key:MAKE-HEAP./ creates 阅读全文

posted @ 2017-06-28 15:02 Wujunde 阅读(232) 评论(0) 推荐(0)

摘要:B-trees are balanced search trees designed to work well on disks or other direct accesssecondary storage devices. B-trees are similar to red-black tre 阅读全文

posted @ 2017-06-28 15:02 Wujunde 阅读(305) 评论(0) 推荐(0)

摘要:present a file by binary character code,let the less characters can be presented simplier. 阅读全文

posted @ 2017-06-25 01:25 Wujunde 阅读(178) 评论(0) 推荐(0)

摘要:many activities will use the same place, every activity ai has its' start time si and finish time fi.let the number of activities to be as many as pos 阅读全文

posted @ 2017-06-24 14:01 Wujunde 阅读(225) 评论(0) 推荐(0)

摘要:to calculate the min step of multiplicate some matixs 阅读全文

posted @ 2017-06-21 22:47 Wujunde 阅读(265) 评论(0) 推荐(0)

摘要:for a rod of length i the price of it si pi,to cut the rod to earn more money 阅读全文

posted @ 2017-06-21 22:42 Wujunde 阅读(180) 评论(0) 推荐(0)

摘要:1 public class redbalcktree { 2 3 private class Node{ 4 private int val; 5 private int key; 6 boolean color; //black true 7 pri... 阅读全文

posted @ 2017-06-12 23:34 Wujunde 阅读(158) 评论(0) 推荐(0)

摘要: 阅读全文

posted @ 2017-06-12 23:22 Wujunde 阅读(117) 评论(0) 推荐(0)

摘要:1 public class binarytree { 2 private Node root = null; 3 private class Node{ 4 private Value val; 5 private int key; 6 private N... 阅读全文

posted @ 2017-06-11 22:17 Wujunde 阅读(120) 评论(0) 推荐(0)

摘要:1 public class opendressinghash { 2 private static final int INIT_CAPACITY = 4; 3 4 private int n; 5 private int m; 6 private Key[] ke... 阅读全文

posted @ 2017-06-11 22:15 Wujunde 阅读(182) 评论(0) 推荐(0)

摘要: 阅读全文

posted @ 2017-06-11 22:12 Wujunde 阅读(128) 评论(0) 推荐(0)