Pergunta de entrevista da empresa Google

Asked how to compute sum, average and median of array. Then was asked to optimize the algorithm for computing the median.