Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Finds the median
- float median;
- if(aVector.size() % 2 == 0){
- float val1 = aVector[aVector.size() / 2 - 0.5] ;
- float val2 = aVector[aVector.size() / 2 + 0.5] ;
- median = (val1 + val2) / 2 ;
- }else{
- median = aVector[(aVector.size() - 1) / 2] ;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement