Write a function that receives a one-dimensional array of integers and returns a Python tuple with two values - the minimum and maximum values of the input array. The content of the input array must not be changed. You may assume that the input array will contain only integers, and will have at least one element. You do not need to check for these conditions. For full credit, the function must be implemented with O(N) complexity.

Respuesta :

The function that receives array of integers and returns  the minimum and maximum values as a tuple is as follows:

def min_max(array):

    x = min(array)

    y = max(array)

    return (x, y)

print(min_max([4, 6, 7, 8, 1, 8, 14]))

Code explanation

The code is written in python.

  • We defined a function named "min_max". The function accepts a parameter called array.
  • The variable x is used to store the minimum value of the array.
  • The y variable is used to store the maximum value of the array.
  • Then, we return the minimum and maximum values as a tuple.
  • Finally, we call the function with the required parameter.

learn more on python here: https://brainly.com/question/13199913

Ver imagen vintechnology