Problem Detail: We have a broken stick. For every part, we know it’s length. Our task is to connect all parts (glue them), that we will use as small amount of glue as possible. The amount of glue need to connect Read More …
Blog
[Solved]: Regular expressions and semi-linear sets
Problem Detail: In proving Parikh’s Theorem, my Theory of Computer Science textbook defines a linear set as: $u_0 + langle u_1, dots, u_m rangle = {u_0 + a_1u_1 + dots + a_mu_m mid a_1, dots, a_m in mathbb{N}}$ where $u_i$ are Read More …
[Solved]: DFA with limited states
Problem Detail: Lets $L_z := { a^i b^i c^i : 0 leq i < z }$ ${a,b,c} in sum^*$ there is a DFA with $frac{z(z+1)}{2}+1$ states – How can I prove this? And I need largest possible number $n_z$, for which Read More …
[Solved]: Closing shapes at non-endpoints
Problem Detail: Consider how one would represent the following image in vector graphics: Pretty simple, right? The entire shape can be represented by a single path element. But suppose additionally that you want to color the heart at the top red. Read More …
[Solved]: Checking whether all integers appear exactly once
Problem Detail: Let $texttt{a[]}$ be a finite array. We want to check whether every number between $texttt {min(a[])}$ and $texttt {max(a[])}$ appears exactly once. An obvious solution is sorting the array in time $O(nlog(n))$ and go through the sorted array in Read More …
[Solved]: Where does the lg(lg(N)) factor come from in Schönhage–Strassen’s run time?
Problem Detail: According to page 53 of Modern Computer Arithmetic (pdf), all of the steps in the Schönhage–Strassen Algorithm cost $O(N cdot lg(N))$ except for the recursion step which ends up costing $O(Ncdot lg(N) cdot lg(lg(N)))$. I don’t understand why the Read More …
[Solved]: Set combination data structure (And storage complexity)
Problem Detail: I have already posted this question on Stackoverflow, but I’m starting to think that this is the right place. I have a problem where I am required to associate unique combinations from a set (unique subsets) to a given Read More …
[Solved]: Theta Runtime of Nested for Loops
Problem Detail: I have two for loops, one nested within the other. I have two int variables n and U, where U > n. I know that the outer loop runs exactly U times (pretty much for(int i = 0; i Read More …
[Solved]: Why does the map function in MapReduce take two parameters?
Problem Detail: I am playing around with MapReduce and wanted to ask why the map function takes two inputs (key, value)? Why not just pass along the value? Specifically, if you look at the word count example on Wikipedia page you Read More …
[Solved]: Calculating genus of graph
Problem Detail: How to calculate genus of arbitrary graph? I am interested in any algorithm, even it based on full search. Asked By : Interloper Answered By : Rick Decker One way that always works and is relatively easy to turn into code Read More …