Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def is_fibonacci(t):
- if t==None:
- return True
- return (is_foglia(t) or abs(altezza(t.sx)-altezza(t.dx))==1) and is_fibonacci(t.sx) and is_fibonacci(t.dx)
- def is_foglia(t):
- return t.sx==None and t.dx==None
- def altezza(t):
- if t==None:
- return -1
- return max(altezza(t.sx),altezza(t.dx))+1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement