(define (fringe tree)
(cond
((null? tree) '())
((pair? tree)
(append (fringe (car tree)) (fringe (cdr tree))))
(else (list tree))))
Used wishful thinking here. I thought like this, If we knew the fringes of left and right subtree then the answer would be to just append them and this does the trick :).
No comments:
Post a Comment