Tester si un arbre binaire est un abr

Fermé
luna1990 Messages postés 3 Date d'inscription jeudi 22 novembre 2012 Statut Membre Dernière intervention 28 novembre 2012 - 22 nov. 2012 à 19:22
Bonjour,

bonjour j'aimerai ecrire un sous programme recursif en java qui teste si un arbre binaire est un ABR voici ma proposition est ce qu'elle est juste?
type abr=^noeud;
noeud= record
val:element;
fg:abr;
fd:abr;
end;
function testerabr (a:abr):boolean;
begin
if (a= nil) then testerabr:= true
else
if (a^.val superieur a^.fd^.val) and (a^.val inferieur a^.fg^.val) then testerabr:= testerabr(a^.fd) and testerar(a^.fg)
else testerabr:= false;
end;