Find the maximum sum path in a Binary Tree


    public static int maxSumPath(Node node){
        if(node != null){
             int l = maxSumPath(node.left);
             int r = maxSumPath(node.right);
             return Math.max(l, r) + node.data;
        }
        return 0;
    }
    Test it
    1. Generate a binary tree
    2. Run through it
    Node node = geneBin();
    int n = maxPath(node);
    pp("n=" + n); // n = 25