New answers tagged


That is an incorrect method to calculate median. The array length may odd or even. When the array length is even, we need to take the mean of the two middle elements: fn median(array: &Vec<i32>)->f64{ if (array.len() % 2)==0 { let ind_left = array.len()/2-1; let ind_right = array.len()/2 ; (array[...

Top 50 recent answers are included