Skip to content

Instantly share code, notes, and snippets.

@kunishi
Created January 29, 2014 09:56
Show Gist options
  • Save kunishi/8684877 to your computer and use it in GitHub Desktop.
Save kunishi/8684877 to your computer and use it in GitHub Desktop.
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