自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(19)
  • 收藏
  • 关注

转载 Find Longest common string

动态规划法: 用二维矩阵来的每个元素来代表两个字符串的字符匹配情况, LCS[i, j]= LCS[i-1, j-1] + 1 , if X[i-1] == Y[J-1]. LCS[i, j] =0, everything else 每一个元素记载着两个字符串的相似程度,而且每个元素只需关心上一个元素的值来计算字符串比较的累计情况。 实现代码: ...

2018-03-18 08:39:00 158

转载 Dijkstra 算法

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 node to all adjacent node. Get the ...

2018-03-15 14:04:00 143

转载 Adjacency matrix based Graph

Interface AddVertex(T data) AddEdge(int from, int to) DFS BFS MST TopSort PrintGraph using System; using System.Collections.Generic; using System.Linq; namespace TestCase1.Tes...

2018-03-11 09:43:00 177

转载 AVL Tree Deletion

Overview 知识点: 1. delete函数的signature public AVLTreeNode Delete(AVLTreeNode node, int key) 2. 算法,如何删除节点:           // 如果左右节点都为空,node = null          // 如果一个为空,另一个字节点不为空,把node节点替换成不为空的字节点   ...

2018-02-26 05:46:00 220

转载 Deepest left leaf node in a binary tree

Recursion selfcontained recursion global variables outside of recursion Recursion Design Whenever reach to a qualified node, record the node reference and level for that node if meet ...

2018-02-26 05:27:00 132

转载 二叉搜索树(BST)的插入和删除递归实现

思路 二叉搜索树的插入 TreeNode InsertRec(rootNode, key) =     if rootNode == NULL, return new Node(key)     if key >= rootNode.data, rootNode.rightChild = InsertRec(rootNode.rightChild, key) ...

2018-02-25 10:45:00 338

转载 AVL Tree Insertion

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. The purpose of AVL tree is to try best to re...

2018-02-20 03:22:00 640

转载 .Net memory management Learning Notes

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 Object Heap GC will do 1) Mark 2) Sweep 3...

2018-02-19 05:05:00 131

转载 Heap Sort - recursion

Heap Sort Build a max heap using exsiting array, which is called Heapify Swap root with the last element, and re-Heapify the root node Heapify Heapify(array, n, i) = 1) compare node[i] w...

2018-02-05 03:21:00 112

转载 外排序

排序分类如下: 内排序 基本排序 (冒泡,选择,插入) 高级排序 (归并排序,快速排序, 堆排序) 外排序 外存和内存相结合的排序 转载于:https://www.cnblogs.com/xuyanran/p/8376252.html...

2018-01-29 10:52:00 124

转载 Quick Sort

快排在大规模元素(》100)被证明几乎是效率最高的排序方法, 也是一种分而治之算法的一个典型应用。 快排的思想是: 1)每次选定一个元素作为pivot, 利用pivot对数组进行分区(partition) 2) 大的放在pivot的后面,小的放在pivot前面 3)递归的对新生成的两个分区进行快排 代码如下: public class QuickSortCl...

2018-01-27 14:39:00 148

转载 Merge Sort

Merge Sort 的递归实现, 同时也是算法里面常见的分而治之方法。 先放上一段分而治之的算法定义, 一张图胜过千言万语。 sort 整个数组 = sort 前半个数组, then sort后半个数组, then merge两个有序数组。 merge整个有序数组是非递归程序,输入有array本身,left, middle 和 right 左半数组长度,有半数组...

2018-01-25 14:06:00 119

转载 中缀表达式和后缀表达式学习心得

中缀表达式(Infix expression)即符合a op b的格式, 后缀表达式(Post Fix expression)即符合a b op 的格式。为什么要有后缀表达式?原因在于后缀表达式可以很容易的被计算机理解。 举个例子,a*(b+c)/d, 转化为后缀表达式是abc+*d/, 计算机会用栈来解释执行该表达式。 如果我是计算机,对于后缀表达式输入,会做如下事情: co...

2018-01-16 13:13:00 538

转载 Post Order traverse binary tree using non-recursive way

Process analysis      Stack = 5,  Push 3, Stack = 5, 3. Pre = 5 Current = 3, Pre = 5, Push 2 to the stack, stack = 5, 3, 2, Pre = 3 Current = 2, Pre = 3, pop 2, PRINT 2, Stack = 5, 3....

2018-01-15 11:47:00 223

转载 Binary Search Tree Learning Summary

BST Definition BST is short for Binary Search Tree, by definition, the value of right node is always greater or equal to the root node, the value of left node is always less than the root node. ...

2018-01-14 09:00:00 109

转载 反转链表的递归与非递归实现

反转链表也是面试时常问到的题目,题目听上去很简单,想要快速正确的写出来,也确实需要很扎实的基本功。 这类简单的题目既有非递归的实现方法,也有递归的实现方法。 非递归实现 非递归实现,模拟的是基本的手动操作, 访问链表中的每一个节点,但是同时要记住当前被访问节点的上一个和下一个节点。这三个指针构成了一个滑动的窗口,当前的值是滑动窗口的中心,上一个节点最终会变成新链表的头节点...

2018-01-07 08:27:00 130

转载 循环双向链表

第一次用C#描述链表,和大学时用C++ 描述链表的感觉很一致,用visual studio很快就可以实现单向链表,双向链表, 和循环链表。 The reference type of C# is a key, and play the same role as pointer in C++. 上一段自己写的循环链表代码,单元测试都已经通过。 using System; usi...

2018-01-06 10:57:00 151

转载 Spell checker using hash table

Problem description Given a text file, show the spell errors from it. (https://www.andrew.cmu.edu/course/15-200/s06/applications/labs/lab3/) Psuedo Code The Dictionary Hash Table (Error Det...

2018-01-01 13:24:00 170

转载 HashTable

HashTable 主要包含: Hash(string key), 先计算hash后计算余数, 对于string而言,把每一位char的ASCII码叠加起来。 sum = sum*37 + char[i], sum%data.length, 要考虑负余数的情况 Insert(string key), 调用hash()拿到index, 存值至bucket Delete(stri...

2017-12-30 01:11:00 106

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除