Advertisement
Guest User

Untitled

a guest
Apr 9th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scheme 0.40 KB | None | 0 0
  1. (define (tree-min t)
  2.   (cond [(leaf? t) 0]
  3.         [(not (number? (node-val t))) false]
  4.         [(let ((min (node-val t))
  5.                (min-left (tree-min (node-left t)))
  6.                (min-right (tree-min (node-right t))))
  7.            (cond [(and (<= min min-left) (<= min min-right)) min]
  8.                  [(and (<= min-left min) (<= min-left min-right)) min]
  9.                  [else min-right]))]))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement