Problem Detail: I think it stores the address of the current instruction. And if this instruction is completed the program counter is incremented by 1, to get the next instruction. But now my question is, how do you increment the program Read More …
Category: Uncategorized
Context Free Grammar for language $L={a^ib^j mid i,j ge 0; i ne 2j}$
Problem Detail: Can someone help with this: $L={a^ib^j mid i,j ge 0 text{ and } i ne 2j}$ I’m trying to write a grammar for this language? I don’t know how to do this. I tried this: $S rightarrow aaAb mid Read More …
Context-free Languages closed under Reversal
Problem Detail: In class this week we’ve been learning about the CFLs and their closure properties. I’ve seen proofs for union, intersection and compliment but for reversal my lecturer just said its closed. I wanted to see the proof so I’ve Read More …
Finding negative cycles for cycle-canceling algorithm
Problem Detail: I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each round. To find a negative Read More …
Proving a binary tree has at most $lceil n/2 rceil$ leaves
Problem Detail: I’m trying to prove that a binary tree with $n$ nodes has at most $leftlceil frac{n}{2} rightrceil$ leaves. How would I go about doing this with induction? For people who were following in the original question about heaps, it Read More …
What is the Relationship Between Programming Languages, Regular Expressions and Formal Languages
Problem Detail: I’ve looked around the net for an answer to this question and it seems as if everybody implicitly knows the answer except me. Presumably this is because the only people who care are those who have had tertiary education Read More …
Mastermind (board game) – Five-guess algorithm
Problem Detail: The algorithm (from here) – Create a set S of remaining possibilities (at this point there are 1296). The first guess is aabb. Remove all possibilities from S that would not give the same score of colored and white Read More …
Program compilation and execution flow
Problem Detail: I was studying operating system concepts from Silberschatz, Galvin and Gagne’s book (sixth edition) and I have some questions about the flow of execution of a program. A figure explains the processing of the user program: We get an Read More …
How to define quantum Turing machines?
Problem Detail: In quantum computation, what is the equivalent model of a Turing machine? It is quite clear to me how quantum circuits can be constructed out of quantum gates, but how can we define a quantum Turing machine (QTM) that Read More …
Algorithm to add sum of every possible xor-sum sub-array
Problem Detail: I participated in one algorithmic competition. I got stuck in one problem, I am asking the same here. Problem Statement XOR-sum of a sub-array is to XOR all the numbers of that sub-array. An array is given to you, Read More …