instruction stringlengths 0 29.8k ⌀ |
|---|
why is this true: “There are countably many Turing Machines” |
|turing-machines|automata| |
It is said that there are uncountably many languages but only countably many Turing Machines. Could someone make this clear to me?
And this doesn't mean that the set of TM is finite, yes? |
If you want rigorous proof, the following lemma is often useful resp. more handy than the definitions.
> If $c = \lim_{n\to\infty} \frac{f(n)}{g(n)}$ exists, then
> * $c=0 \qquad \quad\ \,\implies f \in o(g)$
> * $c \in (0,\infty) \quad \implies f \in \Theta(g)$
> * $c=\infty \qquad \ \ \ \implies f \in \omega(... |
There is a classical paper of [Jerrum and Sinclair (1989)](http://epubs.siam.org/doi/abs/10.1137/0218077) on sampling perfect matchings from dense graphs. Another classical paper of [Jerrum, Sinclair and Vigoda (2004; pdf)][2] discusses sampling perfect matchings from bipartite graphs.
Both these papers uses rapidly... |
Countable means finite or can be counted (can be put in one-to-one correspondence with the set of natural numbers $\mathbb N$). Uncountable means not countable (not finite and can't be put in one-to-one correspondence with $\mathbb N$).
A language is a set of strings (let's restrict ourselves to the alphabet $\Sigma... |
A turing machine always has a fintie description. So there are finite number of states, transitions and tape symbols for each turing machine. We can map these to a canonical representation, e.g. a string, which will be finite in length.
The set of all finite length strings is still countable, and the set of valid tu... |
A quick informal answer:
* a Turing Machine (states, transitions, ecc.) can be encoded using a string of $0$'s and $1$'s;
* so you can pick all the binary strings in lexicographic order (0,1,00,01,10,11,000,001,...) and *enumerate* the Turing machines (i.e. build a one to one corrispondence between natural number... |
A quick informal answer:
* a Turing Machine (states, transitions, ecc.) can be encoded using a string of $0$'s and $1$'s;
* so you can pick all the binary strings in lexicographic order (0,1,00,01,10,11,000,001,...) and *enumerate* the Turing machines (i.e. build a one to one corrispondence between natural number... |
A quick informal answer:
* a Turing Machine (states, transitions, ecc.) can be encoded using a string of $0$'s and $1$'s;
* so you can pick all the binary strings in lexicographic order (0,1,00,01,10,11,000,001,...) and *enumerate* the Turing machines (i.e. build a one to one corrispondence between natural number... |
|algorithms|complexity-theory|matching|sampling| |
{"OriginalQuestionIds":[9633],"Voters":[{"Id":98,"DisplayName":"Raphael"}]} |
null |
1. As explained in the comments, indentation marks code blocks. It is a standard way to denote them. `while` of line 6, repeats line 7, but has nothing to do with the `if` on line 8.
2. Indeed it only matters whether `q` and `k` are not zero. |
I'm thinking about a routing system. Imagine I have the two following regexes
* pathpart1/pathpart2 => specific match that routes to controller1
* .* => catch-all that routes to controller2
And I let them match on a URL, e.g. 'pathpart1/pathpart2'.
They both match, but I would want to give prevalence to the ... |
How to find specificity of a regex match? |
|regular-expressions|routing|cardinality| |
I have an assignment to construct a game of Nim (a game in which two players must divide a pile of tokens into two unequal sizes; 6 can be divided into 2 & 4 but not 3 & 3). I was provided a game tree (the same one I find on Google), but I am confused. Shouldn't the first turn of the second player have access to S6, S5... |
Is this NIM game tree correct? |
|game-theory| |
null |
There are many kinds of NIM. The one in the picture is a rather classic example. Take either one or two tokens, the one who takes the last token looses.
Does not sound like the version you suggest. Your game does not state what happens with the divided heaps? |
I think you can establish some form of partial order on regular expression by using their derivatives, and more precisely by comparing the alphabet sets which yeld their derivatives.
A regexp derivative $r'$ of a regexp $r$ is, given an input set, the regular expression which will behave as $r$ after having received... |
I have a problem where I am supposed to analyze the `Steiner tree problem` by doing the following 3 steps.
1) Look up what the Steiner tree problem is.
2) Find a polynomial time reduction to it from one of these 8 known NP-complete problems:
- 3-col
- subset-sum
- clique
- hampath
- Uhampath
- ... |
How to analyze the steiner tree problem? |
|np-complete|proof-techniques|np-hard|check-my-proof| |
The game that you outline, while it can be handled by the same [_Sprague-Grundy Theory_][1] that is used for Nim (and therefore can have a nim-value assigned to every position), is better known as [_Grundy's Game_][2]; note that there's no legal move on a heap of size 1 (since it can't be divided into two heaps) and no... |
Short answer: You are given a graph with some special vertices, and are asked to connected them using as few (or cheap) edges as possible. By connecting them, we mean that you will *use* only those edges.
More formally, you are given a graph $G = (V,E)$ and a set $S \subseteq V$ of vertices. These vertices are of... |
I have a problem where I am supposed to analyze the `Steiner tree problem` by doing the following 3 steps.
1) Look up what the Steiner tree problem is.
2) Find a polynomial time reduction to it from one of these 8 known NP-complete problems:
- 3-col
- subset-sum
- clique
- hampath
- Uhampath
- ... |
How to analyze the Steiner tree problem? |
Why is this true: “There are countably many Turing Machines” |
I was wondering, since $a^*$ is itself a star-free language, is there a regular language that is not a star-free language? Could you give an example?
$\emptyset$ is star-free $\Longrightarrow$
$\Sigma^*=\bar{\emptyset}$ is star-free $\Longrightarrow$
$A\subseteq\Sigma\Rightarrow\Sigma^*A\Sigma^*$ is star-fr... |
Star free language vs. regular language |
The worst case running time of insertion sort is $\Theta(n^2)$, we don’t write it as $O(n^2)$.
$O$-notation is used to give upper bound on function. If we use it to bound a worst case running time of insertion sort, it implies that $O(n^2)$ is upper bound of algorithm no matter what type of input is, means it doesn’... |
Why is $\Theta$ notation suitable to insertion sort to describe its worst case running time? |
null |
Well since no one else is giving an answer, here goes:
Assume the jobs are represented as $J=\{x_1,\ldots,x_n\}$
Since $P_1$ must process only one job at a time, it doesn't matter which order the jobs are processed, the time taken by $P_1$ is always the same, $\sum_{i=1}^n t_{i,1}$, each job's 3 parts are represe... |
You are confusing two different notions.
The definition of $\Theta$ that you give is correct, and indeed the running time of insertion sort, in the worst case, is $\Theta(n^2)$, since it has a quadratic running time.
The fact that this is the worst running time is somewhat irrelevant here. You have some function, a... |
I have this problem that I need help with.
**Input:**
An undirected graph $G(V,E)$.
$F$ where $F$ is a subset of $V$.
The edges are not weighted, or if you prefer, all edges have a weight of $1$.
**Question:**
How do you find a node $v$ of $V$ such that the distance from each node of $F$ to $v$ is the... |
How to solve finding shortest path in graph? |
|graphs| |
Starting with $i=0$ and going up, for every $f \in F$ consider a subset of $V$ containing points at the exact distance of $i$ from $f$. Look at intersection of all of those subsets. If you're lucky, as $i$ grows, you'll find this intersection non empty - those will be the solutions.
For the actual implementation, I'... |
I think you can establish some form of partial order on regular expressions by using their derivatives, and more precisely by comparing the alphabet sets which yeld their derivatives.
A regexp derivative $r'$ of a regexp $r$ is, given an input set, the regular expression which will behave as $r$ after having receive... |
{"Voters":[{"Id":4660,"DisplayName":"didierc"}]} |
Two or more threads executing *concurrently* require synchronization if and only if at least one of the threads accesses and modifies one or more variables (write access) accessed by the remaining threads (either read or write access). Therefore, if all of the threads access the same set of variables only for reading t... |
**Is OPT = m?** is a coNP decision problem. A "no" answer has a certificate verifiable in polynomial time, the certificate being a valid bin packing that uses fewer than $m$ bins.
The same is true for the question **Is OPT > m?**. There is no polynomial-time verifiable certificate for the "yes" answer to either of... |
I don't know if you would consider this a "good" way, but the naive approach would be to count the matches of each regex, and compare.
This is not too expensive: In order to find a match, you run a DFA for $r$ (where $r$ is the regex in question) starting at every index of the input. You then wait for an accepting r... |
Short answer: You are given a graph with some special vertices, and are asked to connected them using as few (or cheap) edges as possible. By connecting them, we mean that you will *use* only those edges.
More formally, you are given a graph $G = (V,E)$ and a set $S \subseteq V$ of vertices. These vertices are of... |
Suppose I have a graph $G$ with $M(G)$ the (unknown) set of perfect matchings of $G$. Suppose this set is non-empty, then how difficult is it to sample uniformly at random from $M(G)$? What if I am okay with a distribution that is close to uniform, but not quite uniform, then is there an efficient algorithm? |
null |
One way to show hardness of the decision version of an optimization problem (i.e., $OPT \geq m'$) given that the standard decision version (i.e., $OPT = m$) is NP-complete is by using Turing reductions in both directions.
Therefore, you need to do two things:
(1) Show that if you have a poly-time oracle that can ... |
One way to show hardness of the decision version of an optimization problem (i.e., $OPT \geq m'$) given that the standard decision version (i.e., $OPT = m$) is NP-complete is by using Turing reductions in both directions.
Therefore, you need to do two things:
(1) Show that if you have a poly-time oracle that can ... |
Regular languages are those that can be described by *weak monadic second order logic* (WMSO) [1].
Star-free languages are those that can be described by *first order logic with $<$* (FO[<]) [2].
The two logics are not equally powerful. One example for a language that is WMSO-definable but not FO[<]-definable is ... |
|algorithms|graphs|search-algorithms|shortest-path| |
How to find a node that is equidistant to a set of nodes? |
|algorithms|regular-expressions|strings| |
I have a problem where I am supposed to analyze the `Steiner tree problem` by doing the following 3 steps.
1) Look up what the Steiner tree problem is.
2) Find a polynomial time reduction to it from one of these 8 known NP-complete problems:
- 3-col
- subset-sum
- clique
- hampath
- Uhampath
- ... |
|complexity-theory|graphs|np-complete|reductions|trees| |
One easy but most likely not most efficient approach is this:
1. Reorder the vertices such that all vertices in $F$ come first.
1. Use the [Floyd-Warshall algorithm][1] to compute the Matrix $M$ of all distances.
1. Look at all columns where the first $|F|$ entries contain the same value $k$ and choose the one... |
One easy but most likely not most efficient approach is this:
1. Reorder the vertices such that all vertices in $F$ come first.
1. Use the [Floyd-Warshall algorithm][1] to compute the Matrix $M$ of all distances.
1. Look at all columns where the first $|F|$ entries contain the same value $k$ and choose the one... |
I am finding it difficult to clearly differentiate between Multiprogramming and Multitasking.
My primary source has been [Wikipedia](http://en.wikipedia.org/wiki/Computer_multitasking), but the WP article seems to be a little at odds with some less reputable sources (like my college professor).
As I read WP, *mul... |
What is the difference between Multiprogramming and Multitasking |
|terminology|scheduling| |
Assume $n = |V|, m = |E|, k = |F|$. Solve the [SSSP](https://en.wikipedia.org/wiki/Shortest_path_problem) for all $v \in F$ and annotate nodes with the respective distances (time $\Theta(n + m)$). Iterate over all nodes and find one all annotations of which are the same and minimal among all candidates (time $\Theta(nk... |
What does it mean when we say a graph that uses Prim's Algorithm that results in a non-trivial run algorithm. Can anyone give me any examples? |
Prim's Algortihm |
|algorithms|greedy-algorithms| |
|terminology|process-scheduling| |
Assume $n = |V|, m = |E|, k = |F|$. Solve the [SSSP](https://en.wikipedia.org/wiki/Shortest_path_problem) for all $v \in F$ and annotate nodes with the respective distances (time $\Theta(k(n + m))$). Iterate over all nodes and find one all annotations of which are the same and minimal among all candidates (time $\Theta... |
Non-trivial runs of Prim's algorithm |
|algorithms|terminology|graphs| |
[3-Partition][1] problem is NP-Complete in strong sense means there is no Pseudo-polynomial time algorithm except $P=NP$. I'm looking for a fastest algorithm that solves 3-Partition. Is there any fast (e.g subexponential) algorithm for 3-Partition?
[1]: http://en.wikipedia.org/wiki/3-partition_problem |
Fastest known algorithm for 3-Partition problem |
|algorithms|np-complete|partition-problem| |
[3-Partition][1] problem is NP-Complete in strong sense means there is no Pseudo-polynomial time algorithm unless $P=NP$. I'm looking for a fastest algorithm that solves 3-Partition. Is there any fast (e.g subexponential) algorithm for 3-Partition?
[1]: http://en.wikipedia.org/wiki/3-partition_problem |
[3-Partition][1] problem is NP-Complete in strong sense means there is no Pseudo-polynomial time algorithm unless $P=NP$. I'm looking for a fastest algorithm that solves 3-Partition. Is there any fast (e.g subexponential) algorithm for 3-Partition? Is it possible to solve it faster than using SAT solvers?
P.S: I kno... |
[3-Partition][1] problem is NP-Complete in strong sense means there is no Pseudo-polynomial time algorithm unless $P=NP$. I'm looking for a fastest algorithm that solves 3-Partition. Is there any fast (e.g subexponential) algorithm for 3-Partition? Is it possible to solve it faster than using SAT solvers?
[1]: htt... |
There are two angles I see to define "specifity" in this context.
1. Specifity of a regular expression $r$ that matches input $w$ is
the (inverse of the) number of words of length $|w|$ that also match $r$.
2. Specifity of a regular expression $r$ that matches input $w$ is (the ratio of)
the (maximum) n... |
|formal-languages|regular-languages|context-free| |
Your reasoning for the positive statements seems sound to me, although they lack some detail if formal proofs are required. In particular, you might at least want to give the automata for $L_4,L_5,L_6$ and $L_7$; especially the latter can be considered non-trivial, depending on your level of expertise.
You lack proo... |
Prim's algorithm greedily chooses the smallest edge leaving the set of already connected nodes (until all nodes are connected).
It is not clear what "non-trivial run" means here; I propose this: a run of Prim is trivial if in every step, it can choose the smallest available edge. This would happen on linear chains, ... |
What does it mean when we say that a run of Prim's algorithm is *trivial*? What are example graphs for either case, that is with and without trivial runs? |
Prim's algorithm greedily chooses the smallest edge leaving the set of already connected nodes (until all nodes are connected).
It is not clear what "non-trivial run" means here; I propose this: a run of Prim is trivial if in every step, it can choose the smallest available edge. This would happen on linear chains, ... |
No, the game tree is not correct for the description you gave.
If you look a few levels downward, there's the position F(2), which by your description should be a dead end: you can't make a move, since splitting a pile of 2 into non-equal parts is not possible. Yet, the tree gives two options. Your observation that... |
They are more or less synonymous. Multiprogramming is more used when one CPU is involved, that is being switched from a process to the other, processes which are resiging in memory simultaneously. Along came threads, and it wasn't switching between programs anymore...
Processors, particularly the intel line, had the... |
null |
|efficiency|software-engineering| |
{"Voters":[{"Id":4660,"DisplayName":"didierc"}]} |
I think you can establish some form of partial order on regular expressions by using their [derivatives][1], and more precisely by comparing the alphabet sets which yeld their derivatives, along the input string you're interested in.
Here's a quick rundown of what it's all about.
A regexp derivative $r'$ of a regex... |
I think you can establish some form of partial order on regular expressions by using their [derivatives][1], and more precisely by comparing the alphabet sets which yeld their derivatives, along the input string you're interested in.
Here's a quick rundown of what it's all about.
A regexp derivative $r'$ of a regex... |
I am trying to determine the worst case runtime of this program:
while n > 1
for i = 1,..,n
m = log(n)
n = n/2
Obviously the outer loop runs `log(n)` times, because n is halfed after each step.
But the inner for loop is dependent on the decreasing n and I am not quite sure how to dea... |
Decreasing runs of inner loop in outer loop |
|time-complexity|asymptotics|runtime-analysis| |
I have this problem that I need help with.
**Input:**
An undirected graph $G(V,E)$.
$F$ where $F$ is a subset of $V$.
The edges are not weighted, or if you prefer, all edges have a weight of $1$.
**Question:**
How do you find a node $v$ of $V$ such that the distance from each node of $F$ to $v$ is the... |
When loops are nested, the running time is the amount of time the innermost loop is executed multiplied by the time it takes to execute the body of the loop. In your case, the innermost loop executes $n+n/2+n/4+\dots+1\lt2n$ and we'll assume that computing the $log$ takes constant time. So the running time is linear in... |
When loops are nested, the running time is the amount of time the innermost loop is executed multiplied by the time it takes to execute the body of the loop. In your case, the innermost loop executes $n+n/2+n/4+\dots+1\lt2n$ and we'll assume that computing the $\log$ takes constant time. So the running time is linear i... |
null |
I was wondering, since $a^*$ is itself a star-free language, is there a regular language that is not a star-free language? Could you give an example?
Here is the proof of $a^*$ being star-free:
$\emptyset$ is star-free $\Longrightarrow$
$\Sigma^*=\bar{\emptyset}$ is star-free $\Longrightarrow$
$A\subsete... |
null |
I have come across about RS Flip Flop & I have tried implementing that on a simulator & using actual logic gates. But I'm still not sure whether I have correctly understood the case unstable or the forbidden case S=1, R=1 in Flip flop. Can anyone tell me what exactly is that?
By the way I have used 2-INPUT NAND Gate... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.