Implement findMin and findMax.