previous | index | next

Tracing in?

     (define bushy-tree (list->bstree '(7 5 3 1 6 2 4)))
     (define branchless-tree (list->bstree '(1 2 3 4 5 6 7)))

     (trace in?)

     (in? 0 bushy-tree)
     |(in? 0 (4 (2 (1 () ()) (3 () ())) (6 (5 () ()) (7 () ()))))
     |(in? 0 (2 (1 () ()) (3 () ())))
     |(in? 0 (1 () ()))
     |(in? 0 ())
     |#f
     #f

     (in? 0 branchless-tree)
     |(in? 0 (7 (6 (5 (4 (3 (2 (1 () ()) ()) ()) ()) ()) ()) ()))
     |(in? 0 (6 (5 (4 (3 (2 (1 () ()) ()) ()) ()) ()) ()))
     |(in? 0 (5 (4 (3 (2 (1 () ()) ()) ()) ()) ()))
     |(in? 0 (4 (3 (2 (1 () ()) ()) ()) ()))
     |(in? 0 (3 (2 (1 () ()) ()) ()))
     |(in? 0 (2 (1 () ()) ()))
     |(in? 0 (1 () ()))
     |(in? 0 ())
     |#f
     #f
Moral: Bushy (i.e. balanced) trees are more efficient.

previous | index | next