Give a recursive algorithm which takes as input a sequence of numbers and returns the minimum (i.e., smallest) number in the sequence. Your algorithm should not use a loop.

Respuesta :

Answer:

Step-by-step explanation:

So let a[i] be the input array to the function find_minimum(): . We will use python to present this recursive algorithm

def find_minimum(a, n):

    if n == 1:

         return a[0]

    return min(a[n], find_minimum(a, n - 1))

find_minimum(a, len(a) - 1)

In this exercise we have to use the programming knowledge to write the code in the python language, so we have to:

The code can be found in the image below.

To make it simpler the code is described below as:

def find_minimum(a, n):

   if n == 1:

        return a[0]

   return min(a[n], find_minimum(a, n - 1))

find_minimum(a, len(a) - 1)

See more about python at brainly.com/question/26104476

Ver imagen lhmarianateixeira