list = [1,2,44,7,5,324,3244,5,2,34,57,67]
max = list[0]
def findBig(list, n):
global max
if n >=0:
if list[n]>max:
max = list[n]
return findBig(list, n-1)
findBig(list, len(list)-1)
print(max)
list = [1,2,44,7,5,324,3244,5,2,34,57,67]
max = list[0]
def findBig(list, n):
global max
if n >=0:
if list[n]>max:
max = list[n]
return findBig(list, n-1)
findBig(list, len(list)-1)
print(max)
本文标题:递归实现查找数组中最大值
本文链接:https://www.haomeiwen.com/subject/vkhvzhtx.html
网友评论