From 2241a5ca18c2c521f47e1f6bad33f490a0190ec9 Mon Sep 17 00:00:00 2001 From: Ammar <32436267+ammar0211@users.noreply.github.com> Date: Tue, 8 Oct 2019 04:31:03 +0530 Subject: [PATCH] Added the test --- sort/BozoSort/bozo_sort.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sort/BozoSort/bozo_sort.py b/sort/BozoSort/bozo_sort.py index 9f6e340308..b560cfe62f 100644 --- a/sort/BozoSort/bozo_sort.py +++ b/sort/BozoSort/bozo_sort.py @@ -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] @@ -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()