1. 快排的partition

if(l >= r)
return ;
int i = l, j = r;
int tmp = v[i];
while(i < j) {
while(i < j && v[j] >= tmp) j--;
while(i < j && v[i] <= tmp) i++;
if(i < j) swap(v[i], v[j]);
}
swap(v[l], v[i]);

2. pq的排序规则

pop正好是和比较是反着的

struct cmp{
bool operator ()(const pair<int,pair<int,int>> &a, const pair<int,pair<int,int>> &b) {
return a.first > b.first;
}
};

3. kmp的next数组

next[0] = -1;
for(int i=1; i<len; i++) {
int j = next[i-1];
while(j != -1 && s[j+1] != s[i])
j = next[j];
if(s[j+1] == s[i])
next[i] = j+1;
else
next[i] = -1;
}

最新文章

  1. Python之路-(Django(Cookie、分页))
  2. Scala编程--基本类型和操作
  3. Bootstrap页面布局23 - BS折叠内容
  4. x^y=(x&amp;~y)|(~x&amp;y)证明
  5. UVaLive 6608 Cabin Baggage (水题)
  6. Visual Studio&#174; 2010 Web Deployment Projects站点编译生成bin同时发表插件
  7. 基于微软开发平台构建和使用私有NuGet托管库
  8. di.xml
  9. 一对一关联模型,HAS_ONE
  10. 蚂蚁风险大脑亮相ATEC城市峰会:为数字经济时代做好“安全守护”
  11. 6.oop-类和对象
  12. QTP 自动货测试桌面程序-笔记(添加控件仓库并关联到action)
  13. Spring-AOP环绕监听出错
  14. AndroidStudio_RecyclerView
  15. WinForm 中 comboBox控件数据绑定
  16. Android自定义View学习(四)
  17. Spring总结 3.AOP(xml)
  18. spring cloud 加入配置中心后的 部分 配置文件优先级
  19. ios8 UITableView section不显示
  20. object-oriented second work

热门文章

  1. 【Qt开发】Qt标准对话框之QMessageBox
  2. 如何将/etc/issue文件中的内容转换为大写后保存至/tmp/issue.out文件中
  3. Python中classmethod和staticmethod的区别
  4. [Web 前端] 030 ajax 是什么
  5. Mysql常用时间函数的用法和应用
  6. MapReduce计算模型二
  7. Java数据结构之算法时间度
  8. MySQL的事务和视图
  9. Linux下查看日志用到的常用命令
  10. 模板 - 无旋Treap