Created
January 29, 2014 09:56
-
-
Save kunishi/8684877 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
datatype 'label btree = | |
Empty | | |
Node of 'label * 'label btree * 'label btree; | |
fun height(Empty) = 0 | |
| height(Node(x, l, r)) = | |
let | |
val hl = height(l); | |
val hr = height(r) | |
in | |
if hl > hr then hl+1 else hr+1 | |
end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment