runnig

Untitled

Feb 1st, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. struct Path
  2. {
  3. Node * root; // the highest vertex in this path
  4. int score;
  5. Path(Node * n = NULL, int s = 0)
  6. : root(n), score(s) {}
  7. };
  8.  
  9. struct Return
  10. {
  11. Path arm; // a path that is left or right arm of future best path
  12. Path best; // complete subtree with the best score down below current node
  13. };
  14.  
  15.  
  16. Return maxSum(Node * n)
  17. {
  18. if(!n) { return Return(); }
  19. Return L = maxSum(n->left);
  20. Return R = maxSum(n->right);
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment