예제 #1
0
 def test_bucket_sort(self):
     self.assertTrue(is_sorted(bucket_sort([1, 3, 2, 5, 65, 23, 57, 1232])))
예제 #2
0
 def test_bucket_sort(self):
     self.assertEqual([1, 5, 23, 57, 65, 1232],
                      bucket_sort([1, 5, 65, 23, 57, 1232]))
예제 #3
0
from algorithms.sort import (bucket_sort, next_sort, quick_sort)

print(bucket_sort([1, 2, 3, 7, 8, 9, 4, 5, 6, 1, 1, 2]))
print(quick_sort([1, 2, 3, 7, 8, 9, 4, 5, 6, 1, 1, 2]))
예제 #4
0
from algorithms.sort import bucket_sort
import random

alist = [random.randint(1, 10) for i in range(100)]
print(alist)
sorted_list = bucket_sort(alist)
print(sorted_list)
예제 #5
0
 def test_bucket_sort(self):
     self.assertEqual([1, 5, 23, 57, 65, 1232],
                     bucket_sort([1, 5, 65, 23, 57, 1232]))
예제 #6
0
 def test_bucket_sort_simple_even(self):
     arr = [4, 3, 2, 1]
     arr_copy = arr[::]
     arr_copy.sort()
     self.assertEqual(bucket_sort(arr), arr_copy)
예제 #7
0
 def test_bucket_sort_large(self):
     arr = random.sample(range(500), 500)
     arr_copy = arr[::]
     arr_copy.sort()
     self.assertEqual(bucket_sort(arr), arr_copy)