摘要: 动态规划法: 用二维矩阵来的每个元素来代表两个字符串的字符匹配情况, LCS[i, j]= LCS[i-1, j-1] + 1 , if X[i-1] == Y[J-1]. LCS[i, j] =0, everything else 每一个元素记载着两个字符串的相似程度,而且每个元素只需关心上一个元 阅读全文
posted @ 2018-03-18 08:39 xuyanran 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Tips Dijstra algorithm can help you to find all shortest path from start node to all other nodes. Core logic calculate the shortest path from start no 阅读全文
posted @ 2018-03-15 14:04 xuyanran 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Interface AddVertex(T data) AddEdge(int from, int to) DFS BFS MST TopSort PrintGraph 阅读全文
posted @ 2018-03-11 09:43 xuyanran 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Overview 知识点: 1. delete函数的signature public AVLTreeNode Delete(AVLTreeNode node, int key) 3. 旋转: 左旋和右旋逻辑和插入是一致的。 Source Code 阅读全文
posted @ 2018-02-26 05:46 xuyanran 阅读(331) 评论(0) 推荐(0) 编辑
摘要: Recursion Recursion Design Data Structure Source Code Complexity Time complexity is O(N) Space complexity is O(N) 阅读全文
posted @ 2018-02-26 05:27 xuyanran 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 思路 二叉搜索树的插入 TreeNode InsertRec(rootNode, key) = if rootNode == NULL, return new Node(key) if key >= rootNode.data, rootNode.rightChild = InsertRec(roo 阅读全文
posted @ 2018-02-25 10:45 xuyanran 阅读(360) 评论(0) 推荐(0) 编辑
摘要: Overview AVL tree is a special binary search tree, by definition, any node, its left tree height and right tree height difference is not more than 1. 阅读全文
posted @ 2018-02-20 03:22 xuyanran 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Managed Heaps In general it can be categorized into 1) SOH and 2) LOH. size lower than 85K will be in SOH, size larger than 85K will be in LOH. Small 阅读全文
posted @ 2018-02-19 05:05 xuyanran 阅读(161) 评论(0) 推荐(0) 编辑
摘要: Heap Sort Heapify Heapify(array, n, i) = 1) compare node[i] with children 2)node[i] is already the largest one, no op. 3) child is largest one, swap, 阅读全文
posted @ 2018-02-05 03:21 xuyanran 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 排序分类如下: 阅读全文
posted @ 2018-01-29 10:52 xuyanran 阅读(156) 评论(0) 推荐(0) 编辑