Skip to content

Instantly share code, notes, and snippets.

@rafaelreuber
Created September 8, 2011 17:15
Show Gist options
  • Save rafaelreuber/1203967 to your computer and use it in GitHub Desktop.
Save rafaelreuber/1203967 to your computer and use it in GitHub Desktop.
Algoritmo de altura
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