Wrote a small PYTHON-program, but it returns "recursion-depth error". I had to add some if..elif...else-blocks in order to deal with the "-inf" value. Additional, a python-array starts with index 0, so the access to its elements must be coded A[l-1] instead of A[l]. If you say, the result has to be 9, I wonder why the program doesn't give that result. Perhaps I made an error ... anyway, feel free to try yourself.
# what does unknown(arr,1,8) return?
import math
arr = [6,4,2,9,2,8,7,5]
def unknown(a, l, r):
if l > r:
return "-inf"
elif l==r:
return a[l-1]
else:
q=l+math.floor((r-1)/3)
al=unknown(a,l,q)
ar=unknown(a,q+1,r)
if al=="-inf" and ar=="-inf":
return a[l-1]
elif ar=="-inf" and al==type('int'):
return al
elif al=="-inf" and ar==type('int'):
return ar
elif al>ar:
return al
else:
return ar
print(unknown(arr,1,8))

Softwareentwickler, Punkte: 10