Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def breadth[A] (lt: lBT[A]) = {
- def aux(queue: List[lBT[A]]) : Stream[A] = {
- queue match {
- case (Nil) => Stream.empty
- case (LEmpty :: t) => aux (t)
- case (LNode(x, left, right) :: t) => Stream.cons(x, aux(t ::: List(left(), right())))
- }
- }
- aux (List(lt))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement