Fixes two bugs that I somehow missed completely.

(Also removed leftover `time'.)
This commit is contained in:
Eli Barzilay 2010-06-20 23:57:04 -04:00
parent 84607b057c
commit acace4bc18

View File

@ -28,10 +28,10 @@
(define (check t)
(let loop ([t t] [acc 0])
(let ([acc (fx+ (leaf-val t) acc)])
(if (leaf? t)
acc
(loop (node-right t)
(fx+ acc (loop (node-left t) 0)))))))
(if (node? t)
(loop (node-left t)
(fx- acc (loop (node-right t) 0)))
acc))))
(define min-depth 4)
@ -54,4 +54,4 @@
max-depth
(check long-lived-tree)))))
(command-line #:args (n) (time (main (string->number n))))
(command-line #:args (n) (main (string->number n)))