Added debug output

This commit is contained in:
madmaurice 2015-12-10 19:48:26 +01:00
parent 585016e9d8
commit 959f74e34f

View file

@ -204,6 +204,9 @@ def main():
size = int( argv[1]) size = int( argv[1])
except Exception: except Exception:
size= 1000 size= 1000
print("Benchmarking using %d elements" % size)
result = SortTester(list( SortAlgorithm.__subclasses__() )).test(size=size) result = SortTester(list( SortAlgorithm.__subclasses__() )).test(size=size)
for cls, r in sorted(result.items(),key=lambda e: e[1][0]+e[1][1]): for cls, r in sorted(result.items(),key=lambda e: e[1][0]+e[1][1]):
print("%-12s: %10d, %10d compares, %10d swaps" % (cls.__name__, r[0]+r[1], r[0],r[1])) print("%-12s: %10d, %10d compares, %10d swaps" % (cls.__name__, r[0]+r[1], r[0],r[1]))