Problem Detail: I am currently bushing up on my data structures and basic algorithms, part of that is the Binary Tree. I do understand the algorithms, and how to implement a binary search tree and such. I do so how smart Read More …
Author: ignougroup
How does the Program Counter work?
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 …
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 …
Is every regular language Turing-decidable, and how can we prove this?
Problem Detail: I know every regular language is Turing-acceptable, but does that imply it is Turing-decidable? Asked By : Iancovici Answered By : Mandar Mitra Every regular language is Turing-decidable and therefore Turing acceptable / recognisable (but note that Turing acceptable does not Read More …
Is the halting problem decidable for pure programs on an ideal computer?
Problem Detail: It’s fairly simple to understand why the halting problem is undecidable for impure programs (i.e., ones that have I/O and/or states dependent on the machine-global state); but intuitively, it seems that a pure program’s halting on an ideal computer 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 …