In C++ We can easily sort a part of an vector By
sort(A.begin()+start,A.begin()+end);
But in Rust I can not find a good method,Can Anyone Help me??
In C++ We can easily sort a part of an vector By
sort(A.begin()+start,A.begin()+end);
But in Rust I can not find a good method,Can Anyone Help me??
You can call sort() on a mutable slice, such as a section of your vector like this:
fn main() {
let mut v: Vec<u32> = vec![7, 6, 5, 4, 3, 2, 1];
v[2..5].sort();
println!("{:?}", v);
}