You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Chris 65a0fd7f41 formatting and fixing of examples 4 years ago
..
README.md formatting and fixing of examples 4 years ago

README.md

collect

Instructions

Implement the function bubble_sort which receives a vector Vec and returns the same vector but in increasing order using the bubble sort algorithm.

Expected Function

pub fn bubble_sort(vec: &mut Vec<i32>) {
}

Usage

Here is a program to test your function.

use collect::*;

fn main() {
	let ref mut v = vec![3, 2, 4, 5, 1, 7];
	let mut b = v.clone();
	bubble_sort(v);
	println!("{:?}", v);

	b.sort();
	println!("{:?}", b);
}

And its output:

student@ubuntu:~/[[ROOT]]/test$ cargo run
[1, 2, 3, 4, 5, 7]
[1, 2, 3, 4, 5, 7]
student@ubuntu:~/[[ROOT]]/test$