instruction stringlengths 0 29.8k ⌀ |
|---|
The minimum cannot be $0$, because $\text{cnt}\ge0$, and some assignment $\text{counter}=\text{cnt}+1$ will inevitably be performed.
But the minimum can be $1$, as follows:
- the left process executes with $i=0$, until the assignment $\text{cnt = counter;}$ (hence $\text{i}==1$ and $\text{cnt}==0$).
- the righ... |
The title and the body of your question ask different questions.
Ford-Fulkerson cannot be explained more concisely than giving the algorithm, which in turn means you should explain the residual graph.
The pseudo-code snippet you have attached is not very satisfactory. It's certainly concise, but it leaves a lot ... |
After going through the resource list, is the following a way to explain ford fulkerson concisely ?
Graphs is represent is a 2D matrix with flow capacity as a tuple in each cell.
```
while exists (P_residual = residual graph path from S to T obtained via BFS )
modify actual and residual graph with P_residua... |
[Bellman Ford 1956](http://www.cs.yale.edu/homes/lans/readings/routing/ford-max_flow-1956.pdf) uses words like "arcs" and "chains". What do they mean ?
Arc = path and chain = edge ? |
What does arc and chain mean in Bellman Ford 1956 paper? |
|graphs| |
After going through the resource list, is the following a way to explain ford fulkerson concisely ?
Graphs is represent is a 2D matrix with flow capacity as a tuple in each cell.
```
while exists (P_residual = residual graph path from S to T obtained via BFS )
modify actual and residual graph with P_residua... |
null |
The inner loop executes $\dfrac{n-j}2$ times, and the middle loop processes $j=n,\dfrac n2,\dfrac n4,\cdots$
This makes a total that is very close to $\dfrac{n\lg(n)}2-n$.
The outer loop repeats this $\lg(n)$ times, for a grand total of
$$\left(\dfrac{n\lg(n)}2-n\right)\lg(n)$$
which is asymptotically $O(n\... |
The paper litteraly gives the definition on the first page. An arc is a directed edge, and a chain is a directed simple path (*"does not intersect itself"*). |
[Ford Fulkerson 1956](http://www.cs.yale.edu/homes/lans/readings/routing/ford-max_flow-1956.pdf) uses words like "arcs" and "chains". What do they mean ?
Arc = path and chain = edge ? |
What does arc and chain mean in Ford Fulkerson 1956 paper? |
From the text
> A language $L$ is in the class $NP$ iff there exists a polynomial-time
> Turing machine, denoted $V$, that gets an input string $x$ as well as
> a read-only string called the witness $w$, such that for any input
> string $x$,
>
> - if $x \in L$, then there exits a witness string $w$ such that $... |
Exercise 9.2.3(c) of the book by Hoffman, Motwani, Ullman states
> In fact a definition of the RE-but-not-recursive languages is that they can be enumerated but not in numerical order
How do we show this equivalent to the following definition? RE-but-not-recursive languages are those, that are accepted by a TM, but... |
Alternate definition of recursively enumerable languages |
|definitions|recursively-enumerable| |
I had earlier asked the question [What is a witness string? I unable to understand the concept][1]
From the answers I got, it seems that a witness is more or less the answer. For e.g. in the padlock example given in the accepted answer, the witness is the padlock combination which can be easily verified to be true ... |
What is a witness string in a zero knowledge proof? |
|complexity-theory|zero-knowledge-proofs| |
Exercise 9.2.3(c) of the book by Hoffman, Motwani, Ullman states
> In fact a definition of the RE-but-not-recursive languages is that they can be enumerated but not in numerical order
How do we show this equivalent to the following definition? RE-but-not-recursive languages are those, that are accepted by a TM, but... |
A witness $w$ is essentially some extra helping information that you can use to verify something.
In the case of zero-knowledge proofs, $w$ will help you prove that the other party solved the problem, but it may not necessarily *be* the solution (since we need the zero knowledge property).
So there is no real differe... |
I had earlier asked the question [What is a witness string? I unable to understand the concept][1]
From the answers I got, it seems that a witness is more or less the answer. For e.g. in the padlock example given in the accepted answer, the witness is the padlock combination which can be easily verified to be true ... |
In the worst case, the Traveling Salesperson Problem (TSP) is mostly accepted to take exponential runtime in terms of $|V|$ and $|E|$ (the number of vertices and edges respectively). But for many real-world TSP problems, while $|E|$ and $|V|$ may be large, you often have many other properties of the graph that one woul... |
TSP algorithm with a good run-time based on properties of the graph (not just based on number of nodes/edges)? |
|algorithms|graphs|runtime-analysis|np-hard|traveling-salesman| |
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's output tape and halts
2. a Circle-free TM on all inputs prints infinitely many symbols on it's output tape
3. a Crashy TM is neither Circle-free nor Halting
? |
NP-hardness and Turing reducibility |
|np-hard| |
{"Voters":[{"Id":6759,"DisplayName":"Steven"}]} |
{"Voters":[{"Id":6759,"DisplayName":"Steven"}]} |
No. Take for example $A = \emptyset$ and let $B$ be any NP-hard problem. Clearly $A \le_T B$ but $A$ is not NP-hard. |
The Turing reduction $A\leqslant_T B$ can be explained as: "If I have a black box solving $B$, can I use it to solve $A$?".
Since such a definition does not have any constraint of time complexity, [any computable set is reducible to any other](https://en.wikipedia.org/wiki/Turing_reduction#Properties). That means th... |
Firstly I should mention that your picture is not correct. Probably the correct picture is as follows:[![enter image description here][1]][1]
Secondly, the answer to your question about whether we can find a TM that computes the $k(m)$ functions is negative.
Before giving the reason and proof let's fix some expre... |
Firstly I should mention that your picture is not correct. Probably the correct picture is as follows:[![enter image description here][1]][1]
Secondly, the answer to your question about whether we can find a TM that computes the $k(m)$ functions is negative.
Before giving the reason and proof let's fix some expre... |
If a language $L$ can be enumerated in numerical order, that means that you can construct an algorithm that enumerates positive instances in numerical order, for example $1, 5, 9, 129, 238, 387846, …$.
If that's the case, then $L$ is recursive. Indeed, to solve any instance $x$, you just have to enumerate positives ... |
null |
A language $L$ is recursively enumerable but not recursive if:
1. There is a Turing machine that halts on an input $x$ if and only if $x \in L$.
1. There is no Turing machine that on $x \in L$ halts and prints Yes, and on $x \notin L$ halts and prints No. We say that such a machine *decides* $L$.
In order to sho... |
This problem is NP-complete. There exists a reduction from the bin packing problem to this problem.
For a set of items $I$ and the number of bins $k$, create a complete bipartite graph of size $k + |I|$.
Each left vertex corresponds to a bin and has weight $0$ (or an appropriately small number if strictly-positive... |
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's output tape and halts
2. a Circle-free TM on all inputs prints infinitely many symbols on it's output tape
3. a Crashy TM is neither Circle-free nor Halting (if a TM reject any input it's Crashy)
,
2. given `V`, I can generate the `ID` and,
... |
null |
[Wikipedia][1] states the time complexity of the General Number Field Sieve is
$$\exp\left( \left(\sqrt[3]{\frac{64}{9}} + o(1)\right)(\ln n)^{\frac{1}{3}}(\ln \ln n)^{\frac{2}{3}}\right).$$
The same site also mentions [quasi-polynomial time][2] is
$$\mbox{QP} = \bigcup_{c \in \mathbb{N}} \mbox{DTIME} \left(2^{\log^c n... |
Is GNFS quasi-polynomial time? |
|time-complexity|factoring| |
ANTLR4 matches grammar alternatives against the input in the order you specify them. That production says (assuming "else" cannot be parsed as an _expr_) to bind the `else` to the most recent `if` - parsing this:
```
if a=b then if c=d then something else some_other_thing
```
as
```
if a=b then {
if c=d th... |
I have a graph data structure that has some source points (the red ones) and some destination points (the blue ones). I want to find the shortest path from every source point to its nearest destination point, **or to its nearest source point that is already connected to a destination point by a shortest path**.
Plea... |
Find the shortest path from a set of source points to the nearest source/destination point |
|graph-traversal| |
null |
Let G be a graph and G' be its s-subdivision (a s-subdivision of G is obtained by replacing each edge e=vw of G by a path v u_1 u_2 ... u_s w, where u_1, ..., u_s are called division vertices of e. It has been stated that the treewidth of G equals to the treewidth of its s-subdivision for every natural number s. Why? |
Treewidth of a subdivision of a graph |
|treewidth| |
Let H (x, y) be a Turing machine that returns true if the Turing machine with encoding x halts on input y, and returns false if that machine doesn't halt on input y. If H (x, y) exists then the halting problem is solved. If H (x, y) doesn't exist then the halting problem cannot be solved.
H' (x) returns true if the ... |
There are three interesting cases:
- The keys to be stored in the hash table are known in advance. In this case, it is possible to construct a hash function that is injective over the set of stored keys; this is, essentially, [perfect hashing][1]. Perfect hashing doesn't give you a direct way to reconstruct the key... |
null |
The problem reads as follows:
Write a regular expression for the following language on {0, 1}:
$\bullet$ all strings not ending in 01.
The solution my teacher gave is
(0+1)$^{*}$(00+01+11)+0+1*+$\lambda$
So if I understand this correctly I could produce a string like
0001 right? Which ends in 01 whi... |
Asked to write a regular expression for a language but I am confused about the teachers given solution. (all strings NOT ending in 01) |
|regular-expressions| |
It is more likely that the solution is $(0+1)^*(00+10+11) + 0 + 1 + \lambda$.
Notice that the $(00 + 01 + 11)$ part has been transformed into $(00 + 10+11)$. Also the Kleene star on the last $1$ is useless (since a word $1^k$ with $k\geqslant 2$ can be obtained with the first part). |
null |
null |
this question is related to [this](https://cs.stackexchange.com/questions/154852/can-you-solve-the-kinds-of-tms-problem) question but it's different and seems easier to solve and you can't confuse it with the halting problem
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's... |
Can you solve the "Crashy TMs" problem? (it seems easier than "kinds of TMs" problem) |
|turing-machines| |
**Bonus point**
You can map lambda functions to digits (as opposed to integers), which will speed up arithmetic *immensely*. Here is an example that implements base-16 arithmetic (it functions kind of like an odometer). Numbers are cons-lists of digits, least significant first. You can use a (much more verbose) base... |
Consider this version of the halting problem: given an input Turing machine $T$, decide whether $T$ halts on empty input. You can assume that $T$ is a valid description of a TM. This problem is known to be undecidable.
My answer in [your other question](https://cs.stackexchange.com/questions/154852/can-you-solve-the... |
null |
Consider this version of the halting problem: given an input Turing machine $T$, decide whether $T$ halts on empty input. You can assume that $T$ is a valid description of a TM. This problem is known to be undecidable.
My answer in [your other question](https://cs.stackexchange.com/questions/154852/can-you-solve-the... |
Using the same variable $n$ to mean two different things in two places is confusing. In the context of your question, I think it is better to describe the running time of GNFS as $$\exp\left( (c+o(1)) \, n^{\frac{1}{3}}(\log n)^{\frac{2}{3}}\right),$$
where $n$ is the number of bits in the number being factored, and ... |
[Wikipedia][1] states the time complexity of the General Number Field Sieve is
$$\exp\left( \left(\sqrt[3]{\frac{64}{9}} + o(1)\right)(\ln N)^{\frac{1}{3}}(\ln \ln N)^{\frac{2}{3}}\right),$$
where $N$ is the number to be factored, not the length of the input.
The same site also mentions [quasi-polynomial time][2] is
$... |
It is more likely that the solution is $\underbrace{(0+1)^*(00+10+11)}_{\text{words of two or more letters not ending with }01} + \underbrace{0 + 1 + \lambda}_{\text{words of 0 or 1 letter}}$.
Notice that the $(00 + 01 + 11)$ part has been transformed into $(00 + 10+11)$. Also the Kleene star on the last $1$ is usel... |
this question is related to [this](https://cs.stackexchange.com/questions/154852/can-you-solve-the-kinds-of-tms-problem) question but it's different and seems easier to solve and you can't confuse it with the halting problem
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's... |
this question is related to [this](https://cs.stackexchange.com/questions/154852/can-you-solve-the-kinds-of-tms-problem) question but it's different and seems easier to solve and you can't confuse it with the halting problem
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's... |
null |
this question is related to [this](https://cs.stackexchange.com/questions/154852/can-you-solve-the-kinds-of-tms-problem) question but it's different and seems easier to solve and you can't confuse it with the halting problem
there are 3 kinds of TMs
1. a Halting TM on all inputs prints finitely many symbols on it's... |
null |
Is there an algorithm that help to build a linear order on a set of states of automaton (without output signals), such that this order is compatible with a transtion function of automaton?
Let A = (X, S, δ) be an automaton, where X is a set of states, S is a set of input signals, δ: X × S → X is a transition functio... |
Effecient algorithm to build a linear order on a set of states of automaton |
|algorithms|automata|discrete-mathematics| |
null |
The problem reads as follows:
Write a regular expression for the following language on {0, 1}:
$\bullet$ all strings not ending in 01.
The solution my teacher gave is
(0+1)$^{*}$(00+10+11)+0+1+$\lambda$
So if I understand this correctly I could produce a string like
0001 right? Which ends in 01 whic... |
The problem reads as follows:
Write a regular expression for the following language on {0, 1}:
$\bullet$ all strings not ending in 01.
The solution my teacher gave is
(0+1)$^{*}$(00+10+11)+0+1+$\lambda$
So if I understand this correctly I could produce a string like
0001 right? Which ends in 01 whic... |
null |
I have the logical formula
$$
A \Leftrightarrow B \Leftrightarrow C
$$
In order to make the truth table I'm not sure wheither I should interpret it as
$A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$
my truth table for $A \Leftrightarrow B \Leftrightarrow C$:
| A | B | C |$A... |
Logical equivalence priority |
|logic|arithmetic|propositional-logic|relational-calculus| |
I have the logical formula
$$
A \Leftrightarrow B \Leftrightarrow C
$$
In order to make the truth table I'm not sure wheither I should interpret it as
$A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$
Here is my first truth table:
- ABC | $A \Leftrightarrow B \Leftrightarrow ... |
I have the logical formula
$$
A \Leftrightarrow B \Leftrightarrow C
$$
In order to make the truth table I'm not sure wheither I should interpret it as
$A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$
Here is my first truth table:
- ABC | $A \Leftrightarrow B \Leftrightarrow ... |
I have the logical formula
$$
A \Leftrightarrow B \Leftrightarrow C
$$
In order to make the truth table I'm not sure wheither I should interpret it as
$A \Leftrightarrow B \Leftrightarrow C$ or $A \Leftrightarrow (B \Leftrightarrow C)$
Here is my first truth table:
|$A$|$B$|$C$|$A \Leftrightarrow B \Leftrigh... |
The symbol $\Leftrightarrow$ is generaly defined as a binary operator. That means that $A\Leftrightarrow B\Leftrightarrow C$ is not defined without a priority between both $\Leftrightarrow$'s.
However, since $A\Leftrightarrow (B\Leftrightarrow C)$ and $(A\Leftrightarrow B)\Leftrightarrow C$ have the same truth table... |
Let $G$ be a graph and $G_s$ its $s$-subdivision, i.e. the graph obtained from $G$ by subdividing each edge $s$ times.
Why is the treewidth of $G$ the same as the treewidth of $G_s$?
(Subdividing an edge $s$ times means that we replace $e = (u,v)$ with a path from $u$ to $v$ of length $s+1$, i.e. $u, x_1, x_2, x_... |
null |
If $G$ is a forest, then clearly the statement is true.
Suppose that $G$ is not a forest, which means that its treewidth is at least 2. This means that we are allowed to construct bags of three vertices.
Let $e = uv$ be an edge in $G$ and construct $G'$ where we have the path $u, x_1, x_2, x_3, v$ in the place o... |
I am trying to prove that an undecidable language $L$ is not many one reducible to its complement.
The problem goes as follows:
Formally prove that $L \not\leq_m \overline{L}$ for any undecidable $L$. ($\overline L$ is also denoted $L^c$.)
How would I go about proving this? I am unsure how to prove mapping re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.