The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
2answers
56 views

Given a tree calculating Max Sum from top to bottom suing DFS? optimization?

given a tree i want to calculate max sum of each path from top to bottom. I used DFS for the operation. Here is the function which takes root as input and gives max sum of the path from top to bottom ...
1
vote
1answer
102 views

Why does this recursion method work? I have explored it for a day or two, and I cannot figure out why

Problem Statement: I have a tree with node values ( i , j ) where i , j < 1. The children of each node take on the values (i - 1, j), (i - 1, j - 1), and (i, j - 1) respectively. Now, i and j have ...
0
votes
0answers
32 views

What's the bound of the following recurrence?

Given the following recurrence: T(n) = T(n-1) + n^2 How can I prove it to be O(n^3) with the substitution method? The O(n^3) guess derives from the fact that at every step of the recursion we pay ...
0
votes
0answers
84 views

Software paradigms: prove that sum and sum1 are equal

Here are given two functions that calculate the sum of elements in a list. The proof should be done using induction. The hypothesis is: sum(as) = sum1(as, 0) def sum( as : List [ Int ] ) : Int = as ...
0
votes
0answers
34 views

build list of possible permutations with dynamic set size

I'm trying to develop code/pseudocode to build a list of all permutations given the following data. I'm developing in a java-like language for a web app. I don't have any java libraries for this ...