码迷,mamicode.com
首页 >  
搜索关键字:算法    ( 83296个结果
LeetCode: Word Search [079]
【题目】 Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be use...
分类:其他好文   时间:2014-06-03 01:07:58    阅读次数:329
最小生成树算法汇总 (普里姆 && 克鲁斯卡尔与并查集结合)
最小生成树 普里姆&& 克鲁斯卡尔 图形事例构造 并查集...
分类:其他好文   时间:2014-06-03 00:17:56    阅读次数:332
普林斯顿公开课 算法1-1:算法分析
为什么要分析算法 分析算法可以预测算法的性能,比较算法之间的优劣,保证算法的正确性,理解算法的理论基础。 成功算法的例子 离散傅立叶变换,如果使用暴力方法,那么算法的复杂度是是N^2,如果使用FFT快速傅立叶变换可以实现O(N logN)复杂度 N-body模拟:使用Barnes-hut算法可以将复杂度降低到N logN ...
分类:其他好文   时间:2014-06-03 00:10:12    阅读次数:364
LeetCode: Partition List [086]
【题目】 Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the original relative order of the nodes in each of the two partitions. For example, Given 1->4->3-...
分类:其他好文   时间:2014-06-03 00:02:29    阅读次数:270
[考研系列之数据结构]线性表之字符串
基本概念 串(字符串)  由0个或多个字符组成的有限序列,例如s="hello world" 串名  上例中的s 子串  某串任意连续字符组成的子序列,称为此字符串的子串 空串  0个字符的串,s="" 空格串  由一个或多个字符组成的串 模式匹配算法 ...
分类:其他好文   时间:2014-06-02 23:28:56    阅读次数:305
普林斯顿公开课 算法1-2:观察
这章通过一个简单的例子,详细说明算法分析的步骤。 算法 问题 给定N个不同的整数,从中任意取出三个整数。请问有几种情况,使得取出的3个整数之和为0? 解法 可以使用暴力算法,代码如下: 1 2 3 4 5 6 7 8 9 for(int i=0;...
分类:其他好文   时间:2014-06-02 23:18:43    阅读次数:320
LeetCode: Maximal Rectangle [085]
【题目】 Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area. 【题意】 给定一个由0和1填充的二维矩阵,找一个全是1的最大矩形 【思路】 扫描二维矩阵,凡是扫到值为1的块时候,以当前块为矩形的左上角区块拓展,找最大矩阵。 先找出以每个“1”区块为左上角区块的最大矩形,然后求出最大全局的最大矩...
分类:其他好文   时间:2014-06-02 23:08:07    阅读次数:289
[考研系列之数据结构]线性表之栈
?基本概念 栈的定义 限定仅在表尾进行插入或删除的线性表 组成 栈顶 栈底 基本操作 入栈(PUSH) 往栈中插入一个元素 弹栈(POP) 从栈顶删除一个元素 栈的表示 顺序栈 链栈 对于顺序栈,有两...
分类:其他好文   时间:2014-06-02 22:28:26    阅读次数:337
普林斯顿公开课 算法1-3:数学模型
本节主要通过建立数学模型,来计算算法的运行时间。 公式 算法的运行时间=所有操作的开销乘以操作的次数之和 开销 下表展示了各种操作所需要的时间(单位:纳秒) 整数加法 2.1 整数乘法 2.4 整数除法 5.4 浮点加法 4.6 浮点乘法 4.2 浮点除法 13.5 sin 91.3 ...
分类:其他好文   时间:2014-06-01 10:42:00    阅读次数:228
每日算法之二十二:Swap Nodes in Pairs
Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you should return the list as 2->1->4->3. Your algorithm should use only constant space....
分类:其他好文   时间:2014-06-01 10:41:23    阅读次数:242
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!