Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def conta(A,min,max):
- return matteo(A,min,max,0)
- def matteo(A,min,max,livello):
- if A.left == null and A.right == null:
- if livello%2 == 1 and A.val%2 == 0 and nonAppartiene(min,max,A.val):
- return A.val
- else:
- return 0
- conta = 0
- if livello%2 == 1 and A.val%2 == 0 and nonAppartiene(min,max,A.val):
- conta += A.val
- if A.left != null:
- conta += matteo(A.left,min,max,livello+ 1)
- if A.right != null:
- conta += matteo(A.right,min,max,livello+ 1)
- return conta
Advertisement
Add Comment
Please, Sign In to add comment