1. Engineering
  2. Computer Science
  3. exercise 8103 recursively computing the maximum and minimum of a...

Question: exercise 8103 recursively computing the maximum and minimum of a...

Question details

Exercise 8.10.3: Recursively computing the maximum and minimum of a sequence. About The input to the maximum and minimum problems is a sequence of numbers, a . an where n, the length of the sequence, is a positive integer. The function length(a1an) returns n, the length of the sequence. If n> 1, you can also create a new sequence aan 1, which is the original sequence an, ith the last number an omitted (a) Give a recursive algorithm which takes as input a sequence of numbers and returns the minimum (Le, smallest) number in the sequence. Your algorithm should not use a loop. Give a recursive algorithm which takes as input a sequence of numbers and returns the maximum (i.e., largest) number in the sequence. Your algorithm should not use a loop.

Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution