retrieve and delete the max value every time

without sorting the whole array get the top k elements