
算法
文章平均质量分 85
iteye_5392
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Splay tree --扩展树
扩展树的C语言实现版本,这个是自上而下且节点带大小(size)的扩展树(伸展树)的具体实现。它由Daniel Dominic Sleator 和Robert Endre Tarjan,Tarjan在计算机算法领域,是个大师级别的人物,求强连通图的分量scc算法,很多基础的算法都是他发现的一个扩展树是自适应调整的二叉搜索树。其他常见的二叉搜索树有,AVL tree,red-black tree(红黑...原创 2012-12-25 16:20:46 · 527 阅读 · 0 评论 -
146 LRU Cache——leetcode
146LRU Cache这个基于双向链表+Map表第一步:分析LRU特点2大特点:保持顺序,即访问顺序FIFO。保持顺序的只有顺序类型如链表、数组快速查找,给定的KEY,能够快速查找的有:二叉搜索树、Hash表、跳表SkipList再细化各特点 《1》链表特点是:插入、删除、移动都是O(1)操作,随机访问O(N)《2》数组特点是:插入、删除...原创 2015-04-12 09:43:38 · 170 阅读 · 0 评论 -
56 Merge Intervals——leetcode
这个是基于排序库实现的56Merge Intervals/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int ...原创 2015-04-11 20:55:46 · 139 阅读 · 0 评论 -
57 Insert Interval——leetcode
57Insert Interval/** * Definition for an interval. * struct Interval { * int start; * int end; * Interval() : start(0), end(0) {} * Interval(int s, int e) : start(s)...原创 2015-04-11 20:52:03 · 163 阅读 · 0 评论 -
68 Text Justification——leetcode
68Text Justificationclass Solution {public:vector<string> fullJustify(vector<string> &words, int L) { if(words.empty()){ return words; }...原创 2015-04-11 20:39:13 · 174 阅读 · 0 评论 -
188 Best Time to Buy and Sell Stock IV——leetcode
class Solution {public: Solution(){} int maxProfit(int K, vector<int> &prices) { vector<int> lowVec; vector<int > highVec; if(price...原创 2015-04-11 20:29:49 · 188 阅读 · 0 评论 -
200 Number of Islands——leetcode
这个是图像中的填充技术,即选择一个种子,然后对其周边联通的的依次填充。代码未必最快,但很容易理解。算法复杂度O(M*N)空间复杂度O(M*N),最坏情况。算法说明:<1>初始化 访问标记<2>对每一个没有访问的cell,进行填充算法 填充算法:(使用栈)<1>设置初始种子,入栈<2>如果栈空,结束<...原创 2015-04-11 20:18:38 · 165 阅读 · 0 评论 -
程序生成组合C(N,K)输出
本来是想在网上搜索下现成的,结果看到一堆想吐的,尼玛啊,什么递归了,什么回溯了。无语!难道就不能负责任点,搜索下相关算法,然后,好好的实现下?又不是有多难的算法!最可恶的是,这些人还zhuangbility,以为自己写的算法很好,贴出来炫耀,有啥可炫耀的?数学简单道理N! <<<< N^N我把它看成N进制,全部生成一遍,去掉位数有重复的,必然是N!这样的排列...原创 2015-01-15 00:15:59 · 568 阅读 · 0 评论 -
BoxesDiv2——SRM 622 DIV2
import java.util.*;public class BoxesDiv2{ public BoxesDiv2(){} public int findSize(int[] candyCounts) { Arrays.sort(candyCounts); for(int i=0;i<candyCou...原创 2014-05-30 06:30:28 · 134 阅读 · 0 评论 -
MixingColors--SRM621 DIV2
Problem Statement for MixingColors Definition Class:MixingColorsMethod:minColorsParameters:int[]Returns:intMethod signature:...原创 2014-05-22 14:27:06 · 205 阅读 · 0 评论 -
梯度下降算法——notes
Andrew,Ng的学习笔记在希腊人的<<Pattren Recognition>>中的最入门的线性分类器中的感知器算法Perceptron使用的就是梯度下降法来迭代计算的。注:梯度下降用于找最小值,如果是增加,即梯度上升,则是找最大值。 ...原创 2014-05-15 22:34:06 · 168 阅读 · 0 评论 -
Problem A. Part Elf, Round 1C JAM,2014
Problem A. Part ElfThis contest is open for practice. You can try every problem as many times as you like, though we won't keep track of which problems you solve. Read the Quick-Start Guide to...原创 2014-05-12 11:31:34 · 120 阅读 · 0 评论 -
排序算法时间复杂度,稳定性综合一览表
原始图片来自于国外某人的博客 写道http://singaraju.com/blogs/gautam/files/2009/09/sorting1.jpg 比较次数 交换次数 空间类型稳定性statble适用范围 最优平均...原创 2014-05-11 08:53:12 · 1084 阅读 · 0 评论 -
道路匹配——稀疏数据轨迹点的匹配
道路匹配分析与设计出租车轨迹 由轨迹点序列组成<x,y,t>附带额外信息 speed,angle(GPS正北为0°,顺时针夹角,极坐标角度方向相反) 如何匹配轨迹?轨迹的匹配依赖于单点匹配,在单点匹配的基础上,涉及到两个点之间寻找合理轨迹(路径规划),错误GPS点剔除(模式分类),多点之间的相互验证(投票)。单点匹配单点匹配方式:由目前已知参数,忽略...原创 2012-12-25 17:05:32 · 2863 阅读 · 0 评论 -
41 First Missing Positive——leetcode
Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant spa...原创 2015-04-12 10:52:58 · 197 阅读 · 0 评论