Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def maxi(T):
- i=0
- max=T[i]
- imax=i
- while i<len(T):
- if max<T[i]:
- max=T[i]
- imax=i
- i+=1
- return [max,imax]
- # print(maxi([4,3,5,2,1,6]))
- def tri_pancake(T):
- i=0
- pos=0
- l=[]
- while i<len(T):
- tup=maxi(T[i:])
- indice=tup[1]+i
- if indice==len(T)-1:
- l+=[i]
- T=retourner(T,i)
- i+=1
- else:
- T=retourner(T,indice)
- l+=[indice]
- return T,l[:-1]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement