Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.29 KB | None | 0 0
  1. def breadth[A] (lt: lBT[A]) = {
  2.   def aux(queue: List[lBT[A]]) : Stream[A] = {
  3.     queue match {
  4.       case (Nil) => Stream.empty
  5.       case (LEmpty :: t) => aux (t)
  6.       case (LNode(x, left, right) :: t) => Stream.cons(x, aux(t ::: List(left(), right())))
  7.     }
  8.   }
  9.   aux (List(lt))
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement