size of the tree
def size[T] (tree: Tree[T]) = | |
fold(tree, 0: Int){(l,x,r) => l + r + 1} | |
scala> size(t1) | |
res11: Int = 7 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment