Problem Detail: I wonder how I can go about proving that if a language L is decidable in o(nlog(n)) then L must be regular. I should probably mention that by “decidable” I mean “being decidable by single-tape deterministic turing machine”. Thanks Read More …
Blog
[Solved]: A regular expression for a given formal language
Problem Detail: I wanted to ask if someone can help me to construct a regular expression over the alphabet ${a,b,x}$ for the language $L$ which is constituted by all strings containing an odd number of $a$’s, and in which between each Read More …
[Solved]: Example for the analysis of a recursive function
Problem Detail: l is a matrix of size [1…n, 1…n] function: rec(i,j) if (i*j == 0) return 1 else if (l[i,j] == 0) l[i,j] = 1 * rec(i-1,j) + 2 * rec(i,j-1) + 3 * rec(i-1,j-1) return l[i,j] end_function for Read More …
[Solved]: NSPACE for checking if two graphs are isomorphic
Problem Detail: I was studying nondeterministic Turing Machines and came across the following question: Describe a nondeterministic Turing Machine (NTM) that only accepts two graphs (G1 and G2) if they are isomorphic, and provide the NSPACE. The NTM should use as Read More …
[Solved]: Is a balanced binary tree a complete binary tree?
Problem Detail: Considering that the opposite is true it’s not mentioned anything about this. I am assuming its not, but I need a very good distinction between these two types of binary trees. All I know is this: A binary tree Read More …
[Solved]: Calculating modulus of large non-factored numbers
Problem Detail: The internet is full of algorithms to calculate the modulo operation of large numbers that have the form $a^e bmod p$. How about numbers with unknown factorization. More precisely, let’s say I have a 4-byte sized modulus prime $p$, Read More …
[Solved]: A* optimality of the expanded node
Problem Detail: Suppose I have a admissible and consistent heuristic. Is it true, that when I expand a node, I have guaranteed that the path I found to this node is optimal? Look at this pseudocode from wikipedia: function A*(start,goal) closedset Read More …
[Solved]: The operator $A(L)= {w mid ww in L}$
Problem Detail: Consider the operator $A(L)= {w mid ww in L}$. Apparently, the class of context free languages is not closed against $A$. Still, after a lot of thinking, I can’t find any CFL for which $A(L)$ wouldn’t be CFL. Does Read More …
[Solved]: Preprocess an array for counting an element in a slice (reduction to RMQ?)
Problem Detail: Given an array $a_1,ldots,a_n$ of natural numbers $leq k$, where $k$ is a constant, I want to answer in $O(1)$ queries of the form: “how many times does $m$ appear in the array between indices $i$ and $j$”? The Read More …
[Solved]: Finding asymptotically tight bounds $Theta$ of two procedures
Problem Detail: I would like to check time complexity of two procedures for which I am not totally convinced that I got it right. Now the first procedure is this: public static int c(int n) { int i, j, s = Read More …