Problem Detail: I need to create a recursive algorithm to see if a binary tree is a binary search tree as well as count how many complete branches are there (a parent node with both left and right children nodes) with Read More …
Category: Uncategorized
Algorithm to write a dictionary using thousands of words to find all anagrams for a given string with O(1) complexity
Problem Detail: Problem Statement: Suppose we have a thousands of words and we need to maintain these words in a data structure in such a way that we should be able to find all anagrams for a given string. I tried Read More …
Why won’t a Turing machine halt?
Problem Detail: I am reading Sipsers. The book introduces halting problem and proves that is a turing recognisable language but not a turing decidable language. Thus giving a Turing machine which does not halt on some inputs. The language to be Read More …
Best solutions to 6 degrees of separation
Problem Detail: From purely my knowledge of computer science a simple breadth first search from root A in search of node B, while keeping track of the depth of the tree, would be the most effective way to check whether A Read More …
How many minimal spanning trees are there when all edge costs are distinct?
Problem Detail: Suppose all costs on edges are distinct. How many minimal spanning trees are possible? I dont know if this question is supposed to be easy or hard, but all I can come up with is one, because Kruskal’s, and Read More …
Reachable state space of an 8-puzzle
Problem Detail: I’ve just began studying Artificial Intelligence and am wondering why the reachable state space of an 8-puzzle is $9!/2$. I see that the number of permutations of the tiles is $9!$ but it is not immediately obvious why half Read More …
Is the open question NP=co-NP the same as P=NP?
Problem Detail: I’m wondering this based on several places online that call $sf NP=$ co-$sf NP$ a major open problem… but I can’t find any indication as to whether or not this is the same as $sf P=NP$ problem… Asked By Read More …
If all edges are of equal weight, can one use BFS to obtain a minimal spanning tree?
Problem Detail: If given that all edges in a graph $G$ are of equal weight $c$, can one use breadth-first search (BFS) in order to produce a minimal spanning tree in linear time? Intuitively this sounds correct, as BFS does not Read More …
Are there inherently ambiguous and deterministic context-free languages?
Problem Detail: Let us call a context-free language deterministic if and only if it can be accepted by a deterministic push-down automaton, and nondeterministic otherwise. Let us call a context-free language inherently ambiguous if and only if all context-free grammars which Read More …
If A is mapping reducible to B then the complement of A is mapping reducible to the complement of B
Problem Detail: I’m studying for my final in theory of computation, and I’m struggling with the proper way of answering whether this statement is true of false. By the definition of $leq_m$ we can construct the following statement, $w in A Read More …