2023年5月8日

排序算法

摘要: ###1.插入排序 void insert_sort() { for (int i = 1; i < n; i ++ ) { int x = a[i]; int j = i-1; while (j >= 0 && x < a[j]) { a[j+1] = a[j]; j -- ; } a[j+1] 阅读全文
posted @ 2023-05-08 18:32 逆袭怪 阅读(14) 评论(0) 推荐(0) 编辑

算法基础上机实验——2023年5月8日

摘要: ###1. #include<bits/stdc++.h> using namespace std; int n, a[1005]; int main(){ cin >> n; for(int i = 1; i <= n; i ++) cin >> a[i]; sort(a + 1, a + 1 + 阅读全文
posted @ 2023-05-08 18:24 逆袭怪 阅读(21) 评论(0) 推荐(0) 编辑