#!/usr/bin/env python import sys import os """ Author : flo date : 2016.12.09 Purpose : example of finding the minimal number of AVL tree Node : equation: S(h) = S(h-1) + S(h-2) + 1 Comments: it is recursive function messiness : first rename this file from avlTree2.txt to avlTree.py : that value 6 is needed, it is the height of a AVL tree starting with 0 : S(0) = 1; S(1) = 2 : if you can crank 'python avlTree2.py 50' or 100 within an hour, : that is one extremely Powerful PC, you got there. usage : python avlTree2.py 6 """ def prtAVLCompute(n): if n==0: return 1 elif n==1: return 2 else: return prtAVLCompute(n-1)+prtAVLCompute(n-2) + 1 def main(): value = int(sys.argv[1]) print prtAVLCompute(value) # added proper main function if __name__ == "__main__": main()