Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def sommaNodi(A):
- if isNull(left(A)) and isNull(right(A)): #nodo foglia --> passo base!
- return info(A)
- somma = info(A)
- if not isNull(left(A)):
- somma += sommaNodi(left(A))
- if not isNull(right(A)):
- somma += sommaNodi(right(A))
- return somma
- def sommaNodiPRO(A):
- if isNull(A):
- return 0
- return info(A) + sommaNodiPRO(left(A)) + sommaNodiPRO(right(A))
Add Comment
Please, Sign In to add comment