Fixed a bug in median function where it was computing array[len/2]-1 instead of array[(len/2)-1]