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

Function cbic_sort3

code/chapter06/CantBeliveItCanSort.rs:28–36  ·  view source on GitHub ↗

降序排序

(nums: &mut [i32])

Source from the content-addressed store, hash-verified

26
27// 降序排序
28fn cbic_sort3(nums: &mut [i32]) {
29 for i in 0..nums.len() {
30 for j in 0..nums.len() {
31 if nums[i] > nums[j] {
32 nums.swap(i, j);
33 }
34 }
35 }
36}
37
38// 降序排序优化版
39fn cbic_sort4(nums: &mut [i32]) {

Callers

nothing calls this directly

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected