- 博客(9)
- 收藏
- 关注
原创 Leetcode: Word Break
Word Break Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words. For example, given s = “leetcode”,
2015-05-17 03:15:27
302
原创 Leetcode: Wildcard Matching
Problem Problem: ‘?’ Matches any single character. ‘*’ Matches any sequence of characters (including the empty sequence). The matching should cover the entire input string (not partial).
2015-05-16 14:16:32
348
原创 Leetcode : Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum. For example, given the array [−2,1,−3,4,−1,2,1,−5,4], the contiguous subarray [4,−1,2,1] h
2015-05-16 00:29:48
295
原创 Leetcode 48: Rotate Image
Problem: You are given an n x n 2D matrix representing an image. Rotate the image by 90 degrees (clockwise). Follow up: Could you do this in-place? 利用处于中心的极坐标变换: (r′t,θ′t)=(r,θ−π/2)(r_t
2015-05-15 23:59:06
304
原创 Leetcode No.50: Pow(x, n)
Problem: Implement pow(x, n). 想法是是利用二分法,先算出xi,i≤nx^i, i \leq n, 剩下的递归求解。__author__ = 'burger'class Solution: # @param {float} x # @param {integer} n # @return {float} def myPow(self
2015-05-15 21:24:49
540
转载 最长单调递增子序列
来自十五章动态规划两个练习题15.4-5 15.4-6O(n2)O(n^2)算法初步的方法是O(n2)O(n^2)的算法。God Xu 指点我: - 令Y = sort(X) - 求X、Y的最长公共子序列O(nlgn)O(n \lg n)算法下一题要求用O(nlgn)O(n \lg{n}) 时间的算法,经过查阅资料, 得到如下算法:__author__ = 'burger'#用二分搜索找最大
2015-05-15 12:35:56
385
转载 任务调度问题
优先级限制下的任务调度问题解决并行任务任务调度问题的关键路径方法: 创建一幅无环加权有向图GG: 创建一幅无环加权有向图,包含起点ss和终点tt; 对每个任务题阿佳一条从起始顶点指向它的结束顶点的边,权重位任务所需的时间; 对每个优先级限制v→wv\to w,调价一条从v的结束顶点指向w起始顶点边,权重为00; 添加从s指向每个起始顶点的边,权重为00; 添加从每个结束顶点指向t的边,权重为00;
2015-05-13 11:25:17
992
翻译 Algs4_5.4 Regular Expressions
非确定有限状态自动机 当且仅当一个NFA从状态0开始从头读去了一段文本中的所有字符,进行了一系列状态转换,并最终到达了接受状态时,则称该NFA识别了一个文本字符串。 5 模拟NFA的运行5.1 自动机的表示用char数组re[]表示正则表达式本身,也表达了匹配转换。使用有向图GG表示所有不读取字符的转换(ϵ\epsilon-转换)5.2 NFA的模拟与可达性纪录自动机在检查当前输入字符时可能遇到
2015-05-09 21:52:18
434
翻译 ALGS4_5.2 Tries
Tries PropertiesTrie Symbol Table Proposition F. Properties of tries The linked structure(shape) of a trie is in dependent of the key insertion/deletion order: there is a unique trie for any giver set
2015-05-08 20:13:31
436
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人