Problem Detail: e.g. $xy+x+y=x+y(x+1)$ ? The expressions are from ordinary high-school algebra, but restricted to arithmetic addition and multiplication (e.g. $2+2=4; 2.3=6$), with no inverses, subtraction or division. Letters are variables. If it helps, we can forbid any expression representable with Read More …
Blog
[Solved]: Combine abstract factory with decorator pattern
Problem Detail: I’m working on a simple project of software engineering that should combine two patterns. I choose Abstract Factory and Decorator patterns to modify (dynamically) objects created with the concrete Factory classes. My question is: is delegating object decorations to Read More …
[Solved]: Trouble understanding this dynamic programming solution
Problem Detail: Here is the question: I have a given tree with n nodes. The task is to find the number of subtrees of the given tree with outgoing edges to its complement less than or equal to a given number Read More …
[Solved]: Calculating time complexity of a code which may be incorrect
Problem Detail: I am a sophomore taking a course in algorithm analysis. We were asked by our professor to calculate time-complexity of several C functions, but some of them were incorrect and would result in a compile error. As far as Read More …
[Solved]: Recursive function calculating number of ways to sum $a + 2 b + 3 c = x$
Problem Detail: Using python need to code a recursive function with one input and no global integers that calculates the number of options to get $x$ using $a*1+b*2+c*3$. Say $x=3$, there are four options: $lbrace (1,1,1),(1,2),(2,1),(3)rbrace$. Asked By : yuvalz Answered By Read More …
[Solved]: Probability that a uniformly random sequence is already sorted
Problem Detail: Now I tried tackling this question from different perspectives (and already asked a couple of questions here and there), but perhaps only now can I formulate it well and ask you (since I have no good ideas). Let there Read More …
[Solved]: Is the Nearest Neighbor Algorithm a valid algorithm to find a Minimum Spanning Tree?
Problem Detail: I just wrote a program that runs the Travelling Salesman Problem using the Nearest Neighbor Algorithm. Afterwards, I started looking into Minimum Spanning Trees (MST). From my understanding: The Nearest Neighbor Algorithm traverses a graph starting at one vertex, Read More …
[Solved]: Is this method really uniformly random?
Problem Detail: I have a list and want to select a random item from the list. An algorithm which is said to be random: When you see the first item in the list, you set it as the selected item. When Read More …
[Solved]: What is the difference between oblivious and non-oblivious merging, sorting etc
Problem Detail: Algorithms can either be oblivious or non-oblivious, but what is the actual difference between the two? Asked By : Summer Answered By : Evil Oblivious means that the control flow is independent of some properties of data. For example Bitonic Sort Read More …
[Solved]: Big-Endian/Little-Endian argument – paper by Danny Cohen
Problem Detail: Reading a book I was redirected to “On holy wars and a plea for peace” paper by Danny Cohen, which covers the “holy war” between big-endians and little-endians considering byte-order. Reaching the summary of the memory section I got Read More …