Skip to content

Commit

Permalink
Added the test
Browse files Browse the repository at this point in the history
  • Loading branch information
ammar0211 authored Oct 7, 2019
1 parent 27f3ce9 commit 2241a5c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sort/BozoSort/bozo_sort.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def sort_check(array):
if array[i]>array[i+1]:
return False
return True
def bozo_sort(array):
def bozo_sort_algo(array):
while not sort_check(array):
i,j=random.randint(0,len(array)-1),random.randint(0,len(array)-1)
array[i],array[j]=array[j],array[i]
Expand All @@ -24,4 +24,10 @@ def bozo_sort(array):
arr=[input('Enter Element %d : '%(i+1)) for i in range(n)]

print ('Original Array : ',arr)
print ('Sorted Array : ',bozo_sort(arr))
print ('Sorted Array : ',bozo_sort_algo(arr))

def test():
arr=[54,78,95,63,12,221,1,0,-7,8,35,15,7,66,421,798]
print ('Original Array : ',arr)
print ('Sorted Array : ',bozo_sort_algo(arr))
test()

0 comments on commit 2241a5c

Please sign in to comment.