找程式砍 .DS_Store 很烦,直接让它不要出现吧 其实这问题困扰我很久了,每个目录裡面都会跑出一个 .DS_Store 的档案,我通常都是用 ? find /path/to -name 『.DS_Store』 -delete ? 来砍,不过砍了又会自动再生...
分类:
其他好文 时间:
2014-07-22 09:03:07
阅读次数:
198
Givennnon-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histog...
分类:
其他好文 时间:
2014-07-21 10:04:43
阅读次数:
229
What's xxxThe EM algorithm is used to find the maximum likelihood parameters of a statistical model in cases where the equations cannot be solved dire...
分类:
其他好文 时间:
2014-07-21 10:01:10
阅读次数:
243
0x00本文属于随笔, 仅供作者学习记录.0x01 批量修改图片大小:root@host:~/$ find ./ -name '*.jpg' -exec convert -resize 220X520! {} {} \;备注: 上述命令中,find 路径 -name 匹配.jpg后缀的文件-exec...
分类:
系统相关 时间:
2014-07-21 09:35:06
阅读次数:
334
对于一个二叉搜索树, 要想找到这棵树的最小元素值, 我们只需要从树根开始, 沿着left 孩子指针一直走, 知道遇到NULL(即走到了叶子), 那么这个叶子节点就存储了这棵二叉搜索树的最小元素。 同理, 从根节点开始, 沿着right 孩子指针, 最终找到的是最大关键字的节点。
也就是说寻找BST最小关键字的元素和最大关键字的元素的代码是对称的。伪代码如下:
TREE_MINIMUM(x...
分类:
编程语言 时间:
2014-07-21 09:28:27
阅读次数:
241
给定一棵二叉树, 如何确定这棵二叉树的高度(即树的最大的深度), 是一个很常见的问题。
给下图回顾一下:
关于高度和深度的概念, 参见上图。
NOTE: 高度: 参考节点是距离节点最远的叶子
深度: 参考节点是根节点
寻找二叉树的高度也可以通过一个递归函数(a recursive function)实现, 这依然源于树是一个递归的数据结构。
例如, 对于下图, 我们可以求出根...
分类:
编程语言 时间:
2014-07-21 09:18:35
阅读次数:
344
一、基本算法2.二分查找void find(int l,int r){ if (l>r || a[l]>x || a[r]> 1; if (a[mid] == x){ if (mid a[mid]) find(mid+1, r); else find(l, mid-...
分类:
其他好文 时间:
2014-07-21 09:15:15
阅读次数:
227
题目链接 Write a function to find the longest common prefix string amongst an array of strings. 题目的意思说的不是很清楚,开始理解成了求任意两个字符串的前缀中的最长者。但是本题的意思是求所有字符串的最长公共前缀,...
分类:
其他好文 时间:
2014-07-21 09:14:25
阅读次数:
225
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-07-20 21:33:36
阅读次数:
204
#includeusing namespacestd;intmain(){ intn,x,y; while(cin>>n,n) { cin>>x; while(--n) { cin>>y; x=x^y; } cout<<x<<"\n"; } return0;}
分类:
其他好文 时间:
2014-07-20 21:30:54
阅读次数:
230