Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def verifica(a,b):
- sx = verificaComodo(left(a),b,1)
- dx = verificaComodo(right(a),b,1)
- return sx or dx
- def verificaComodo(a,b,livello):
- t = trova(info(a),b,livello,0)
- if t == True:
- return True
- else:
- t_sx = False
- t_dx = False
- if not isNull(left(A)):
- t_sx = verificaComodo(left(a),b, livello+1)
- if not isNull(right(A)):
- t_dx = verificaComodo(right(a),b,livello+1)
- return t_sx or t_dx
- def trova(infoA,b,livello,current):
- if isNull(b) or livello <= current:
- return False
- if info(b) == infoA:
- return True
- return trova(infoA,left(b),livello, current + 1) or trova(infoA,right(b),livello, current + 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement