Problem Detail: Given the PDA $P = (Q_P,Sigma,Gamma_P,delta_P,F_P)$ and the DFA $D = (Q_D, Sigma, delta_D,q_D,F_D)$ What is the 6-tuple definition of the PDA such that: $L(P’) = L(P) cap L(D)$ I don’t understand what the intersection of these two FAs Read More …
Category: Uncategorized
[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]: 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]: 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]: 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]: 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]: Is there an efficient algorithm for expression equivalence?
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 …
[Solved]: Reducing optimization problem to decision problem
Problem Detail: I’m trying to reduce an optimization problem to a decision problem, more specifically, consider the Max-Cut problem in its decision version: Given $(G=(V,E),k)$ as input, where $G$ is an undirected weighted graph (all weights are positive integers, formally: $w: Read More …
[Solved]: Optimal myopic maze solver
Problem Detail: I was fooling around with Google Blocky’s Maze demo, and remembered the old rule that if you want to solve a maze, just keep your left hand to the wall. This works for any simple-connected maze and can be Read More …
[Solved]: EXPTIME vs Super-polynomial time
Problem Detail: It is proven by Time hierarchy theorem that EXPTIME-complete do not belong to P even if we do not know if NP belong to P. Before I read wiki, I found EXPTIME algorithm for solving 3-sat, the brute algorithm Read More …