Problem Detail: I’m writing a compiler, and I’ve built a recursive-descent parser to handle the syntax analysis. I’d like to enhance the type system to support functions as a valid variable type, but I’m building a statically typed language, and my Read More …
Category: Uncategorized
[Solved]: Recursive language subtracted from recursively enumerable language
Problem Detail: This is a homework problem but I am awfully confused. The problem reads as follows: If $L_1$ is recursively enumerable but not recursive, and $L_2$ is recursive, then which of the following is the strongest true statement about the Read More …
[Solved]: Why is b-tree search O(log n)?
Problem Detail: B-tree is a data structure, which looks like this: If I want to look for some specific value in this structure, I need to go through several elements in root to find the right child-node. The I need to Read More …
[Solved]: Deleting useless (dead) states from a finite automaton
Problem Detail: A useless state in a finite automaton is one from which no path leads to a final state, hence no (piece of a string) is recognized out of this state. Theoretically, the algorithm to determine the useful states is Read More …
[Solved]: Shannon-Fano puzzle
Problem Detail: I was playing around with Shannon-Fano (SF) entropy encoding when I ran into this issue. I am aware that the compression that can be achieved with SF is sometimes inferior to that of Huffman encoding, but I just though Read More …
[Solved]: A text-classifier that explains its decisions
Problem Detail: I am building a text categorizer for short sentences. In addition to telling the user “the category of the text you entered is C”, I want to be able to explain why I made this decision, in a short Read More …
[Solved]: How can I quantify the number of swaps required for insertion sort?
Problem Detail: Based on the Wikipedia implementation of insertion sort: Given an input array $A$: for i ← 1 to length(A) j ← i while j > 0 and A[j-1] > A[j] swap A[j] and A[j-1] j ← j – 1 Read More …
[Solved]: Synchronization using serialization
Problem Detail: How can someone synchronize two or more threads using serialization? According to my professor’s slides and code assignments you can use serialization to solve the synchronization problem. (He doesn’t explain what serialization is). I tried to do my research Read More …
[Solved]: Is “Find the shortest tour from a to z passing each node once in a directed graph” NP-complete?
Problem Detail: Given a directed graph with the following attributes: – a chain from node $a$ to node $z$ passing nodes $b$ to $y$ exists and is unidirectional. – additionally a set of nodes having bidirectional vertices to at least two Read More …
[Solved]: regular expression given the language
Problem Detail: The language is: $$ L = { (a^n) (b^m) mid n + m = 3k, k ge 0 } $$ My attempt at an answer: $$ (a cup b)^{3k} $$ This will work if the a OR b can Read More …