最长上升子序列LIS模板
2016-07-30 09:42
330 查看
///最长上升子序列LIS模板 int BinSerch(int l,int r,int cut) { while (l<=r) { int m=(l+r)>>1; if (cut>d[m]&&cut<=d[m+1]) return m; if (cut>d[m]) l=m+1; else r=m-1; } return 0; } int LIS(int n) { int len=1,j; d[1]=a[0]; for (int i=1;i<n;i++) { if (a[i]>d[len]) j=++len; else j=BinSerch(1,len,a[i])+1; d[j]=a[i]; } return len; }
相关文章推荐
- Sting中方法举例
- Activity数据更新,及时通知下面的Fragment
- Delphi下EasyGrid使用体会
- JavaSE学习笔记之-----集合
- 55.A+B Problem III
- [置顶] pull解析请求网络的数据(带分页加载,刷新) xlistview HttpUtils
- 新浪博客,CSDN博客, 博客园, 知乎发表 都可以。开源中国 。
- android sqlite增删改查语句
- puppet时遇到的坑
- 概率图模型学习(一):概率图矩阵分解
- 54.九九乘法表
- 濮阳,明天母亲节,怎么送礼物?团购送礼物。相关资料。20160507
- constructors not allowed a return type错误问题
- Java (for循环综合应用)
- 濮阳买房 房价预估 参考,
- 53.小光棍数
- 泡妞相关技能学习。
- Java NIO vs IO
- HSF和Dubbo有什么区别
- 后缀数组模板