def main(): test.test_sort(insertion_sort) print('All tests passed')
def main(): test.test_sort(radix_sort) print('All tests passed')
def main(): test.test_sort(merge_sort) print('All tests passed')
break else: l[right], l[left] = l[left], l[right] if mid > left: l[mid], l[left+1] = l[left+1], l[mid] else: l[mid], l[left] = l[left], l[mid] quick_sort(l, left+1, end) quick_sort(l, start, left) if __name__ == "__main__": try: import test leng = 500 cycle = 50 print("Bubble:", test.test_sort(bubble_sort, leng, cycle)) print("Select:", test.test_sort(select_sort, leng, cycle)) print("Insert:", test.test_sort(insert_sort, leng, cycle)) print("Shell:", test.test_sort(shell_sort, leng, cycle)) print("Merge:", test.test_sort(merge_sort, leng, cycle)) print("Quick:", test.test_sort(quick_sort, leng, cycle)) except: alist = [1, 54, 26, 93, 17, 77, 31, 44, 55, 20] alist2 = [20, 30, 40, 90, 50, 60, 70, 80, 100] alist3 = [54, 26, 93, 17, 77, 31, 44, 55, 20] alist4 = [15, 5, 4, 18, 12, 19, 14, 10, 8, 20] alist5 = [5, 16, 20, 12, 3, 8, 9, 17, 19, 7] alist6 = [21, 1, 26, 45, 29, 28, 2, 9, 16, 49, 39, 27, 43, 34, 46, 40] alist7 = [14, 17, 13, 15, 19, 10, 3, 16, 9, 12] bubble_sort(alist) bubble_sort(alist2)
def main(): test.test_sort(lambda nums: bucket_sort(nums, 0, 1000))
def main(): test.test_sort(lambda nums: counting_sort(nums, 1000)) print('All tests passed')
def main(): test.test_sort(heapsort) print('All tests passed')
def main(): test.test_sort(three_way_quicksort) print('All tests passed')
def main(): test.test_sort(selection_sort) print('All tests passed')
def main(): test.test_sort(quick_sort) print('All tests passed')