\*Tentei desenvolver alguns metodos, não testei nenhum, se alguem puder dra uma força, agradeço...*/
Mostre_pre(raiz)
{
if(raiz=!NULL)
{
cout<
Mostre_pre(raiz-getEsq());
Mostre_pre(raiz-getDir());
}
}
Mostre_pos(raiz)
{
if(raiz=!NULL)
{
Mostre_pre(raiz-getEsq());
Mostre_pre(raiz-getDir());
cout<
}
}
Mostre_centro(raiz)
{
if(raiz=!NULL)
{
Mostre_pre(raiz-getEsq());
cout<
Mostre_pre(raiz-getDir());
}
}
//1
Max(raiz)
{
if(raiz!=NULL)
{
int max = raiz->getValor();
Max(raiz->getDir());
}
return max;
}
//2
Min(raiz)
{
if(raiz!=NULL)
{
int min = raiz->getValor();
Max(raiz->getEsq());
}
return min;
}
//3
Quant(raiz)
{
int cont=1;
if(raiz=!NULL)
{
Quant(raiz->getEsq());
Quant(raiz->getDir());
}
cont++;
return cont;
}
//4
Altura(raiz)
{
int cont=0;
if(raiz!=NUll)
Quant(raiz->getEsq());
else
Quant(raiz->getDir());
cont++;
return cont;
}
segunda-feira, 13 de agosto de 2007
Exercício proposto
Postado por
DVD
às
23:14
Assinar:
Postar comentários (Atom)
Nenhum comentário:
Postar um comentário