instruction
stringlengths
0
29.8k
⌀
null
Set 'scripting languages' is subset of set 'programming languages'. The difference between C and Perl is difference between system programming language and application language and between interpreted language and compiled language. System programming languages are low-level and oriented toward memory management,...
Thw [Wikipedia article on Pushdown automata][1] doesn't explain what the receiving state is for the generated PDA it just states that there is but one state. [1]: http://en.wikipedia.org/wiki/Pushdown_automaton
|terminology|automata|pushdown-automata|
This depends on how locks are implemented. If you do it as in the Wikipedia article, i.e. guarding the critical section with one boolean per process¹, you are certainly in trouble. If one process dies, it never resets its flag so the other process loops forever. You can safeguard your code against many ways of dying...
I think that in [Peterson's algorithm][1] for [mutual exclusion][2], if the process first to enter the critical section were to die or be cancelled, the other process would loop forever, waiting to enter the critical section. In the picture, if process 1 is stopped, the rest of the processes behind process 1 will ex...
Does Peterson's 2-process mutual exclusion algorithm account for dying processes?
This depends on how locks are implemented. If you do it as in the Wikipedia article, i.e. guarding the critical section with one boolean per process¹, you are certainly in trouble. If one process dies, it never resets its flag so the other process loops forever. In practice, you can safeguard your code against many ...
Over at [this question about inversion counting](http://cs.stackexchange.com/questions/3200/counting-inversion-pairs), I [found a paper](http://cs.stackexchange.com/questions/3200/counting-inversion-pairs#comment8724_3200) that proves a lower bound on space complexity for all (exact) [streaming algorithms](https://en.w...
Is every linear-time algorithm a streaming algorithm?
|algorithms|streaming-algorithm|simulation|lower-bounds|
I have read many documents about `Convolution` in image processing, and most of them say about its formula, some additional parameters. No one explains the intuition and real meaning behind doing convolution on an image. I think a quick summary of the definition is: Convolution is multiplied overlap square between imag...
Image Process : Intuition of Convolution
|computer-vision|
After looking at other questions and my textbook, I seem to get some confusion. I do get that when there is a polynomial algorithm of NPC, there is a polynomial algorithm for a NP problem. But the statement describing reduction seems obscure to me at least in the beginning of my studies in computational compl...
Can exponential algorithm of NPC transform into an algorithm for other NP problems in polynomial time?
|complexity-theory|
I have read many documents about `Convolution` in image processing, and most of them say about its formula, some additional parameters. No one explains the intuition and real meaning behind doing convolution on an image. For example, intuition of derivation on the graph is make it more linear for example. I think a...
After looking at other questions and my textbook, I seem to get some confusion. I do get that when there is a polynomial algorithm of NPC, there is a polynomial algorithm for a NP problem. But the statement describing reduction seems obscure to me at least in the beginning of my studies in computational compl...
|complexity-theory|terminology|np-complete|reductions|
Can an exponential algorithm for an NPC problem be transformed into an algorithm for other NP problems in polynomial time?
I have read many documents about [*convolution*](https://en.wikipedia.org/wiki/Convolution) in image processing, and most of them say about its formula, some additional parameters. No one explains the intuition and real meaning behind doing convolution on an image. For example, intuition of derivation on the graph is m...
Intuition for convolution in image processing
|terminology|intuition|graphics|computer-vision|
If you have an algorithm running in time $f(n)$ that solves an $\mathsf{NP\text{-}complete}$ problem, you can use it to solve any $\mathsf{NP}$ problem and the running time will be $g(n)=f(n^k) + p(n)$ ($k$ is a constant which depends on the reduction between the problems, $p(n)$ is a polynomial essentially giving the ...
If you have an algorithm running in time $f(n)$ that solves an $\mathsf{NP\text{-}complete}$ problem, you can use it to solve any $\mathsf{NP}$ problem and the running time will be $g(n)=f(n^k) + p(n)$ ($k$ is a constant which depends on the reduction between the problems, $p(n)$ is a polynomial essentially giving the ...
There are linear-time algorithms that follow the *divide and conquer* paradigm. I think these should not be considered as streaming algorithms. One example is the [DC3 algorithm](http://www.cs.helsinki.fi/u/tpkarkka/publications/jacm05-revised.pdf) for constructing the [suffix array](http://en.wikipedia.org/wiki/Su...
There are linear-time algorithms that follow the *divide and conquer* paradigm. I think these should not be considered as streaming algorithms. One example is the [DC3 algorithm](http://www.cs.helsinki.fi/u/tpkarkka/publications/jacm05-revised.pdf) for constructing the [suffix array](http://en.wikipedia.org/wiki/Su...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(kn^2)$ where $k$ is the number of tapes. The quadratic increase is required since there are languages...
Let $f$ be a fixed time-constructable function. The classical universal simulation result for TMs (Hennie and Stearns, 1966) states that there is a two-tape TM $U$ such that given * the description of a TM $\langle M \rangle$, and * an input string $x$, runs for $g(|x|)$ steps and returns $M$'s answer on $x...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(kn^2)$ where $k$ is the number of tapes. The quadratic increase is required since there are languages...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(kn^2)$. The quadratic increase is required since there are languages (e.g. palindromes) that require ...
If you have an algorithm running in time $f(n)$ that solves an $\mathsf{NP\text{-}complete}$ problem, you can use it to solve any $\mathsf{NP}$ problem and the running time will be $g(n)=f(n^k) + p(n)$ ($k$ is a constant which depends on the reduction between the problems, $p(n)$ is a polynomial essentially giving the ...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(n^2)$. The quadratic increase is required since there are languages (e.g. palindromes) that require t...
For streaming algorithms to be meaningful, they have to work with significantly smaller amount of work space than the input itself. For example, if you allow the same amount of work space as the input, then you can trivially state any algorithm as a “single-pass streaming algorithm” which first copies the input to the...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(n^2)$. The quadratic increase is required since there are languages (e.g. palindromes) that require t...
>What is the best known simulation result on a single tape TM? Does the result above also still hold? We can simulate a multiple-tape TM on a single-tape TM with quadratic increase in time. The simulation time is $O(n^2)$. The quadratic increase is required since there are languages (e.g. palindromes) that require t...
All scripting languages are also programming languages. The converse is not true. Languages that "require only the interpreter" are [interpreted languages](http://en.wikipedia.org/wiki/Interpreted_language) (as opposed to a [compiled language](http://en.wikipedia.org/wiki/Compiled_language) -- note that some languages,...
What is the difference between programming language and a scripting language? For example, consider C versus Perl. Is the only difference that scripting languages require only the interpreter and don't require compile and linking?
What is the difference between a scripting language and a normal programming language?
In the streaming model you are only allowed to store constant or poly-logarithmic extra-data while scanning through the input. If you consider a linear time algorithm that follows the *divide and conquer* paradigm, you need to store more information and/or you should scan through your data as many times as the d...
All scripting languages are also programming languages. The converse is not true. Languages that "require only the interpreter" are [interpreted languages](http://en.wikipedia.org/wiki/Interpreted_language) (as opposed to a [compiled language](http://en.wikipedia.org/wiki/Compiled_language) -- note that some languages,...
You should have a look at M. Sipser's "[Introduction to the Theory of Computation][1]". I did read (and understood) this book when I was in High School, so I think it is suitable for you. Although it's quite formal, everything is also explained in plain English. It also has a little introduction to proof techniques...
You can surely bet for the famous book of Cormen's "Introduction To Algorithms". First of all it's quite difficult to understand the book if you don't have sound mathematical base. But for the shake of easy understanding you can skip those mathematical proofs (not recommended). Also you can go for [Algorithm Design Ma...
It is my very personal opinion that the book of [Jon Kleinberg and Éva Tardos](http://www.aw-bc.com/info/kleinberg/) is the best book for studying the design and analysis of efficient algorithms. It might be not as comprehensive as *Cormen et al.* but it is a great textbook. Let me point out, why I think this book migh...
null
|complexity-theory|reference-request|algorithm-analysis|education|books|
Even in the simplest definition of "streaming algorithm" (an algorithm which, after every incremental iteration on the source, results in the immediate knowledge of the next incremental piece of the result), I can think of a few linear algorithms that don't behave that way. Hashing algorithms are a big one; FNV-1a is l...
You can surely bet for the famous book of *Cormen et al.* "Introduction To Algorithms". First of all it's quite difficult to understand the book if you don't have sound mathematical base. But for the shake of easy understanding you can skip those mathematical proofs (not recommended). Also you can go for [Algorithm De...
null
Even in the simplest definition of "streaming algorithm" (an algorithm which, after every incremental iteration on the source, results in the immediate knowledge of the next incremental piece of the result), I can think of a few linear algorithms that don't behave that way. Hashing algorithms are a big one; FNV-1a is l...
Even in the simplest definition of "streaming algorithm" (an algorithm which, after every incremental iteration on the source, results in the immediate knowledge of the next incremental piece of the result), I can think of a few linear algorithms that don't behave that way. Hashing algorithms are a big one; FNV-1a is l...
null
I interpret your question as follows. Let's fix some computational problem $P$. We define: * $R(P)$ is the smallest workspace that any linear time random access algorithm for $P$ can have. I think the exact model does not matter all that much, but let's say that the we have a word RAM which is given the input as a r...
I'm reading few proofs which prove a given problem is NP complete. The proof technique has following steps. 1. Prove that current problem is NP. i.e. given a certificate, prove that it can be verified in polynomial time. 2. Take any known NP Complete problem (call "Easy") and reduce **all** of it's inst...
How are all NP Complete problems similar?
|complexity-theory|np-complete|reductions|
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, y, z) should lie within the triangle: x + y + z = 1 0 < x < 1 0 < y < 1 0 < z < 1 Ideally I want each point...
Generating discrete-variable probabilities
|algorithms|randomized-algorithms|
You are confused by the direction of the reduction. So let me explain how to argue. You have a language, say $L$ and you want to show that it is NP-complete. First you show that is indeed in NP, i.e., by finding a good certificate. Thus you are left by showing the NP-hardness. This can be done by reducing some NP-co...
I'm reading few proofs which prove a given problem is NP complete. The proof technique has following steps. 1. Prove that current problem is NP, i.e., given a certificate, prove that it can be verified in polynomial time. 2. Take any known NP-complete problem (call "Easy") and reduce **all** of it's ins...
Let us first assume that you want to sample within x + y + z = 1 0 ≤ x ≤ 1 0 ≤ y ≤ 1 0 ≤ z ≤ 1 This doesn't make quite a difference, since the sample point will still lie in your requested area with high probability. Now you are left with sampling a point from a [simplex](http://en.wiki...
null
Given a set $A \subset \mathbb R$, how do you show that $a$ is a greatest element of the set $A$? There are two steps: 1. Show that $a \in A$. 2. Show that for any $b \in A$, $b \leq a$. If $a,b$ are greatest elements of set $A$, then applying condition 2 twice (for $a$ and $b$) you get $a \leq b \leq a$. In $\m...
Let $f : R \rightarrow R$ be a continuous positive function, where $f(n)$ is integer for each integer $n$. Prove or disprove whether the following always holds: $f(n+1) = \theta(f(n))$
Problem on Aysmptotics
|algorithms|asymptotics|
Your question seems to come from the fact that you're not immediately convinced that the current problem can't be harder. The current problem can't be harder than any NP-complete problem because it is in NP. If you want to be convinced that the notion of NP-completeness even exists (i.e. that you can reduce anything...
**Abstract problem description:** The way I see it, unparsing means to create a token stream from an AST, which when parsed again produces an equal AST. So `parse(unparse(AST)) = AST` holds. This is the equal to finding a valid parse tree which would produce the same AST. The language is described by a...
Unparse AST < O(exp(n))?
|nondeterminism|parsing|constraint-satisfaction|
|algorithms|randomness|random-number-generator|
Your question seems to come from the fact that you're not immediately convinced that the current problem can't be harder. The current problem can't be harder than any NP-complete problem because it is in NP. If you want to be convinced that the notion of NP-completeness even exists (i.e. that you can reduce anything...
Let $f : \mathbb{R} \rightarrow \mathbb{R}$ be a continuous positive function, where $f(n)$ is integer for each integer $n$. Prove or disprove whether the following always holds: $\qquad f(n+1) = \Theta(f(n))$
|asymptotics|mathematical-analysis|
I read your question like this. Given such a function $f$, define $g(n) = f(n)$ and $g'(n) = f(n+1)$. Is $g' \in \Theta(g)$? Hint: If this is true, for all such functions $f$ you have a $c$ such that $f(n) \leq c f(n+1)$ for all sufficiently large $n$ (by definition). >! For $f(n) = n$, $f(n+1)-f(n) = 1$. For $f(...
There seem to be two misconceptions here. 1. "Easy" and "hard": if anything, it's the other way round. The given problem is "easy" (we don't know its complexity), the other one is *known* to be hard. 2. "reduce **all** of it's instances to **few** instances of given problem": the emphasis is misleading. It's not ...
### Abstract problem description The way I see it, unparsing means to create a token stream from an AST, which when parsed again produces an equal AST, i.e. `parse(unparse(AST)) = AST` should hold. This is the equal to finding a valid parse tree which would produce the same AST. The language is described by...
Can abstract syntax trees be unparsed in subexponential time?
|algorithms|parsers|
null
null
I read your question like this. Given such a function $f$, define $g(n) = f(n)$ and $g'(n) = f(n+1)$. Is $g' \in \Theta(g)$? Hint 1: If this is true, for all such functions $f$ you have a $c$ such that $f(n+1) \leq c f(n)$ for all sufficiently large $n$ (by definition). Hint 2: $f(n+1) \leq c f(n) \iff f(n+1) - f...
|asymptotics|mathematical-analysis|landau-notation|
Asymptotic growth rate of f(n) and f(n+1)
###Hint: First consider a function $f:\mathbb{Z} \to \mathbb{Z}$ like $$f(n) = \begin{cases} g(k) & \text{if } n=2k\in \mathbb{Z} \\ h(k) & \text{if } n=2k+1\in \mathbb{Z} \\ \end{cases}$$ Then extend it in a continuous way to a function over $\mathbb{R}$.
null
Let us first assume that you want to sample within x + y + z = 1 0 ≤ x ≤ 1 0 ≤ y ≤ 1 0 ≤ z ≤ 1 This doesn't make quite a difference, since the sample point will still lie in your requested area with high probability. Now you are left with sampling a point from a [simplex](http://en.wiki...
Uniform sampling from a simplex
|algorithms|randomness|random-number-generator|sampling|
Asymptotic growth rate of $f(n)$ and $f(n+1)$
|complexity-theory|turing-machines|machine-models|simulation|
In [Cormen's Algorithms book][1] on NP-completeness they prove various problems are NP-complete by reducing a previously proved NP-complete problem (call $K$) to current problem (call $L$). Each proof involves some clever construction which reduces all instances of $K$ to few instances of $L$. Here is the proof order t...
Reducing TSP to HAM-CYCLE to VERTEX-COVER to CLIQUE to 3 CNF-SAT to SAT
|complexity-theory|np-complete|reductions|
So I have this question to prove a statement: $O(n)\subset\Theta(n)$... I don't need to know how to prove it, just that in my mind this makes no sense and I think it should rather be that $\Theta(n)\subset O(n)$. My understanding is that $O(n)$ is the set of all functions who do no worse than $n$ while $\Thet...
Prove complexity
|complexity-theory|algorithm-analysis|