Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def rech_dichoto(x,L):
- n=len(L)
- p=1
- while n>p:
- m=int((p+n)/2)
- if x==L[m]:
- return(m)
- elif x<L[m]:
- n=m-1
- else:p=m+1
- def trisel(L):
- n=len(L)
- for i in range(n-1):
- x=l[i]
- for j in range(i+1,n):
- if L[j]<x:
- L[j],x=x,l[j]
- L[i]=x
- return(l)
- def trirap(l):
- if l==[]:
- return([])
- else:
- pivot=l[0]
- l1=[]
- l2=[]
- for x in l[1:]:
- if x<pivot:
- l1.append(x)
- else:
- l2.append(x)
- return(quicksort(l1)+[pivot]+quicksort(l2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement