def largest(lst): """Returns the largest element of lst, the same as max(lst). Precondition: lst is not empty.""" if lst==[]: return "error" elif len(lst)==1: return lst[0] else: halfLst=len(lst)//2 Llst=lst[:halfLst] Rlst=lst[halfLst:] return max(largest(Llst), largest(Rlst)) def largest2(lst,start=0,end=None): """Returns the largest element of lst[start:end]. Precondition: end >= start.""" if end == None: end = len(lst) if start == end: return "error" elif end - start == 1: return lst[start] else: halfLst=(start+end)//2 return max(largest2(lst,start, halfLst), largest2(lst,halfLst, end))