The while is wrong.
If count == 1 or count == 2 that is your terminating condition, and you return a value. Otherwise you call media() twice with the first half and second half of the array. You...