![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
白瓷绿茶
这个作者很懒,什么都没留下…
展开
-
快速选择满足条件的两个数
http://www.cnblogs.com/bingwenst/archive/2012/05/22/2513151.html能否快速找出一个数组中的两个数字,让这两个数字之和等于一个给定的值,为了简化起见,我们假设这个数组中肯定存在至少一组符合要求的解。 假如有如下的两个数组: 5,6,1,4,7,9,8 给定Sum= 10 1,5,6,7,8,9转载 2014-04-16 22:37:17 · 394 阅读 · 0 评论 -
理解SVM的三层境界
http://blog.csdn.net/v_july_v/article/details/7624837转载 2014-08-29 14:19:32 · 390 阅读 · 0 评论 -
树的三种遍历
转载 2014-08-10 14:07:20 · 312 阅读 · 0 评论 -
一个数组中最常出现的n个数
面试被问到了,想了想似乎可以用map解决,第一个保存原型,第二个保存出现的次数,在用set的比较特性,对map的迭代器进行排序,小于函数需自定义原创 2014-04-17 10:36:31 · 523 阅读 · 0 评论 -
最小堆实现
#include #include #include #include using namespace std;template class BinaryHeap{public: BinaryHeap (const vector &s):element(s) { MaxIndex=maxIndex(); printCurrentState(); buildHeap转载 2014-08-02 15:50:14 · 312 阅读 · 0 评论 -
261页binaryMaxIndexSmallerThanValue
#include #include using namespace std;template int binaryMaxIndexSmallerThanValue(const vector &array ,Type keyValue){ if(array.size()==0) return -1; int left=0,right=array.size()-1; while转载 2014-07-21 21:47:20 · 299 阅读 · 0 评论 -
队列中取最大值操作
#include #include #include #include using namespace std;template class Stack{private: vector stackItem; int stackTop; vector link2NextMaxItem;public: Stack():stackTop(-1){} void push(T转载 2014-07-20 14:40:48 · 795 阅读 · 0 评论 -
kmp
http://www.cnblogs.com/dolphin0520/archive/2011/08/24/2151846.html转载 2014-04-24 22:36:49 · 272 阅读 · 0 评论 -
max sub array and label
#include #include using namespace std;int max_sub_array(int *s,int s_size,int &left,int &right){ //左闭右开 if(s_size<=0){ cout<<"invalid array"<<endl; return NULL; } left=0;right=1; int this_原创 2014-04-17 15:05:49 · 697 阅读 · 0 评论 -
N个节点二叉树有多少种形态
记n个节点的二叉树形态个数为A[n] 1)0个节点的二叉树只有1种形态,A[0]=0;1个节点的二叉树只有1种形态,A[1]=1 2)n个节点(n>=2)的二叉树有 A[n] = ∑ [m=0到n-1] ( A[m]*A[n-m-1] ) ,求和的每一项,分别表示根的左子树为m个节点、右子树为 n-m-1个节点的情况 刚好就是catalan数,直接用catalan数的公式:h(n)=C(2n,n)转载 2014-09-28 15:07:15 · 1283 阅读 · 0 评论