MCPcopy Create free account
hub / github.com/QMHTMY/RustBook / cbic_sort1

Function cbic_sort1

code/chapter06/CantBeliveItCanSort.rs:4–12  ·  view source on GitHub ↗

升序排序

(nums: &mut [i32])

Source from the content-addressed store, hash-verified

2
3// 升序排序
4fn cbic_sort1(nums: &mut [i32]) {
5 for i in 0..nums.len() {
6 for j in 0..nums.len() {
7 if nums[i] < nums[j] {
8 nums.swap(i, j);
9 }
10 }
11 }
12}
13
14// 升序排序优化版
15fn cbic_sort2(nums: &mut [i32]) {

Callers 1

mainFunction · 0.70

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected