median
anyone else a highly trained programmer/mathematician/statistician
and still googling this shit?
median
anyone else a highly trained programmer/mathematician/statistician
and still googling this shit?
what is median
a median is a value separating the higher half from the lower half of a data sample, a population or a probability distribution. For a data set, it may be thought of as "the middle" value.
median
// Find the median of an array of numbers
function findMedian(numbers) {
// If length of numbers is even, average the two middle numbers
if(numbers.length % 2 === 0) {
// Get lower middle number by dividing length by 2 and subtracting 1
var lowerMiddle = numbers[numbers.length / 2 - 1];
// Get upper middle number by dividing length by 2
var upperMiddle = numbers[numbers.length / 2];
// Return average of lower and upper middle numbers
return (lowerMiddle + upperMiddle) / 2;
}
// If length of numbers is odd, return middle value by dividing length - 1 by 2 to get index
return numbers[(numbers.length - 1) / 2];
}
what is a median
Median of a triange is a line that goes from a vertex of the triangle
to the midpoint of the opposite side of that vertex.
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us