Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (define (tree-count-min n) (cond
- [(<= n 1) n]
- [true (/ (/ (factorial (tree-count-min-helper n 1)) (factorial (+ (- n (tree-count-min-helper n 1)) 1))) (factorial (- (- (* 2 (tree-count-min-helper n 1)) n) 1)))]))
- (define (tree-count-min-helper n m) (if (<= m n) (tree-count-min-helper n (* m 2)) (/ m 2)))
- (define (factorial n) (cond
- [(<= n 1) n]
- [true (* n (factorial (- n 1)))]))
Advertisement
Add Comment
Please, Sign In to add comment