instruction
stringlengths
0
29.8k
⌀
|formal-languages|formal-grammars|
Try and build it step by step: - a language with an odd number of $a$'s: $a(aa)^*$; - between which there is an even number of $b$'s: $b^*a((bb)^*a(bb)^*a)^*b^*$; - and an arbitrary number of $x$'s: $(b+x)^*a(x^*(bx^*bx^*)^*ax^*(bx^*bx^*)^*a)^*(b+x)^*$.
I wanted to ask if someone can help me to construct a regular expression over the alphabet $\{a,b,x\}$ for the language $L$ which is constituted by all strings containing an odd number of $a$'s, and in which between each pair of consecutive $a$'s there is an even number of $b$'s (and an arbirtary number of $x$'s). F...
A regular expressions for a given formal language
|formal-languages|regular-languages|regular-expressions|
In "Computers and Intractability A Guide to the Theory of NP-Completeness" textbook pp 236, "Sequencing to minimize tardy tasks" is NP-complete. To be specific the problem is as follows: For each task $t \in T$, partial order $<$ on $T$, a length $l(t)$, and a deadline $d(t)$ and a positive integer $K \leq |T|$....
NP-completeness of scheduling to minimise tardy tasks with release times
|complexity-theory|scheduling|
Assume the new problem was polynomially solvable. Take any instance of the old problem and add release dates $r(t)=0$ for all $t \in T$. Then the new problem has a "yes" answer for the modified instance if and only if the old problem had a "yes" answer for the original instance. We have reduced the old problem to the n...
|algorithms|algorithm-analysis|sorting|average-case|
I have asked this question at [math.stackexchange](http://math.stackexchange.com/questions/167462/historical-relation-between-computer-science-and-the-theory-of-dynamical-systems), but I have been redirected here. My question is, if there is any historical relation between the fields of Dynamical systems (and relate...
|computability|lambda-calculus|type-theory|
I wanted ask if you know an algorithm to find the witness for $EU(\phi_1,\phi_2)$ using BDDs. In pratice you should use the fixed point for calculating $EU(\phi_1,\phi_2)$, that is: $\qquad \displaystyle EU(\phi_1,\phi_2)=\mu.Q (\phi_2 \vee (\phi_1 \wedge EX Q)) $ Unwinding the recursion, we get: $\qquad \disp...
Is it possible to always construct a hamiltonian path on a [tournament graph](http://en.wikipedia.org/wiki/Tournament_(graph_theory)#Paths_and_cycles) $G=(V,E)$ by sorting (using any sorting algorithm) with the following total order: $\qquad \displaystyle a \leq b \iff (a,b) \in E \lor \left(\exists\, c \in V. a \le...
> **Possible Duplicate:** > [NP-completeness or not](http://cs.stackexchange.com/questions/2634/np-completeness-or-not) <!-- End of automatically inserted text --> I know that graph contractability is $NP$-complete. To be specific given $G=(V_1,E_1)$ and $H=(V_2,E_2)$, can a graph isomorphic to H be obtained from...
{"OriginalQuestionIds":[2634],"Voters":[{"Id":39,"DisplayName":"Gilles"}]}
NP-completeness of graph isomorphism through edge contractions with an edge validity condition
|complexity-theory|computability|graphs|np-complete|np-hard|
> **Possible Duplicate:** > [NP-completeness or not](http://cs.stackexchange.com/questions/2634/np-completeness-or-not) <!-- End of automatically inserted text --> I know that graph contractability is $NP$-complete. To be specific given $G=(V_1,E_1)$ and $H=(V_2,E_2)$, can a graph isomorphic to H be obtained...
Proof of NP-completeness of graph isomorphism through edge contractions that reduce a metric
I assume that you intend $\leq$ to be the reflexive and transitive closure of $E$, or directed reachability, that is $\leq$ is really the smallest fixpoint of the equivalence you give: $\qquad \displaystyle a \leq b \iff \exists\, v_0 \dots v_n. a \to v_o \to \dots \to v_n \to b$ with $n \geq 0$ and $v \to u \iff...
I want to specify, what it means to give an algebra as input to an algorithm and didn't find very much literature about it. So first I want to ask if you can recommend a book or paper that deals with the topic of complexity analysis of algebras over fields *and clearly define the decision problem*. After some diggin...
|terminology|decision-problem|
A regular expression for a given formal language
I wanted ask if you know an algorithm to find the witness for $EU(\phi_1,\phi_2)$ ( CTL formula "Exist Until") using BDDs. In pratice you should use the fixed point for calculating $EU(\phi_1,\phi_2)$, that is: $\qquad \displaystyle EU(\phi_1,\phi_2)=\mu.Q (\phi_2 \vee (\phi_1 \wedge EX Q)) $ Unwinding the recur...
|algorithms|optimization|
I wanted ask if you know an algorithm to find the witness for $EU(\phi_1,\phi_2)$ ( CTL formula "Exist Until") using BDDs ([Binary Decision Diagram](http://en.wikipedia.org/wiki/Binary_decision_diagram)). In pratice you should use the fixed point for calculating $EU(\phi_1,\phi_2)$, that is: $\qquad \displaystyle E...
There are $n$ people at a table. The $i$th person has to pay $p_i$ dollars. Some people don't have the right bills to pay exactly $p_i$, so they come up with the following algorithm. > First, everyone puts all their money on the table. Then each individual takes back the money they overpaid. An example: Su...
Suppose that someone found a polynomial algorithm for a NP-complete decision problem. Would this mean that we can modify the algorithm a bit and use it for solving the problems that are in NP, but not in NP-complete? Or would this just shows the availability of a polynomial algorithm for each NP problem indirectly?
NP-completeness and NP problems
|complexity-theory|
Recall a few definitions. A language $L \subseteq \{0,1\}^*$ is polynomial-time reducible to a language $L' \subseteq \{0,1\}^*$, often denoted as $L \leq_p L'$, if there is a *polynomial-time computable* function $f : \{0,1\}^* \to \{0,1\}^*$ such that for every $x \in \{0,1\}^*$, $x \in L$ iff $f(x) \in L'$. Now, $L'...
Suppose that someone found a polynomial algorithm for a NP-complete decision problem. Would this mean that we can modify the algorithm a bit and use it for solving the problems that are in NP, but not in NP-complete? Or would this just shows the availability of a polynomial algorithm for each NP problem indirectly? ...
I just learned that when we have a polynomial algorithm for NP-complete problems, it is possible to use that algorithm to solve all NP problems. So, the question is how we then distinguish non-NP-complete NP problems from NP-complete problems? It seems that all these problems will have a polynomial algorithm to con...
How do we distinguish NP-complete problems from other NP problems?
|complexity-theory|
Not really. For instance, the [Graph isomorphism problem](http://en.wikipedia.org/wiki/Graph_isomorphism_problem) is believed not to be in P, but on the other hand not being NP-complete (and is obviously in NP). Moreover, also all problems in P (that are also in NP) are not NP-complete, if $P \neq NP$. However, to my k...
null
The <a href="http://en.wikipedia.org/wiki/Discrete_logarithm">discrete logarithm</a> is the same as finding $b$ in $a^b=c \bmod N$, given $a$, $c$, and $N$. I wonder what complexity groups (e.g. for classical and quantum computers) this is in, and what approaches (i.e. algorithms) are the best for accomplishing this...
How hard is finding the discrete logarithm?
|algorithms|complexity-theory|time-complexity|discrete-mathematics|
To provide the flip side of 042's answer: it's important to understand that if $P=NP$ then _every_ problem in $NP$ is $NP$-complete (caveat: under the usual poly-time reductions): $NP$-complete simply means 'every problem within $NP$ can be solved in polynomial time with an oracle for this problem'. But if every probl...
|formal-methods|model-checking|
I wanted ask if you know an algorithm to find the witness for $EU(\phi_1,\phi_2)$ (CTL formula "Exist Until") using BDDs ([Binary Decision Diagram](http://en.wikipedia.org/wiki/Binary_decision_diagram)). In pratice you should use the fixed point for calculating $EU(\phi_1,\phi_2)$, that is: $\qquad \displaystyle EU...
Is finding the largest subgraph (of a graph) that has hamiltonian path NP-complete? This may be restated as the following: is finding the largest line path of a graph NP-complete? Also, is finding the k-length(edge) line path of a graph NP-complete?
Finding the largest subgraph that has hamiltonian path
|complexity-theory|np-complete|
Is finding the largest subgraph (of a graph) that has hamiltonian path NP-complete? This may be restated as the following: is finding the largest line path of a graph NP-complete? Also, is finding the k-length(edge) line path of a graph NP-complete? Add: case is the same except that this time it is to find th...
First, it is easy to see that the problem is in $\text{NP}$. The longest path is a Hamiltonian one since it visits all vertices. Indeed, there is a straightforward reduction from $\text{HAM-PATH}$ to it. See for example [here](http://en.wikipedia.org/wiki/Longest_path_problem). Likewise, it is $\text{NP}$-complete to d...
First, it is easy to see that the problem is in $\text{NP}$. The longest path is a Hamiltonian one since it visits all vertices. Indeed, there is a straightforward reduction from $\text{HAM-PATH}$ to it. For details and some special cases, see for example [here](http://en.wikipedia.org/wiki/Longest_path_problem). Likew...
The problem of finding the largest subgraph of a graph that has a Hamiltonian path can be restated as finding the longest path of a graph. Is this NP-complete? Also, is finding the $k$-length path of a graph NP-complete? Is it still NP-complete if we require the path to visit a given vertex?
Is finding the longest path of a graph NP-complete?
To provide the flip side of 042's answer: it's important to understand that if $P=NP$ then _every_ problem in $NP$ is $NP$-complete (caveat: under the usual poly-time reductions): $NP$-complete simply means 'every problem within $NP$ can be solved in polynomial time with an oracle for this problem'. But if every probl...
The <a href="http://en.wikipedia.org/wiki/Discrete_logarithm">discrete logarithm</a> is the same as finding $b$ in $a^b=c \bmod N$, given $a$, $c$, and $N$. I wonder what complexity groups (e.g. for classical and quantum computers) this is in, and what approaches (i.e. algorithms) are the best for accomplishing this...
null
The question is from Arora-Barak's book Computational Complexity - A Modern Approach: --- Define a RAM Turing machine to be a Turing machine that has random access memory. We formalize this as follows: The machine has an infinite array A that is initialized to all blanks. It accesses this array as follows. One of t...
Computational Complexity(Arora-Barak), Exercise 1.9
|complexity-theory|turing-machines|
null
The question is exercise 1.9 from Arora-Barak's book *Computational Complexity — A Modern Approach*: --- Define a RAM Turing machine to be a Turing machine that has random access memory. We formalize this as follows: The machine has an infinite array A that is initialized to all blanks. It accesses this array as fo...
Prove that a boolean function computable in T(n) by a RAM machine is in DTIME(T(n)^2)
Turns out this is not an easy problem, but it has been solved. A similar case is treated in [Bounded discrete walks](http://www.dmtcs.org/dmtcs-ojs/index.php/proceedings/article/view/dmAM0103) by Banderier and Nicodème (2010) and they refer to the exact result you need in [Combinatoire analytique des chemins et des car...
The language is: L = { (a^n) (b^m) : n + m = 3k, k>=0 } My attempt at an answer: (a U b) ^ (3k) This will work if the a OR b can change for each instance in the string that is (3k) long. If not, what can I do to fix this?
regular expression given the language
|regular-languages|regular-expressions|
First off, putting $k$ in the regular expression is not allowed by typical regular expression syntax, unless I'm mistaken. Even adding constant powers is a shorthand notation, not a part of the regular expression formalism. Even if it were possible, using that notation, you could mix $a$'s with $b$'s, so that not all $...
Expand the recurrence and sum it up. Example 1: T(n) = T(n-5) + O(n^2) = T(n-10) + O(n^2) = .... = T(0) {n/5 terms} Now let's say T(0) = c. This would be generally given in the question. so this would sum to (n/5).(n^2) = O(n^3) Example 2: T(n) = T(n-2)+log...
For simplicity, lets assume that 5 divides n and that n/2=n-5k for some integer k>0. T(n) = T(n-5) + cn^2 T(n) = cn^2 + c(n - 5)^2 + c(n - 10)^2 + c(n - 15)^2 + ... + c5^2 + c0^2 = c(n^2 + (n - 5)^2 + (n - 10)^2 + (n - 15)^2 + ... + 5^2 + 0^2) >= c(n^2 + (n - 5)^2 + (n - 10)^2 + (n / 2...
I've been tasked with solving some recurrence relations, and I've been running into trouble with so called 'chip & conquer' relations. Here are some example problems: T(n) = T(n-5) + cn^2 and T(n) = T(n-2) + log n I'm supposed to be giving an answer in Θ notation. How do I go around and solving r...
Solving Recurrence Relations 'Chip & Conquer'
|recurrence-relation|
I've been tasked with solving some recurrence relations, and I've been running into trouble with so called 'chip & conquer' relations. Here are some example problems: $$T(n) = T(n-5) + cn^2$$ and $$T(n) = T(n-2) + \log{n}$$ I'm supposed to be giving an answer in $\Theta$ notation. How do I go around and ...
null
I am getting started with Graph theory in my algorithms course and trying to understand the approach for this problem: > "If all streets are one way, there is still a legal way to drive from > one intersection to another" The question is to prove that it can be done in liner time. I am not looking for direct ans...
How to approach this graph theory problem?
|graphs|algorithm-analysis|
You can use a segment tree to perform dynamic selection in $O(\log S)$ per oper; where $S$ is the size of the universe. To do this, you need to maintain the total number of elements in the segment represented by a node. In fact, a binary indexed tree can also be used. Or you could also use a balanced binary search t...
Given an Undirected graph, I define a structure called $k-key$ as a path contains $k$ vertices which connected to a simple path which contains a $k$ vertices as well. Here's a problem: **The '$k-key'$ problem**: Input: an undirected graph $G$ and a number $k$. question: Does $G$ contains a $k-key$? I need ...
The $'k-key'$ problem
|np-complete|reductions|np-hard|
I'm working on an expression typing system and looking for insights on what algorithms may be available which solve my problem -- or a proof that its complexity is too high to be reasonable to implement. The problem is defined below. I have a set of types which form a directed graph $T = (V,E)$ (assume no cycles). T...
Algorithm for type conversion / signature matching
|algorithms|typing|
You want to find a way of creating $G'$ from $G$ such that $G'$ has a $k-key$ iff $G$ has a Hamiltonian path. If a graph $G$ has $k$ vertices and a simple path of length $k$, then what can we conclude about it having a Hamiltonian path?
By Lagrange's theorem, $b=O(N)$, since $|a|=O(N)$. (Meaning brute-force is in EXP.) For a non-deterministic machine, there is a polynomial witness since we can do [modular exponentiation](http://en.wikipedia.org/wiki/Modular_exponentiation) in P. (I.e. the problem is in $NP$.) The theory that discrete logarithms ...
I am getting started with graph theory in my algorithms course and trying to understand the approach for this problem: > "If all streets are one way, there is still a legal way to drive from > one intersection to another" The question is to prove that it can be done in linear time. I am not looking for direct an...
Existence of a route following one-way streets
Given an Undirected graph, I define a structure called $k-key$ as a path contains $k$ vertices which connected to a simple cycle which contains a $k$ vertices as well. Here's a problem: **The '$k-key'$ problem**: Input: an undirected graph $G$ and a number $k$. question: Does $G$ contains a $k-key$? I need...
since $|a|=O(N)$, then $b=O(N)$. (Meaning brute-force is in EXP.) For a non-deterministic machine, there is a polynomial witness since we can do [modular exponentiation](http://en.wikipedia.org/wiki/Modular_exponentiation) in P. (I.e. the problem is in $NP$.) The theory that discrete logarithms are in $NP$ but no...
I've been reading a bit of the literature lately, and have found some rather interesting data-structures. I have researched various different methods of getting update times down to $\mathcal{O}(1)$ worst-case update time[1][2][3][4][5][6]. Recently I begun looking into lock-free data-structures, to support effic...
Lock-free, constant update-time concurrent tree data-structures?
|data-structures|time-complexity|distributed-systems|concurrency|search-trees|
Expand the recurrence and sum it up. Example 1: $$ \begin{align*} T(n) &= T(n-5) + O(n^2) = T(n-10) + O(n^2) = \dots \\ &= T(0) + \{\text{\(n/5\) terms, each \(O(n^2)\)}\} \end{align*} $$ Now let's say $T(0) = c$. This would be generally given in the question. so this would su...
For simplicity, let's assume that $5$ divides $n$ and that $n/2=n-5k$ for some integer $k>0$. $$ \begin{align*} T(n) &= T(n-5) + cn^2 \\ T(n) &= cn^2 + c(n - 5)^2 + c(n - 10)^2 + c(n - 15)^2 + ... + c5^2 + c0^2 \\ &= c(n^2 + (n - 5)^2 + (n - 10)^2 + (n - 15)^2 + ... + 5^2 + 0^2) \\ &\ge c(n^...
The language is: $$ L = \{ (a^n) (b^m) \mid n + m = 3k, k \ge 0 \} $$ My attempt at an answer: $$ (a \cup b)^{3k} $$ This will work if the a OR b can change for each instance in the string that is (3k) long. If not, what can I do to fix this?
You want to find a way of creating $G'$ from $G$ such that $G'$ has a $k-key$ iff $G$ has a Hamiltonian path. If a graph $G$ has $k$ vertices and a simple path of length $k$, then what can we conclude about it having a Hamiltonian path? EDIT: I'm guessing the intention is that the vertices in the path must be dif...