data Tree a = Nil | Branch (Tree a) a (Tree a) bfs t = [x | Branch _ x _ <- b] where b = t:[x | Branch l _ r <- b, x <- [l,r]]
bfs t = [x | Branch _ x _ <- b [t]] where b [] = [] b ts = ts ++ b [x | Branch l _ r <- ts, x <- [l,r]]
no subject
Date: 2011-12-21 05:13 pm (UTC)