find the greatest element in a list of unknown size