Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Created June 14, 2014 06:38
Show Gist options
  • Save marcoscastro/08abd829a769e6dd1139 to your computer and use it in GitHub Desktop.
Save marcoscastro/08abd829a769e6dd1139 to your computer and use it in GitHub Desktop.
Haskell - Árvore Binária
data ArvBin = Nulo | No Int ArvBin ArvBin
arv :: ArvBin
arv = (No 1
(No 2
(No 4 Nulo Nulo) (No 5 Nulo Nulo))
(No 3
(No 6 Nulo Nulo) Nulo))
em_ordem :: ArvBin -> [Int]
em_ordem Nulo = []
em_ordem (No num esq dir) = (em_ordem esq) ++ [num] ++ (em_ordem dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment