algorithm_rust 0.6.0

some common rust_algorithms, Everyone can participate, and the project will continue to be updated, all the algorithms comes from <Introduction to Algorithms III>
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
///暴力求解最大子数组
pub fn max<T>(array: &[T]) -> (usize,usize,T) where
    T: std::cmp::PartialEq + std::ops::Add<Output = T> + std::cmp::PartialOrd + std::ops::AddAssign + Copy, {
    let mut max: (usize,usize,T) = (0,0,(*array)[0]);
    for i in 0..(*array).len() - 1 {
	let mut sum: T = (*array)[i] ;
	for j in i + 1..(*array).len() {
	    sum += (*array)[j];
	    if sum > max.2 {
		max.0 = i;
		max.1 = j;
		max.2 = sum;
	    }
	}
    }
    max
}