Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Function Definition
- def bubbleSort(A):
- # Error Checks
- if type(A) != list:
- return [False, A]
- n = len(A)
- if n == 0:
- return [False, A]
- for val in A:
- if type(val) != int and type(val) != float:
- return [False, A]
- # Duplicate and sort
- final = list(A)
- for x in range(0,n,1):
- for y in range(0,n,1):
- if final[x] < final[y]:
- temp = final[x]
- final[x] = final[y]
- final[y] = temp
- return [True, final]
Advertisement
Add Comment
Please, Sign In to add comment