Find smallest and largest value in array of numbers or collection of elements