Last active
          May 11, 2016 09:15 
        
      - 
      
- 
        Save fluffywaffles/043b92c285c401bf43a40ec64df36028 to your computer and use it in GitHub Desktop. 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | def recursive_size(s, nodes): | |
| ''' | |
| tail recursive size | |
| ''' | |
| num = len(nodes) | |
| if (num == 0): return s | |
| children = n.children.values() | |
| return sum([ recursive_size(s + num, children) for n in nodes ]) | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment