1.1 --- a/tests/shootout/binary-trees.py Sat Dec 02 02:20:47 2006 +0100
1.2 +++ b/tests/shootout/binary-trees.py Sat Dec 02 15:40:33 2006 +0100
1.3 @@ -4,7 +4,7 @@
1.4 # contributed by Antoine Pitrou
1.5 # modified by Dominique Wahli
1.6
1.7 -from sys import argv
1.8 +#from sys import argv
1.9
1.10 def make_tree(item, depth):
1.11 if depth > 0:
1.12 @@ -14,7 +14,8 @@
1.13 else:
1.14 return (item, None, None)
1.15
1.16 -def check_tree((item, left, right)):
1.17 +def check_tree(tree):
1.18 + (item, left, right) = tree
1.19 if left is not None:
1.20 return item + check_tree(left) - check_tree(right)
1.21 else:
1.22 @@ -22,10 +23,10 @@
1.23
1.24 def main():
1.25 min_depth = 4
1.26 - max_depth = max(min_depth + 2, int(argv[1]))
1.27 + max_depth = max(min_depth + 2, 16) #int(argv[1]))
1.28 stretch_depth = max_depth + 1
1.29
1.30 - print "stretch tree of depth %d\t check: %d" % (stretch_depth, check_tree(make_tree(0, stretch_depth)))
1.31 + #print "stretch tree of depth %d\t check: %d" % (stretch_depth, check_tree(make_tree(0, stretch_depth)))
1.32
1.33 long_lived_tree = make_tree(0, max_depth)
1.34
1.35 @@ -36,9 +37,9 @@
1.36 for i in xrange(1, iterations + 1):
1.37 check += check_tree(make_tree(i, depth)) + check_tree(make_tree(-i, depth))
1.38
1.39 - print "%d\t trees of depth %d\t check: %d" % (iterations * 2, depth, check)
1.40 + #print "%d\t trees of depth %d\t check: %d" % (iterations * 2, depth, check)
1.41
1.42 - print "long lived tree of depth %d\t check: %d" % (max_depth, check_tree(long_lived_tree))
1.43 + #print "long lived tree of depth %d\t check: %d" % (max_depth, check_tree(long_lived_tree))
1.44
1.45 if __name__ == '__main__':
1.46 main()