adding find min and max in an unsorted array