HW5Q5

 avatar
user_7676782
python
2 years ago
493 B
7
Indexable
def minPatients(tpl, s, e):
    # stop conditions
    if s > e:
        num1 = tpl[e]
        return num1
    num2 = tpl[e]
    # Another call to recursion
    num1 = minPatients(tpl, s, e - 1)
    # if num2 is bigger than num1 we return num1 otherwise num2
    if num2 > num1:
        return num1
    else:
        return num2


num_patients = (12, 13, 55, 100, 15, 5, 6, 88, 77, 66, 5, 100)
start = 0
end = len(num_patients)-1
print(minPatients(num_patients, start, end))
Editor is loading...