lambda,functional-programming,computation-theory

It seems what you are looking for is predicates, which is nothing but a formal form of questions for which the response/answer is YES (True) or NO (False). Check out the Logic and Predicate section at http://en.wikipedia.org/wiki/Lambda_calculus#Logic_and_predicates....

algorithm,complexity-theory,combinatorics,computation-theory

This is NP-Complete problem, and is a generalization of Hitting Set Problem. Proof of NP-Completeness follows. The problem is in NP (trivial - given a solution T, it is easy to check the intersection with each of Gi, and verify if its size is Ci). It is also NP-Complete, assuming...

Ambiguity problems are not related to your syntax errors. Consider this: while : 'w' 'h' 'i' 'l' 'e' ';' | name ':' 'w' 'h' 'i' 'l' 'e' expression ';' ; Something is missing in one of the alternatives. You want to loop while something when labeled, and while nothing when...

python,algorithm,sorting,time-complexity,computation-theory

The "similarity" (?!) that you see is completely illusory. The elementary, O(N squared), approaches, repeat their workings over and over, without taking any advantage, for the "next step", of any work done on the "previous step". So the first step takes time proportional to N, the second one to N-1,...

recursion,logic,computation-theory,halting-problem

That proof does not require recursion. You are missing the point! You don't call paradox, but pass it like a higher order function. Take this function in Scheme and it's usage: ;; does operation passed as x to 2 and 5 (define (do2by5 x) (x 2 5)) ;; examples (do2by5...

math,computation-theory,turing-machines

The notation wR probably means “w reversed.” The problem most likely asks that the Turing machine shall, if it starts with a word w on its tape, append a # and then w reversed. Afterwards, it shall accept (i.e. terminate). For instance, if the tape contains example in the beginning,...

computation-theory,turing-machines,np-complete,np,decidable

This statement is false. Since 3SAT is NP-complete, every problem in NP polynomial-time reduces to 3SAT, so if you choose any language in NP, then it will polynomial-time reduce to 3SAT. In particular, if you choose the empty language ∅, which is known not to be NP-complete, then ∅ ∈...

This is an interesting problem. There are a couple of different things going on here. One issue is how to describe the sequence of operations and operands that go into an arithmetic expression. Using parentheses to establish order of operations is quite messy, so instead I suggest thinking of an...

matlab,vectorization,computation-theory

Try this: expFun = @(size)exprnd(0.1,size,1); index = [10 20 30 40]; data = cellfun(expFun,mat2cell(index,ones(size(index,1),1),ones(1,size(index,2))),'UniformOutput',false); ...

compiler-construction,programming-languages,computation-theory,memory-model,turing-complete

If by stack you mean the abstract data type which can only be accessed at the top, you're looking at pushdown automata. Deterministic PDAs can only handle deterministic context-free languages, non-deterministic PDAs all context-free languages, so they are not Turing complete. However, the "stack" in real computer architectures is not...

mapping,combinatorics,computation-theory,np-complete,set-theory

You could create a bipartite graph in the following manner: For each element in the set X create a node in the U disjoint set of the graph For each subset in the set S create a node in the V disjoint set of the graph If element of X...