Skip to content

Instantly share code, notes, and snippets.

@nrolland
Created September 16, 2012 08:47
Show Gist options
  • Save nrolland/3731642 to your computer and use it in GitHub Desktop.
Save nrolland/3731642 to your computer and use it in GitHub Desktop.
insertbst
let rec insertBST x = function
| Leaf -> Branch(x , Leaf, Leaf)
| Branch(v, l, r) when x < v -> Branch(v, insertBST x l, r )
| Branch(v, l, r) as b when x > v -> Branch(v, l, insertBST x r )
| b -> b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment