摘要: 思想:每次排序的时候设置一个基准点,将小于等于基准点的数全部放到基准点的左边,将大于等于基准点的数全部放到基准点的右边。基于二分思想的算法。 测试用例: 10 8 6 2 4 1 9 7 5 10 3 #include <iostream> #include <stdlib.h> #include 阅读全文
posted @ 2020-03-23 18:30 Maxwell· 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 空间复杂度:O(1) 时间复杂度最坏和平均时:O(n²) 是一个稳定的排序方法 #include <iostream> #include <stdlib.h> #include <math.h> #include <string.h> #include <algorithm> using names 阅读全文
posted @ 2020-03-23 17:50 Maxwell· 阅读(84) 评论(0) 推荐(0) 编辑
摘要: dfs暴力搜: #include <iostream> #include <stdlib.h> #include <math.h> #include <string.h> #include <algorithm> using namespace std; int n,m; int ans=99999 阅读全文
posted @ 2020-03-23 17:27 Maxwell· 阅读(278) 评论(0) 推荐(0) 编辑