davegimo

Untitled

Sep 26th, 2023
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def verifica(A,B):
  2. return verifica2(A,B) >= 2
  3.  
  4. def verifica2(A,B):
  5. if empty(A):
  6. return 0
  7.  
  8. conta = 0
  9.  
  10. if contenuto(B,info(a)):
  11. conta += 1
  12.  
  13. return conta + verifica2(left(A),B) + verifica2(right(A),B)
  14.  
  15.  
  16. def contenuto(A,v):
  17. if empty(A):
  18. return False
  19. if info(A) == v:
  20. return True
  21. return contenuto(left(A),v) or contenuto(right(A),v)
Advertisement
Add Comment
Please, Sign In to add comment