Problem Detail: I would like to ask a question about multiple return values, why this construct is not preferrable in programming languages (conceptual and/or technical difficulties). I’ve heard something about stack frames and how they reserve memory for return value and Read More …
Author: ignougroup
[Solved]: How many edges can a unipathic graph have?
Problem Detail: A unipathic graph is a directed graph such that there is at most one simple path from any one vertex to any other vertex. Unipathic graphs can have cycles. For example, a doubly linked list (not a circular one!) Read More …
[Solved]: Scala as a language for Generic Programming
Problem Detail: I posted the same Q at programmers.SE, but nobody really helps. In the paper “An Extended Comparative Study of Language Support for Generic Programming” by Garcia et al. an interesting comparison of programming languages features for generic programming is Read More …
[Solved]: Sort algorithm input probabilities
Problem Detail: Suppose that there is an algorithm which sorts a sequence of $n$ elements $$a_1, a_2, …, a_n$$ Each of the $a_i$ is chosen with probability $1/k$ from a set of $k$ distinct integer numbers. Is it true, given that 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 …
[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]: 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]: 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]: 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]: 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 …