Exemplos de Algoritmos Básicos com Árvores
From Wiki**3
Contagem de elementos de uma árvore binária.
size_t count(link h) {
if (!h) return 0;
return 1 + count(h->l) + count(h->r);
}
Cálculo da altura de uma árvore binária.
size_t height(link h) {
int hl, hr;
if (!h) return 0;
hl = height(h->l);
hr = height(h->r);
return 1 + max(hl, hr);
}