Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

New answers tagged

1

The maximum spanning tree is about summing weights; maximizing the probability is about multiplying weights. To convert multiplication to sums, take the logarithm. Hopefully that's enough for you to work out an algorithm for this task.


1

On the one hand, clearly $T(n) \geq n$ (see detailed proof below). On the other hand, let us find prove by induction that $T(n) \leq Cn$, for large enough $C$. The base case trivially holds for $C \geq T(1)$. For the inductive step, we have $$ T(n) = T(n/2) + T(n/3) + n \leq C\cdot (n/2) + C\cdot (n/3) + n = [\tfrac{5}{6}C+1]n. $$ (We're cheating here a bit ...


0

I am not aware of any standard name for that kind of tree. One of the wonderful things about language is that we can describe things we don't already have a name for; there are many more interesting concepts than there are pre-existing widely-recognized names. I recommend that, if you find in your writing you need a concise name for it, you choose a name ...


0

Defining base cases: $T(0) = 0;$ $T(1) = 0;$ I got: $$ T(n) = n \; (\sum_{r = 0}^{log_3 \; {n}} [ \binom{log_3 \; {n}}{r} \; log_2 \; [{(\frac{2}{3})^r \; n}] \; + \; \sum_{r = 0}^{log_2 \; {n}} [ \binom{log_2 \; {n}}{r} \; log_2 \; [{(\frac{3}{2})^r \; n}]) $$ $$ $$ You can do the approximation & the bounding yourselves. Sorta took me longer to ...


1

Preorder traversal: This traversals always yield unique binary trees. (proof for this remains. To me it seems that it is correct due to procedure to construct tree that follows. However it might not be the case.) For instance consider traversal sequence $6,5,N,N,5,3,N,N,2,N,N$. We can proceed as follow to construct binary tree. First symbol is ...


1

I'm not entirely sure of what you're asking for, but I think it might be one of these three: Permutations that preserve topological structure The tree you listed in parenthetical notation is (5 (2 (1 4) ) (3) (5 (6 (7 (8) ) ) ). Are you looking for permutations of this tree structure, because you can simply calculate all n! permutations of nodes and put ...


2

Relax every edge of $𝐺$ exactly once, if any distance values change, then the shortest path tree given is wrong, if all stay the same then it is correct. Referring to this statement: As in Bellman-Ford, we run the algorithm $|V|-1$ times to compute the single-source shortest path. After this, we run the same algorithm once to check whether any relaxation ...


Top 50 recent answers are included