Hello,
I've stumbled upon question I can't solve on my own. What I need is to write a program in python that would perform selection sort, but here's trick - it has to be recursive.
So, for example I have
l = [3,2,1]
after using sort(l), l = [1,2,3]
I've this far:
def sort(l):
if len(l) <= 1:
return l
else:
l.append(#the largest element#)
return selsort(l[1:])
So, basically I don't know how to extract maximum element using recursion. If anyone knows how to do - pls help :)
Thanks in advance :)