算法
文章平均质量分 75
排山和倒海
这个作者很懒,什么都没留下…
展开
-
《大话数据结构》总结一下
之前老婆的购书福利买了一些书,买了一本《大话数据结构》,这个假期有时间看了一下。说实话,书一般,不太适合计算机科班的人看,插科打诨的内容比较多,有些内容不太严谨。前面的内容还好,后面就一般了,比如KMP算法,到了图相关的内容就放飞了。另外数据结构的一些内容,还是需要自己好好磨着性子看一下,转化成自己的理解的东西。也整理下自己看的内容。1,正本书的结构2,几个内容整理KM...原创 2020-01-29 21:41:13 · 480 阅读 · 0 评论 -
Reverse Bits以及补码原码和python的相关操作
题目是这么说的:Reverse bits of a given 32 bits unsigned integer.意思是反转一个unsigned的整形,之前我没看到这个地方,所以走了一些弯路,这个题目在leetcode是属于简单类型的。python来做是非常简单的class Solution: def reverseBits(self, n: int) -> int...原创 2020-01-15 17:40:08 · 227 阅读 · 0 评论 -
leetcode:两个有序数组的中位数
一个好题目:两个有序数组,输出这两个有序数组合并后的中位数,要求复杂度为O(log (m+n)).https://zhuanlan.zhihu.com/p/39129143很经典的讲解,将问题最后解析为数学问题,控制变量法为单变量,就不那么复杂了。学到了,这个题目在很多领域都有应用,特别是在大数据情况下的,分治的思想todo:自己的理解class Solution: ...原创 2020-01-05 23:47:51 · 137 阅读 · 0 评论 -
数据结构-梳理
先从B+B-树开始,各种烦人的树原创 2014-09-27 21:52:43 · 1033 阅读 · 0 评论 -
vector 比数组 的存取速度慢的不是一个数量级啊
https://oj.leetcode.com/problems/longest-palindromic-substring/这个leetcode得出的,可能是这个原因原创 2014-09-20 11:11:02 · 8585 阅读 · 0 评论 -
RC4的加解密原理
看了一下,RC4的原理,感觉很简单的啊,只是可能并不是原创 2014-09-22 17:02:26 · 6304 阅读 · 0 评论 -
找工作--笔试面试--准备8
1.N-Queens原创 2014-10-14 22:36:51 · 644 阅读 · 0 评论 -
找工作--笔试面试--准备5
1、Same Tree原创 2014-10-12 23:27:09 · 556 阅读 · 0 评论 -
找工作--笔试面试--准备10
1、Remove ElementGiven an array and a value, remove all instances of that value in place and return the new length.The order of elements can be changed. It doesn't matter what you l原创 2014-10-17 11:33:32 · 631 阅读 · 0 评论 -
找工作--笔试面试--准备9
1、Wildcard Matching原创 2014-10-15 17:46:19 · 786 阅读 · 0 评论 -
排序算法-整理归档
TODO tomorrow原创 2014-09-28 22:59:51 · 606 阅读 · 0 评论 -
找工作--笔试面试--准备7
1、Minimum Path SumGiven a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.Note: You can only move原创 2014-10-14 20:47:56 · 575 阅读 · 0 评论 -
找工作--笔试面试--准备6
1、Maximal RectangleGiven a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.原创 2014-10-13 13:31:59 · 908 阅读 · 0 评论 -
面试题
1.一个桶里面有白球、黑球各100个,现在按下述规则取球:的 i 、每次从通里面拿出来两个球; ii、如果取出的是两个同色的求,就再放入一个黑球; ii、如果取出的是两个异色的求,就再放入一个白球。问:最后桶里面只剩下一个黑球的概率是多少?这个是百度的面试题目,如果写程序会发现,全是黑色的。这个问题还是要有计算机的2进制思维,把白色的当做1,黑色当做0原创 2013-10-29 13:32:46 · 738 阅读 · 0 评论 -
Word Ladder II
Word Ladder IIclass Solution {private: int min;public: vector> findLadders(string start, string end, unordered_set &dict) { vector> ret; if(dict.size()==0&&isone(start,end)){ vector原创 2014-06-03 17:16:12 · 658 阅读 · 0 评论 -
Candy
首先用的是,类似DP的方法,一个一个元素进行查询原创 2014-05-27 12:10:53 · 501 阅读 · 0 评论 -
Word Break
DP的方法,用一个数组记录,i,j之间的string是否是字符串,然后用一个递归将原创 2014-06-01 12:52:55 · 637 阅读 · 0 评论 -
Palindrome Partitioning II
首先想到的是,应该是一种DP算法,同时还有剪枝,但是我没怎么学过动态规划,原创 2014-05-30 19:21:07 · 630 阅读 · 0 评论 -
surrounded regions
surrounded regions递归的方法,最周围的private: int lenx; int leny;public: void solve(vector> &board) { lenx = board.size(); if(lenx<=0){ return ; } leny = board[0].size(); if(leny<=0){原创 2014-06-02 11:13:53 · 630 阅读 · 0 评论 -
Google protol Buffer
以下转载,protobuf的更多细节Protobuf 的更多细节人们一直在强调,同 XML 相比, Protobuf 的主要优点在于性能高。它以高效的二进制方式存储,比 XML 小 3 到 10 倍,快 20 到 100 倍。对于这些 “小 3 到 10 倍”,“快 20 到 100 倍”的说法,严肃的程序员需要一个解释。因此在本文的最后,让我们稍微深入 Proto转载 2014-09-02 16:23:07 · 1631 阅读 · 0 评论 -
找工作--笔试面试--准备4
todo~~~原创 2014-10-11 22:39:54 · 580 阅读 · 0 评论 -
找工作--笔试面试--准备2
1、LRU CacheLRU 我们都熟悉,实在原创 2014-10-07 23:57:20 · 771 阅读 · 0 评论 -
蜂群算法
这是我在百度空间里面写的文章,很久了,现在搬家搬到这边来。蜂群算法Bee colony algorithms蜂群算法的分类(基于繁殖行为的算法、蜜蜂交配优化算法、蜜蜂进化型遗传算法、蜂王算法)基于采蜜行为的算法(人工蜂群算法(ABC)、虚拟蜜蜂算法、蜂群优化算法)生物学机理1、不同角色之间的交流、转换及协作来实现2、采蜜行为包括蜜源、采蜜蜂与待采蜜蜂原创 2013-09-20 16:15:42 · 7369 阅读 · 1 评论