예제 #1
0
def main():
    test.test_sort(insertion_sort)
    print('All tests passed')
예제 #2
0
def main():
    test.test_sort(radix_sort)
    print('All tests passed')
예제 #3
0
def main():
    test.test_sort(merge_sort)
    print('All tests passed')
예제 #4
0
파일: sort.py 프로젝트: ivegor/test
                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)
예제 #5
0
파일: merge_sort.py 프로젝트: nodirt/pyalgo
def main():
    test.test_sort(merge_sort)
    print('All tests passed')
예제 #6
0
파일: radix_sort.py 프로젝트: nodirt/pyalgo
def main():
    test.test_sort(radix_sort)
    print('All tests passed')
예제 #7
0
def main():
    test.test_sort(lambda nums: bucket_sort(nums, 0, 1000))
예제 #8
0
파일: counting_sort.py 프로젝트: nodirt/edu
def main():
    test.test_sort(lambda nums: counting_sort(nums, 1000))
    print('All tests passed')
예제 #9
0
def main():
    test.test_sort(heapsort)
    print('All tests passed')
예제 #10
0
def main():
    test.test_sort(three_way_quicksort)
    print('All tests passed')
예제 #11
0
def main():
    test.test_sort(selection_sort)
    print('All tests passed')
예제 #12
0
def main():
    test.test_sort(selection_sort)
    print('All tests passed')
예제 #13
0
def main():
    test.test_sort(quick_sort)
    print('All tests passed')
예제 #14
0
def main():
    test.test_sort(lambda nums: counting_sort(nums, 1000))
    print('All tests passed')