Created
September 8, 2011 17:15
-
-
Save rafaelreuber/1203967 to your computer and use it in GitHub Desktop.
Algoritmo de altura
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
function height(root){ | |
if(root.isLeaf()) { //Se for folha | |
return 0; | |
} | |
else { | |
var h = 0; | |
h = Math.max(height(root.left),h); | |
h = Math.max(height(root.right),h); | |
return h + 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment