Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def swap(l, a, b):
- tmp = l[a]
- l[a] = l[b]
- l[b] = tmp
- def is_sorted(l):
- for i in range(0, len(l) - 1):
- if(l[i] > l[i + 1]):
- return False
- return True
- def stupid_sort(l):
- swap(l, random.randint(0, len(l) - 1), random.randint(0, len(l) - 1))
- if not is_sorted(l):
- stupid_sort(l)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement