摘要: 归并排序 归并排序代码 #include <iostream> #include <vector> using namespace std; void merge(vector<int>& nums, int L, int mid, int R) { vector<int> ans(R - L + 阅读全文
posted @ 2021-10-02 15:15 北极星! 阅读(50) 评论(0) 推荐(0) 编辑
摘要: 基数排序 阅读全文
posted @ 2021-10-02 15:15 北极星! 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 选择排序 简单选择 #include <iostream> #include <vector> using namespace std; void swap(int &p, int &q); void selectSort(vector<int> &array, int n); int main() 阅读全文
posted @ 2021-10-02 15:11 北极星! 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 交换排序 冒泡排序 冒泡排序代码演示: 给你一个n代表有n个数字,然后你需要使用冒泡排序将这些数字从小到大排好。 输入描述: 第一行输入一个n,代表有n个数字 第二行输入n个数 输出描述: 输出排序好后的n个数 示例1 输入 4 4 3 2 1 输出 1 2 3 4 #include <iostre 阅读全文
posted @ 2021-10-02 15:00 北极星! 阅读(51) 评论(0) 推荐(0) 编辑
摘要: 插入排序 直接插入排序 插入排序代码 测试连接 #include <iostream> #include <vector> using namespace std; void swap(int &p, int &q); void insertSort(vector<int> &array, int 阅读全文
posted @ 2021-10-02 14:35 北极星! 阅读(37) 评论(0) 推荐(0) 编辑