instruction stringlengths 0 29.8k ⌀ |
|---|
|complexity-theory|algorithm-analysis|landau-notation| |
Imagine any continuous, monotonically non-decreasing function $f$ such that $f(n) = n!$ for all non-negative integers $n$. Then $f(n+1) = (n+1)! = (n+1)n! = (n+1)f(n)$. Since there is no constant $c$ such that $n+1<c$, it follows that it is not true that $f(n+1) = \Theta(f(n))$. QED. |
|probability-theory|randomness|random-number-generator|sampling| |
null |
Creating samples from a well-specified population using a probabilistic method and/or producing random numbers from a specified distribution. |
null |
Is $O$ contained in $\Theta$? |
|algorithm-analysis|mathematical-analysis|landau-notation| |
Think about it this way: every function that does "no worse than n" and "no better than n" is also a function that does "no worse than n". The "no better than n" part is just an additional constraint. This is a straightforward application of the logical rule that says: x and y => x. By this reasoning, all functions tha... |
If $L$ is an APX-hard language, doesn't the existence of a PTAS for $L$ trivially imply $P =NP$?
Since for example metric-TSP is in APX, but it is not approximable within 321/320 of OPT unless P = NP, thus a if there was a PTAS for $L$ we could reduce metric-TSP using a PTAS reduction to $L$ and thus can approxima... |
$L$ APX-hard thus PTAS for $L$ implies $P =NP$ |
|complexity-theory|np-complete|approximation| |
Think about it this way: every function that does "no worse than n" and "no better than n" is also a function that does "no worse than n". The "no better than n" part is just an additional constraint. This is a straightforward application of the logical rule that says: $x \wedge y \implies x$. By this reasoning, all f... |
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... |
At the suggestion of Raphael, I have turned a previous comment into this answer.
It is not true that $O(f(n)) \subset \Theta(f(n))$. In fact, $\Theta(f(n)) = O(f(n)) \cap \Omega(f(n))$, by definition. So we have $\Theta(f(n)) \subset O(f(n))$. |
null |
|asymptotics|mathematical-analysis|landau-notation| |
Shannon's source coding theorem shows that, in some exact sense, you need $\log N/\log R$ samples (on average) of the type $[0,\ldots,R-1]$ to generate a random number of the type $[0,\ldots,N-1]$. More accurately, Shannon gives an (inefficient) algorithm that given $m$ samples of the first type, outputs $m(\log N/\log... |
null |
Actually, no, rejection sampling is far from the only way of proceeding. Unfortunately, considering that computers store all information as bits, and thus can only manipulate random bits of information, any algorithm to draw a uniform random variable of range $N$ will be infinite, if the binary base development of $N$ ... |
This is my attempt to prove the following theorem. Please help me check if it is correct.
__Theorem__.
Let $G = (V, T, P, S)$ be a Context-free Grammar. Then $\forall A \in V, A \rightarrow^* \alpha \Leftrightarrow \exists$ a parse-tree $T\prime$ rooted at node $A$ with yield $\alpha \in (V \cup T)^*$.
Meanings ... |
Proof of equivalence of parse-trees and derivations |
|context-free|check-my-proof| |
This is my attempt to prove the following theorem. Please help me check if it is correct.
__Theorem__.
Let $G = (V, T, P, S)$ be a Context-free Grammar. Then $\forall A \in V, A \rightarrow^* \alpha \Leftrightarrow \exists$ a parse-tree $T\prime$ rooted at node $A$ with yield $\alpha \in (V \cup T)^*$.
Meanings ... |
I'm stuck on the following question:
"Regular languages are precisely those accepted by finite automata. Given this fact, show that if the language L is accepted by some finite automaton, then L^-1 is also accepted by some finite; L^-1 consists of all words of L reversed."
Thank you so much for your help. |
Languages and finite automata |
|finite-automata| |
I'm stuck on the following question:
"Regular languages are precisely those accepted by finite automata. Given this fact, show that if the language $L$ is accepted by some finite automaton, then $L^{R}$ is also accepted by some finite; $L^{R}$ consists of all words of $L$ reversed."
Thank you so much for your hel... |
|regular-languages|finite-automata| |
|formal-languages|regular-languages|automata|finite-automata| |
|formal-grammars|context-free|check-my-proof| |
This is my attempt to prove the following theorem. Please help me check if it is correct.
__Theorem__.
Let $G = (V, T, P, S)$ be a Context-free Grammar. Then $\forall A \in V, A \rightarrow^* \alpha \Leftrightarrow \exists$ a parse-tree $T'$ rooted at node $A$ with yield $\alpha \in (V \cup T)^*$.
Meanings of sy... |
null |
A couple of the ones you're looking at here are pretty simple actually (at least to sketch!). For all of these, there are many other ways to do it, even many other sensible ways, so these are just attempts to pick the simpler approaches (we'll see if I succeed).
As mentioned in one of the comments on the question, $... |
I think the problem here is that not being a CS student, you're just missing some practical experience with finite automata. I'll sketch out the idea for reversing a regular language and try to add some pictures later when I'm not using a tablet!
So given a regular language $L$, we know (essentially by definition) t... |
The world is filled with things that have many different variations: word processors, cars, home designs, beverages, candy, pens, shovels, etc. The reasons why we have so many can be boiled down to a few principles:
* Someone thinks they can improve on existing products
* A different design is necessitated by local... |
In a [previous answer in the Theoretical Computer Science site](http://cstheory.stackexchange.com/questions/10916/uses-of-algebraic-structures-in-theoretical-computer-science/10929#10929), I said that category theory is the foundation for type theory. Here, I would like to say something stronger. Category theory *is*... |
In a [previous answer in the Theoretical Computer Science site](http://cstheory.stackexchange.com/questions/10916/uses-of-algebraic-structures-in-theoretical-computer-science/10929#10929), I said that category theory is the "foundation" for type theory. Here, I would like to say something stronger. *Category theory i... |
*Why are there so many different programming languages?*
Because there are choices to be made:
- Mode of specification: Imperative vs. functional
- Typing: Statically typed vs. dynamically typed
- Order of evaluation: call-by-value vs. call-by-name
- Modularity: class-based vs. abstract data type-based
-... |
How to show that a "reversed" regular language is regular |
null |
*Why are there so many different programming languages?*
Because there are choices to be made:
- Mode of specification: Imperative vs. functional
- Typing: Statically typed vs. dynamically typed
- Order of evaluation: call-by-value vs. call-by-name
- Modularity: class-based vs. abstract data type-based
-... |
If $L$ is an APX-hard language, doesn't the existence of a PTAS for $L$ trivially imply $P =NP$?
Since for example metric-TSP is in APX, but it is not approximable within 220/219 of OPT unless P = NP, thus a if there was a PTAS for $L$ we could reduce metric-TSP using a PTAS reduction to $L$ and thus can approximat... |
Your argument is technically correct, but I am afraid that you are probably missing the point.
Papadimitriou and Vempala [PV06] proved that if the metric travelling salesman problem has a polynomial-time approximation algorithm within a factor of 220/219, then P=NP.
_Your question on surface_: Is the following st... |
Your argument is technically correct, but I am afraid that you are probably missing the point.
Papadimitriou and Vempala [PV06] proved that if the metric travelling salesman problem has a polynomial-time approximation algorithm within a factor of 220/219, then P=NP.
_Your question on surface_: Is the following st... |
null |
null |
You have to show that you can always construct a finite automaton that accepts strings in $L^R$ given a finite automaton that accepts strings in $L$. Here is a procedure to do that.
1. Reverse all the links in the automaton
2. Add a new state (call it $q_s$)
3. Draw a link labeled with $\epsilon$ from state $q_... |
You have to show that you can always construct a finite automaton that accepts strings in $L^R$ given a finite automaton that accepts strings in $L$. Here is a procedure to do that.
1. Reverse all the links in the automaton
2. Add a new state (call it $q_s$)
3. Draw a link labeled with $\epsilon$ from state $q_... |
To add to the automata-based transformations described above, you can also prove that regular languages are closed under reversal by showing how to convert a regular expression for $L$ into a regular expression for $L^R$. To do so, we'll define a function $REV$ on regular expressions that accepts as input a regular ex... |
You have to show that you can always construct a finite automaton that accepts strings in $L^R$ given a finite automaton that accepts strings in $L$. Here is a procedure to do that.
1. Reverse all the links in the automaton
2. Add a new state (call it $q_s$)
3. Draw a link labeled with $\epsilon$ from state $q_... |
null |
For some graphs, DFS and BFS search algorithms process nodes in the exact same order. Two examples are graphs that are paths and graphs that are star-shaped (trees of depth $1$ with an arbitrary number of children). Is there some way for categorizing graphs that satisfy this property? |
Graphs that cause DFS and BFS to process nodes in the exact same order |
|graph-theory|graphs|combinatorics|search-algorithms| |
null |
How to show that $n-3$ comparisons suffice to find any of the $3$ largest among $n$ given numbers $(n \geq 6)$.
**My Idea** : I have tried to solve it using Heap but could not derive any such bound.
How to show that at least $n-3$ comparisons are needed. The place where I found this question gave one hint which s... |
Find $any$ of the 3 largest among $n$ elements |
|algorithms| |
How to show that $n-3$ comparisons suffice to find any of the $3$ largest among $n$ given numbers $(n \geq 6)$?
**My Idea**: I have tried to solve it using a heap but could not derive any such bound.
The place where I found this question gave one hint which said to analyze the number of connected components in a ... |
Find any of the 3 largest among $n$ elements |
If $L$ is an APX-hard language, doesn't the existence of a PTAS for $L$ trivially imply $\mathsf{P} = \mathsf{NP}$?
Since for example metric-TSP is in APX, but it is not approximable within 220/219 of OPT [1] unless $\mathsf{P} = \mathsf{NP}$. Thus if there was a PTAS for $L$ we could reduce metric-TSP using a PTAS ... |
$L$ APX-hard thus PTAS for $L$ implies $\mathsf{P} = \mathsf{NP}$ |
I don't know what do you mean by comparison graph. However, here is my solution.
Suppose you have a list of $m$ elements, and you want to find the largest element. You can do this with $m-1$ comparisons.
Do you know how to proceed?
>! You can simply ignore the first two elements in your list. This gives you ... |
null |
If $L$ is an APX-hard language, doesn't the existence of a PTAS for $L$ trivially imply $\mathsf{P} = \mathsf{NP}$?
Since for example metric-TSP is in APX, but it is not approximable within 220/219 of OPT [1] unless $\mathsf{P} = \mathsf{NP}$. Thus if there was a PTAS for $L$ we could reduce metric-TSP using a PTAS ... |
I have two questions. Both are about finding any of the 3 largest among $n$ elements.
1. How to show that $n-3$ comparisons **suffice** to find any of the $3$ largest among $n$ given numbers $(n \geq 4)$?
2. How to show that $n-3$ comparisons are **necessary** to find any of the $3$ largest among $n$ given number... |
I don't know what do you mean by comparison graph. However, here is my solution for question 1.
Suppose you have a list of $m$ elements, and you want to find the largest element. You can do this with $m-1$ comparisons.
Do you know how to proceed?
>! You can simply ignore the first two elements in your list. ... |
null |
>**Problem** : Given a (one dimensional) row containing $2N$ tiles arranged in $2N + 1$ spaces. There are $N$ black tiles (B), $N$ white tiles (W), and a single empty space. The tiles are initially in an arbitrary ordering. Our goal is to arrange the tiles such that all white tiles are positioned to the left of the bla... |
Heuristics for an Artificial Intelligence problem |
|artificial-intelligence|heuristics| |
All white tiles must be moved all the way to the left. Call the left most position 0. Then, in the final position, the sume of white distances from the axis is 0+1+...(N - 1), or N(N+1)/2 - 1.
Calculate this value, the "solution distance" of the tiles up front. As a heuristic, add the zero-based positions of whit... |
Assume our BFS and dfs has a rule to start from specific node and in each dilemma they first visit node with lowest degree:
![DFS-BFS][1]
start from left most black node, then (BFS and DFS) are visit left most red node, then they will visit next black node, and so on, for make it more general, you could add so... |
All white tiles must be moved all the way to the left. Call the left most position 0. Then, in the final position, the sum of white distances from the axis is 0+1+...(N - 1).
Calculate this value, the "solution distance" of the tiles up front. As a heuristic, add the zero-based positions of white tiles up, and su... |
null |
Assume our BFS and dfs has a rule to start from specific node and in each two-way they first visit node with lowest degree:
![DFS-BFS][1]
start from left most black node, then (BFS and DFS) are visit left most red node, then they will visit next black node, and so on, for make it more general, you could add so... |
I was going through the discussion on the question http://cs.stackexchange.com/questions/125/how-to-define-quantum-turing-machines/ and I feel that quantum TM and *nondetermistic* TM are one and the same. The answers to the other question do not touch on that. Are these two models one and the same?
If no,
1. Wha... |
>**Problem** : Given a (one dimensional) row containing $2N$ tiles arranged in $2N + 1$ spaces. There are $N$ black tiles (B), $N$ white tiles (W), and a single empty space. The tiles are initially in an arbitrary ordering. Our goal is to arrange the tiles such that all white tiles are positioned to the left of the bla... |
null |
If we suppose that we start with an instance of k-SAT, and try converting the problem to an instance of (k+m)-SAT, where there are $(k+m)$ literals per clause, can we garauntee a reduction in the total amount of clauses?
If so, how much can we garauntee the total number of clauses can be reduced by? For instance, i... |
How much can we reduce number of clauses by converting from k-SAT to (k+m)-SAT? |
|satisfiability| |
If we suppose that we start with an instance of k-SAT, and try converting the problem to an instance of (k+m)-SAT, where there are $(k+m)$ literals per clause, can we garauntee a reduction in the total amount of clauses?
_I realized after posting that we can't gaurantee that the number of clauses can be reduced. Ho... |
We know the halting problem (on Turing Machines) is undecidable for Turing Machines. Is there some research into how well the human mind can deal with this problem, possibly *aided* by Turing Machines or general purpose computers?
*Note*: Obviously, in the strictest sense, you can always say no, because there are Tu... |
Human computing power: Can humans decide the halting problem on Turing Machines? |
|computability|turing-machines|halting-problem|human-computing| |
If we suppose that we start with an instance of k-SAT, and try converting the problem to an instance of (k+m)-SAT, where there are $(k+m)$ literals per clause, can we garauntee a reduction in the total amount of clauses?
_I realized after posting that we can't gaurantee that the number of clauses can be reduced. Ho... |
Consider this from a different perspective.
* First-order logic is undecidable, that is, there is no decision procedure that determines whether arbitrary formulas are logically valid.
* Proof assistants help prove theorems in first-order (or even higher-order) logic. The proof assistant ensures that the proof is do... |
If we suppose that we start with an instance of $k$-SAT, and try converting the problem to an instance of $(k+m)$-SAT, where there are $(k+m)$ literals per clause, can we guarantee a reduction in the total amount of clauses?
_I realized after posting that we can't guarantee that the number of clauses can be reduced.... |
How much can we reduce the number of clauses by converting from $k$-SAT to $(k+m)$-SAT? |
null |
The following algorithm merges two power-sets:
$Input$
$P_a = \mathcal P \left({S_a}\right)$
$P_b = \mathcal P \left({S_b}\right)$
Consider the following algorithm:
$F = \emptyset$
$\forall M \in P_a$
$\space\space\space\forall N \in P_b$
$\space\space\space\space\space\space K = M \cup N$ ... |
What is the complexity of this subset merge algorithm |
|time-complexity|algorithm-analysis| |
<p>I was solving exercises on Lambda calculus. However, my solutions are different from the answers and I cannot see what is wrong.</p>
<p>1. Find free variables of $(\lambda x.xy)x$.<br />
My workings: $FV((\lambda x.xy)x)=FV(\lambda x.xy) \cup FV(x)=\{y\} \cup \{x\}=\{x,y\}$.<br />
The model answer: $FV((\lambda... |
Free variables of (λx.xy)x and bound variables of λxy.x |
|lambda-calculus| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.