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

Question

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.

in progress 0
Josephine 5 months 2022-01-02T21:21:50+00:00 1 Answer 0 views 0

Answers ( )

    0
    2022-01-02T21:23:22+00:00

    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)

Leave an answer

45:7+7-4:2-5:5*4+35:2 =? ( )