Created
June 14, 2014 06:38
-
-
Save marcoscastro/08abd829a769e6dd1139 to your computer and use it in GitHub Desktop.
Haskell - Árvore Binária
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 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