Problem Detail: The $n$th Fibonacci number can be computed in linear time using the following recurrence: def fib(n): i, j = 1, 1 for k in {1…n-1}: i, j = j, i+j return i The $n$th Fibonacci number can also be Read More …
Category: Uncategorized
[Solved]: How To Best Learn About Algorithms In Depth
Problem Detail: I have been reading this site with a great deal of interest, but I find a lot of it goes over my head. This has made me wish to learn a lot more about algorithms and CS in general. Read More …
[Solved]: Understanding the definition of reduction
Problem Detail: From Wikipedia: Given two subsets A and B of N and a set of functions F from N to N which is closed under composition, A is called reducible to B under F if $$ exists f in F Read More …
[Solved]: Why does a suffix tree have a linear number of nodes (relative to input string size)?
Problem Detail: Aren’t there $n^2$ unique substrings of a string (irrespective of the alphabet size)? Perhaps the number of unique suffix substrings is less than the number of unique substrings of a string. Asked By : Wuschelbeutel Kartoffelhuhn Answered By : A.Schulz For Read More …
[Solved]: Is it possible that the union of two undecidable languages is decidable?
Problem Detail: I’m trying to find two languages, $L_1, L_2 in RE setminus R$, such that $L_1 cup L_2 in R$. I have already proved that if $L_1cap L_2 in R$ and $L_1 cup L_2 in R$, such $L_1, L_2$ don’t Read More …
[Solved]: Are permutations of context-free languages context-free?
Problem Detail: Given a context-free language $L$, define the language $p(L)$ as containing all permutations of strings in $L$ (i.e. all strings in $L$ such that the order of symbols is not important). Is $p(L)$ context-free? I found two papers dealing Read More …
[Solved]: How does an operating system create entropy for random seeds?
Problem Detail: On Linux, the files /dev/random and /dev/urandom files are the blocking and non-blocking (respectively) sources of pseudo-random bytes. They can be read as normal files: $ hexdump /dev/random 0000000 28eb d9e7 44bb 1ac9 d06f b943 f904 8ffa 0000010 5652 Read More …
[Solved]: Does an abstract syntax tree have to be a tree?
Problem Detail: Does the output of a parser have to be a tree or could it also be general graph? Moreover, is there any existing language or a plausible one that uses general graphs representation instead of trees for their syntax? Read More …
[Solved]: Is Karp Reduction identical to Levin Reduction
Problem Detail: Definition: Karp Reduction A language $A$ is Karp reducible to a language $B$ if there is a polynomial-time computable function $f:{0,1}^*rightarrow{0,1}^*$ such that for every $x$, $xin A$ if and only if $f(x)in B$. Definition: Levin Reduction A Read More …
[Solved]: Is it compulsory that every infinite set be non regular?
Problem Detail: I am confused regarding the statements provided by one of our faculty regarding “Is it compulsory that every infinite set is non regular though every finite set is a regular set”. Providing this example: $$L= { 0^n 1^n | Read More …