-
-
Save bradclawsie/9635492 to your computer and use it in GitHub Desktop.
balanced search tree
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
data Tree = Empty | Node Tree Int Tree deriving (Show) | |
insert n Empty = Node Empty n Empty | |
insert n (Node l i r) = if n <= i then Node (insert n l) i r else Node l i (insert n r) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment