You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defes(p):
ifp==None: # controlo se radice dell'albero è sanza figlireturn0# questo contollo serve solo per la prima chiamataifp.left==Noneandp.right==None: # nodo senza filgireturn0ifp.letf!=Noneandp.right==None: # nodo con solo figlio sinistroreturnes(p.left)
# nodo con due figli (controllo se è valido)if (p.left.key<p.key<p.right.key) or (p.left.key>p.key>p.right.key):
return1+es(p.left) +es(p.right)
# nodo con due figli (ma non valido)returnes(p.left) +es(p.right)
Soluzione Prof
The text was updated successfully, but these errors were encountered: