Created
December 4, 2016 02:11
-
-
Save wkimeria/a7c23e0eae07290d0fec802e44d861a3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def size[A](tr: Tree[A]): Int = tr match{ | |
case Leaf(_) => 1 | |
case Branch(l, r) => 1 + size(l) + size(r) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment