摘要: 归并排序和逆序对数量 #归并排序 #include<iostream> using namespace std; const int N = 100010; int q[N]; int tmp[N]; void merge_sort(int q[],int l, int r) { if(l >= r) return ; 阅读全文
posted @ 2021-11-04 22:42 ydssx 阅读(44) 评论(0) 推荐(0) 编辑
摘要: #快速排序 1.确定分界点 2.调整区间 3.递归处理左右两段 难点在如何调整区间,使用左右两个指针,当位置不对时互换两个指针的位置。 记住边界条件,j和j+1 #include <iostream> using namespace std; const int N = 100010; int q[ 阅读全文
posted @ 2021-10-25 17:08 ydssx 阅读(169) 评论(0) 推荐(0) 编辑
more_horiz
keyboard_arrow_up dark_mode palette
选择主题
点击右上角即可分享
微信分享提示