(nums: &mut [i32])
| 16 | } |
| 17 | |
| 18 | fn bubble_sort2(nums: &mut [i32]) { |
| 19 | let mut len = nums.len() - 1; |
| 20 | while len > 0 { |
| 21 | for i in 0..len { |
| 22 | if nums[i] > nums[i+1] { |
| 23 | nums.swap(i, i+1); |
| 24 | } |
| 25 | } |
| 26 | len -= 1; |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | fn bubble_sort3(nums: &mut [i32]) { |
| 31 | let mut compare = true; |