Last active
December 31, 2015 11:39
-
-
Save shehaaz/7980715 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
let rec trace_insert ((x,d) as e) t = match t with | |
| Empty -> (Node(e,Empty,Empty), H x) | |
| Node((y,d'),l,r) -> if (y=x) then (Node(e,l,r),H x) | |
else if x<y then | |
let(t',tr) = trace_insert e l in ( Node((y,d'),t',r), L(y,tr) ) | |
else | |
let(t',tr) = trace_insert e r in ( Node((y,d'),l,t'), R(y,tr) ) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment