Problem Detail: I have this context-free grammar and I want to find out whether its language is finite or infinite. S -> XY|bb Step 1 X -> XY|SS Step 2 Y -> XY|SS Step 3 So I would do S -> Read More …
Author: ignougroup
Why do compilers produce assembly code?
Problem Detail: Assembly language is converted in to machine language by assembler. Why would a compiler convert high-level language to assembly? Can’t it directly convert from the high-level language to machine code? Asked By : CODERSAM Answered By : Martin Berger Other reason Read More …
Iterative and/or tail-recursive implementations of merge sort?
Problem Detail: I recently learned how to implement merge-sort, using a standard recursive algorithm. Can the algorithm be implemented in a way that allows for a tail-recursive implementation? Can it be implemented in an iterative style? In general how can a Read More …
Uniform sampling from a simplex
Problem Detail: I am looking for an algorithm to generate an array of N random numbers, such that the sum of the N numbers is 1, and all numbers lie within 0 and 1. For example, N=3, the random point (x, Read More …
Difference between regular expression and grammar in automata
Problem Detail: I am new to automata, and I have been given a brief introduction to regular expressions only yesterday. I have read the various rules which to define a regular expression. But I am unable to differentiate between regular expressions Read More …
DFS – Proof of Correctness
Problem Detail: I’m currently studying the book “Introduction to Algorithms – Cormen”. Although a proof of correctness for the BFS algorithm is given, there isn’t one any for the DFS in the book. So I was courious about how it can Read More …
Why we do isomorphism, automorphism and homomorphism?
Problem Detail: What are the key differences between these three terms isomorphism, automorphism and homomorphism in simple layman language and why we do isomorphism, automorphism and homomorphism ? Asked By : Xara Answered By : Jernej Isomorphism formalizes the notion of equal graphs. Read More …
Push down automata for ${a^n b^n c^n | n ge 0}$
Problem Detail: I am learning about context free languages. I understand how ${a^n b^n c^n | n ge 0}$ can be shown to be not context free using the pumping lemma for CFL’s. Intuitively however it seems that a pushdown automata Read More …
What does a polynomial time reduction mean?
Problem Detail: I am having a little trouble understanding what is meant by a poly-time reduction. Suppose I have two algorithms $A$ and $B$ and then I say that $A$ is reducible to $B$. Does polytime reduction mean that the algorithm Read More …
What is the time complexity of generating n-th prime number?
Problem Detail: Say I want to find the n-th prime. Is there an algorithm to directly calculate it or must I do with sieving? I know always calculate the next prime with a sieve principle, but what if I want the Read More …