I wrote some code that returns the median of an unsorted odd numbered array, but it does not return the median of an even numbered array.
I know that in order to find
a = [1,2,4,5,3,6] sorted = a.sort list = sorted.length if list %2 != 0 puts sorted[list/2] else puts (sorted[list/2]+sorted[(list/2)-1])/2.0 end