Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Last active December 18, 2015 10:19
Show Gist options
  • Save grauwoelfchen/5767855 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/5767855 to your computer and use it in GitHub Desktop.
(define (bst-insert e bst)
(cond
[(t-empty? bst) (t-node e t-empty t-empty)]
[(< e (t-value bst))
(t-node
(t-value bst)
(bst-insert e (t-left bst))
(t-right bst))]
[else
(t-node
(t-value bst)
(t-left bst)
(bst-insert e (t-right bst)))] ))
(print (bst-insert 4 my-tree))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment