Beispiel #1
0
 def main(*argv):
     "BinaryInsertionSorter test program."
     print((BinaryInsertionSorter.main.__doc__))
     Sorter.test(BinaryInsertionSorter(), 100, 123)
     return 0
 def main(*argv):
     "TwoWayMergeSorter test program."
     print TwoWayMergeSorter.main.__doc__
     Sorter.test(TwoWayMergeSorter(), 100, 123)
     return 0
Beispiel #3
0
 def main(*argv):
     "BucketSorter test program."
     print BucketSorter.main.__doc__
     Sorter.test(BucketSorter(1024), 100, 123, 1024)
     return 0
Beispiel #4
0
 def main(*argv):
     "RadixSorter test program."
     print RadixSorter.main.__doc__
     Sorter.test(RadixSorter(), 100, 123)
     return 0
 def main(*argv):
     "StraightInsertionSorter test program."
     print StraightInsertionSorter.main.__doc__
     Sorter.test(StraightInsertionSorter(), 100, 123)
     return 0
 def main(*argv):
     "BubbleSorter test program."
     print BubbleSorter.main.__doc__
     Sorter.test(BubbleSorter(), 100, 123)
     return 0
Beispiel #7
0
 def main(*argv):
     "Demonstration program number 9."
     #print Demo9.main.__doc__
     if len(argv) != 4:
         print "usage: %s size seed mask" % (argv[0])
         sys.exit(1)
     n = int(argv[1])
     seed = int(argv[2])
     mask = int(argv[3])
     if (mask & 04) != 0:
         Sorter.test(StraightInsertionSorter(), n, seed)
         Sorter.test(BinaryInsertionSorter(), n, seed)
         Sorter.test(BubbleSorter(), n, seed)
         Sorter.test(StraightSelectionSorter(), n, seed)
     if (mask & 02) != 0:
         Sorter.test(MedianOfThreeQuickSorter(), n, seed)
         Sorter.test(HeapSorter(), n, seed)
         Sorter.test(TwoWayMergeSorter(), n, seed)
     if (mask & 01) != 0:
         Sorter.test(BucketSorter(1024), n, seed, 1024)
         Sorter.test(RadixSorter(), n, seed)
     return 0
Beispiel #8
0
 def main(*argv):
     "RadixSorter test program."
     print RadixSorter.main.__doc__
     Sorter.test(RadixSorter(), 100, 123)
     return 0
Beispiel #9
0
 def main(*argv):
     "MedianOfThreeQuickSorter test program."
     print MedianOfThreeQuickSorter.main.__doc__
     Sorter.test(MedianOfThreeQuickSorter(), 100, 123)
     return 0
Beispiel #10
0
 def main(*argv):
     "StraightInsertionSorter test program."
     print((StraightInsertionSorter.main.__doc__))
     Sorter.test(StraightInsertionSorter(), 100, 123)
     return 0
Beispiel #11
0
 def main(*argv):
     "BinaryInsertionSorter test program."
     print BinaryInsertionSorter.main.__doc__
     Sorter.test(BinaryInsertionSorter(), 100, 123)
     return 0
Beispiel #12
0
 def main(*argv):
     "BubbleSorter test program."
     print BubbleSorter.main.__doc__
     Sorter.test(BubbleSorter(), 100, 123)
     return 0
Beispiel #13
0
 def main(*argv):
     "BucketSorter test program."
     print((BucketSorter.main.__doc__))
     Sorter.test(BucketSorter(1024), 100, 123, 1024)
     return 0
Beispiel #14
0
 def main(*argv):
     "HeapSorter test program."
     print HeapSorter.main.__doc__
     Sorter.test(HeapSorter(), 100, 123)
     return 0
Beispiel #15
0
 def main(*argv):
     "HeapSorter test program."
     print((HeapSorter.main.__doc__))
     Sorter.test(HeapSorter(), 100, 123)
     return 0
 def main(*argv):
     "StraightSelectionSorter test program."
     print StraightSelectionSorter.main.__doc__
     Sorter.test(StraightSelectionSorter(), 100, 123)
     return 0