instruction
stringlengths
0
29.8k
⌀
The problem is $\mathsf{NP}$-hard by a reduction from [Exact Cover by 3-Sets](https://cstheory.stackexchange.com/questions/20386/restriction-of-exact-cover-by-3-sets): <blockquote> <b>Instance</b>: a set $X = \{ x_1,x_2,...,x_{3n}\}$ and a family $F = \{ ( x_{i_1}, x_{i_2}, x_{i_3}) \} $ of 3-elements subsets of $...
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
Given an undirected graph $G=(V,E)$, and a parameter $k\in \mathbb{N}$ such that $k\geq 2$, how can I show that if $|E|\geq |V|^{1+\frac{1}{k}}$, a cycle $C$ exists in $G$ such that $|C|\leq 2k$? The only initial idea I have is that as $|E|\geq |V|^{1+\frac{1}{k}}$, I know that the maximal degree of a vertex is at l...
Graph containing a cycle of $2k$
|graphs|graph-traversal|
I have a function $f$ such that is the sum of big O terms, such as $$f=[\sum_{i=1}^x \frac{1}{i}] +O(x)+O(x-1)+O(x-2)+\ldots$$ where $x$ is a positive integer. Am I correct in that I can simply write $$f=[\sum_{i=1}^x \frac{1}{x}] + O(x)$$ because I just need to write the bigger value for the big O? An...
I have a function $f$ such that is the sum of big O terms, such as $$f=[\sum_{i=1}^x \frac{1}{i}] +O(\frac{\ln^4 x}{x})+O(\frac{\ln^4 x-1}{x-1})+O(\frac{\ln^4 x-2}{x-2})+\ldots$$ where $x$ is a positive integer. Am I correct in that I can simply write $$f=[\sum_{i=1}^x \frac{1}{x}] + O(\frac{\ln^4 x}{x})$$ ...
I need to show that assuming $NP \neq coNP$ then there are 2 non-trivial languages $A$ and $B$ ($A,B \neq \emptyset, \Sigma^*$) in $NP \cup coNP$ such that there's no polynomial time reduction from A to B and there's no polynomial time reduction from B to A. I tried doing this: Let $A$ be non-trivial language s...
Problem about $NP \neq coNP$
|np-complete|polynomial-time-reductions|
Binary extension field, usually denoted as $\textsf{GF}(2^n)$ or $\mathbb{F}_{2^n}$, is a finite fields of characteristic 2. > **Are there any applications of $\textsf{GF}(2^n)$ (or more broadly, $\textsf{GF}(p^n)$), for $n>1$, in computer science?** My impression is that most applications only require a suffic...
Usefulness of binary extension field GF(2^n)
|arithmetic|applied-theory|
I need to show that assuming $NP \neq coNP$ then there are 2 non-trivial languages $A$ and $B$ ($A,B \neq \emptyset, \Sigma^*$) in $NP \cup coNP$ such that there's no polynomial time reduction from A to B and there's no polynomial time reduction from B to A. I tried doing this: Let $A$ be non-trivial language s...
It is not correct because you don't have a constant number of terms in your sum. Indeed, your sum has $\ln^4 x$ terms (assuming it stops when the numerator is $0$). Actually the smaller terms may have an impact. However we can bound it. Let's start by rewriting the sum: $$\sum_{i=0}^{\ln^4 x -1} \frac{\ln^4 x-i}...
You can’t add an infinite number of big-Os. O(f(x)) is limited by f(x), multiplied by some constant c. If you have 100 Big-Os then they all have different constants, so you can just take the largest. But with an infinite number of Big-Os, these constants could grow without any limit, so there is no single c tha...
This is the question: >1.7. Give state diagrams of NFAs with the specified number of states recognizing each of the following languages. In all parts, the alphabet is {0,1}. >a. The language {w| w ends with 00} with three states This is how my professor answered it: [![my professor answer][1]][1] But th...
NFA for the language that accepts binary strings ending with 00
|automata|finite-automata|
$GF(2^n)$ is used in error correcting codes, in some elements of cryptography (e.g., message authentication with 2-universal hashing), and in the AES block cipher, which is very widely used.
The first attempt is not really helpful because you can pick a nontrivial language $A\in \text{P}$ (a too easy language), and in this case, one can easily obtain a PTIME reduction from $A$ to its complement. Can you tell why? So this gives no no contradiction. What you need to do is aim to the big fish, languages th...
The first attempt is not really helpful because you can pick a nontrivial language $A\in \text{P}$ (a too easy language), and in this case, one can easily obtain a PTIME reduction from $A$ to its complement. Can you tell why? So this gives no contradiction. What you need to do is aim to the big fish, languages that ...
null
The first attempt is not really helpful because you can pick a nontrivial language $A\in \text{P}$ (a too easy language), and in this case, one can easily obtain a PTIME reduction from $A$ to its complement. Can you tell why? So this gives no contradiction. What you need to do is aim to the big fish, languages that ...
The first answer is incorrect. The automaton does not accept, for example, the input word $0100$. In fact, the first automaton misses at least all words in the language that are not of the form $1^*0^*$. The second answer is correct. It is not hard to prove it. Can you try?
Okay, so I understand implicitly why we might write `f(n) = log 3n = O(log n)` but I don't really understand why lets say `f(n) = log 3n^2 = O(log n)`. Then what am I suppose to do with `f(n) = log n!` does this also just equal O(log n)? Or do I need to write it out explicitly like with `f(n) = 2^(2n^3 + log_2 n) = ...
Big O Notation, Why do we ignore everything inside the log?
|asymptotics|big-o-notation|
Let $n = |V|$ and $m=|E|$. The average degree of the vertices in $G$ is $\frac{2m}{n} \ge \frac{2n^{1+1/k}}{n} = 2n^{1/k}$. If there is a vertex $v$ with degree $d_v \le n^{1/k}$ then deleting $v$ still results in a graph with average degree $\frac{2 (m - d_v)}{n} \ge \frac{2(n^{1+1/k} - n^{1/k})}{n-1} = \frac{2n^{...
Let $n = |V|$ and $m=|E|$. The average degree of the vertices in $G$ is $\frac{2m}{n} \ge \frac{2n^{1+1/k}}{n} = 2n^{1/k}$. If there is a vertex $v$ with degree $d_v \le n^{1/k}$ then deleting $v$ still results in a graph with average degree $\frac{2 (m - d_v)}{n} \ge \frac{2(n^{1+1/k} - n^{1/k})}{n-1} = \frac{2n^{...
By the properties of logarithms: $$\log 3 n^2 = \log 3 + \log n^2 = \log 3 + 2 \log n = O(\log n)$$ and, using $n! \le n^n$ for $n \ge 1$: $$ \log n! \le \log n^n = n \log n = O(n \log n). $$ This latter bound is asymptotically tight since $n! \ge \left( \frac{n}{3} \right)^{n/3}$: $$ \log n! \ge \log \left( \f...
Let $n = |V|$ and $m=|E|$. The average degree of the vertices in $G$ is $\frac{2m}{n} \ge \frac{2n^{1+1/k}}{n} = 2n^{1/k}$. If there is a vertex $v$ with degree $d_v \le n^{1/k}$ then deleting $v$ still results in a graph with average degree $\frac{2 (m - d_v)}{n-1} \ge \frac{2(n^{1+1/k} - n^{1/k})}{n-1} = \frac{2n...
Assume that I know that a decision problem is not in $NTIME(2^{n^c})$. What is the lower bound that I can get from this fact? Do I know for instance whether it is PSPACE-hard?
What does a problem not in $NTIME(2^{n^c})$ tell me?
|complexity-theory|decision-problem|
null
Assume that I know that a decision problem is not in $NTIME(2^{n^c})$ where $c$ is a constant. What is the lower bound that I can get from this fact? Do I know for instance whether it is PSPACE-hard?
null
null
I need to prove if the following Language is or is not semi-decidable. <b>A := {w ∈ {0,1}^* | there exists an input x on which M_w produces the output 0}</b> Where A is the language of all the encoding w ∈ {0,1}^* of all Turing machines which at least halts on at least one input x (might also accept it) and produce ...
Is the Language of all encodings of Turing Machine that at least halts on one input and outputs 0 semi-decidable?
|computability|reductions|undecidability|halting-problem|semi-decidability|
In graph theory, a tree is is usually defined as a connected *undirected* graph with no cycles. One would also call a directed graph a tree if the underlying undirected graph is a tree. The concept of nodes having "parents" is more a technique for working with trees as data structures in computer science. For an undire...
null
Since it seems like you are really uncertain about your own solution. Let's verify it step by step: 1- A is undecidable. To prove this statement, it is enought to show that there is a mapping reduction from the following set to A: Halt = {<M> | M is a Turing machine which halts on <M>} For any Turing machi...
null
null
I need to use logic gates to calculate the floor of binary logarithm of a binary number $x_{n-1}, ..., x_0$. I know that this can be computed when I find the position of the most significant bit set to 1. So how do I find this bit and return it's position using only binary logic gates (AND, OR, XOR, NOR, NAND, ...
Binary logarithm of binary number using logic gates
|circuits|arithmetic|
null
You start by building a circuit for two input bits. It has two outputs: the position of the highest bit, and a bit indicating that the input is not zero. This is easy: The position is equal to bit 1 of the input, “non-zero” is bit 1 or bit 0. Now you build a circuit with four input bits. You feed bits 3 and 2 into ...
The following problem has made me ask this question: > Given a boolean formula $\varphi(X)$ decide if there exists a quantification of $\varphi(X)$ with $k$ $\forall$ quantifiers that holds true. Assume that $k$ is bounded with $\mathcal O(\log n)$. This problem is clearly in $\mathsf{NP}$: first the proof would ...
Is it possible to find reductions from problems in $\mathsf{NP}$ to SAT based solely on the certificate verification algorithm?
|reductions|np|satisfiability|polynomial-time|polynomial-time-reductions|
null
The following problem has made me ask this question: > Given a boolean formula $\varphi(X)$ decide if there exists a quantification of $\varphi(X)$ with $k$ $\forall$ quantifiers that holds true. Assume that $k$ is bounded with $\mathcal O(\log n)$. This problem is clearly in $\mathsf{NP}$: first the proof would ...
We could use `[[John, Smith], [Mike, Jones], pub]`. Therefore, we know `[John, Smith]` should be treated as one, as well as `[Mike, Jones]`. We would also know to only use these where there are two blanks in a row, when they obey part of speech rules, and not to reverse the order.
Let $n$ be the number of unique names, and $m$ be the number of unique surnames. Since we have $n$ unique names, and each of them may choose $m$ unique surnames, we will have $nm$ unique name-surname combinations.
Insertion sort relies on the previous $i-1$ elements to sort the $i$-th element. In your recursive algorithm, it starts at $5$th element, but it relies on the previous $5-1$ elements, going all the way to the first, which we can trivially sort by doing nothing, then going back up to the $5$th element again.
The algorithm is not asymptotically solved when we have not found the tight bound, i.e. the lower bound being equal to the upper bound. It is possible to solve this asymptotically for most algorithm, but absolute shortest algorithm is undecidable according to Rice's theorem. Rice's theorem states that all non-trivia...
It is correct, but it could be made more readable. $$ search(node, val) = \begin{cases} \emptyset & \text{if } node = \emptyset \\ search(node.left, val) & \text{if } node.val > val \\ search(node.right, val) & \text{if } node.val < val \\ node & \text{otherwise} \end{cases} $$
I'm not sure whether I understood your solution right. Here is my suggestion: For code of M: 1- Find all paths from start state to an accept state which every state occurs only once. 2- Check whether in states that occurs in paths, There are states that are connected together with a path which doesn't appear i...
I just need some clarification regarding the different terms we use in theoretical computer science, especially regarding decidability. 1. **Decidable:** A language $L$ (a set of strings) is decidable if there exists a Turing machine M$$ that, for any input string $w$, halts on w and correctly decides whether $w$ ...
Decidability terms clarification
|turing-machines|undecidability|decision-problem|halting-problem|semi-decidability|
I just need some clarification regarding the different terms we use in theoretical computer science, especially regarding decidability. 1. **Decidable:** A language $L$ (a set of strings) is decidable if there exists a Turing machine $M$ that, for any input string $w$, halts on w and correctly decides whether $w$ ...
I can prove the claim for graphs with $|E| \ge |V|^{1+ 1/k} + n$ Let $n = |V|$ and $m=|E|$ and $D = \lceil n^{\frac{1}{k}} \rceil$. As long as $G$ contains a vertex $v$ with degree at most $D$, delete $v$. You are left with a graph $G'$ in which all vertices have degree at least $D+1$. The graph $G'$ cannot be...
I can prove the claim for graphs with $|E| \ge |V|^{1+ 1/k} + |V|$ Let $n = |V|$ and $m=|E|$ and $D = \left\lceil n^{\frac{1}{k}} \right\rceil$. As long as $G$ contains a vertex $v$ with degree at most $D$, delete $v$. You are left with a graph $G'$ in which all vertices have degree at least $D+1$. The graph $...
Undecidable means "not decidable". They are synonyms. The definition is: we say that $L$ is undecidable if $L$ is not decidable.
You can always check whether two circuits have identical behaviour, there are only a finite number of circuits of size k for every k, so you can just systematically try out all circuits ordered by size and produce the first one matching the original, all in finite time. So there is an algorithm. In practice the num...
The following problem has made me ask this question: > Given a boolean formula $\varphi(X)$ decide if there exists a quantification of $\varphi(X)$ with $k$ $\forall$ quantifiers that holds true. Assume that $k$ is bounded with $\mathcal O(\log n)$. To clarify, the order of the quantifiers is arbitrary. I.e. the ...
The following problem has made me ask this question: > Given a boolean formula $\varphi(X)$ decide if there exists a quantification of $\varphi(X)$ with $k$ $\forall$ quantifiers that holds true. Assume that $k$ is bounded with $\mathcal O(\log n)$. To clarify, the order of the quantifiers is arbitrary. I.e. the ...
Let $B$ and $C$ be collections of finite sets. We say that $B$ is a *normal basis* of $C$ if for all $c\in C$ there is a pairwise disjoint subcollection of $B$ whose union is exactly $c$. The input of the *normal set basis problem* is a collection $C$ of finite sets and an integer $k\geq 1$, and we need to decide w...
Approximation of the Normal Set Basis Problem
|np-complete|approximation|polynomial-time|
You start by building a circuit for two input bits. It has two outputs: the position of the highest bit, either 0 or 1, and a bit indicating that the input is not zero. This is easy: The position is equal to bit 1 of the input, “non-zero” is bit 1 or bit 0. Now you build a circuit with four input bits. You feed bit...
As far as I know, the K coloring problem is NP-complete. However, I'm a bit confused about how to determine whether a problem is weakly or strongly NP-complete. - If an NP-complete problem is decidable by a pseudo-polynomial time algorithm, it is called weakly NP-complete. - If an NP-complete problem's unary versio...
Proof that the K coloring problem is weakly or strong NP-complete?
|complexity-theory|graphs|np-complete|colorings|pseudo-polynomial|
There are no obvious integers involved in the $K$-coloring problem (where $K$ is part of the problem and not of the input). The length of the encoding of an instance of $K$-coloring is the length of the encoding of the graph. The [standard reduction from 3-SAT](https://homes.cs.washington.edu/~anuprao/pubs/431/lectu...
Finding a reduction to SAT is easy but tedious. Write down a description of polynomial-time Turing machine $T$ that checks the certificate (as you have argued in your question, such a Turing machine exists), then encode $T$ into a SAT formula $\psi$ that has a variable for each input symbol of the certificate (plus a...
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of rectangle id,left_bottom_corner_x_coordinate, left_bottom_corner_y_coordinate, right_top_corner_x_coordinate, right_top_corner_y_coordinate}, I need to use a structure which will...
Optimal Data structure
|data-structures|optimization|trees|
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of: {rectangle_id,left_bottom_corner_x, left_bottom_corner_y, right_top_corner_x, right_top_corner_y}, I need to use a structure which will answer queries such as which 2...
When a CPU needs to get more instructions from storage and copies them to ram how does the CPU jump to previous instructions that are no longer in the ram. Would it have to copy the old instructions back into ram? I feel like that would take a very long time to do. FOR EXAMPLE: this is storage xsxx xxax. pretend th...
When a CPU copies instructions from storage into ram how does it jump to previous instructions?
|computer-architecture|cpu|storage|instruction-set|
There seems to be a faulty premise in your question. Normally, old instructions remain in memory. They are not removed from memory. If the [virtual memory](https://en.wikipedia.org/wiki/Virtual_memory) subsystem pages/swaps them out, it will page/swap them in when needed, just as with any other memory that is acce...
null
Let me answer one of your not fully addressed points: > Because of all above, immutability adds huge space complexity to a program You're kinda right on the concern over immutability adding huge space complexity. Let me tackle that point. It's true that constantly creating new data structures instead of mutat...
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of- {rectangle_id,left_bottom_corner_x, left_bottom_corner_y, right_top_corner_x, right_top_corner_y}, I need to use a structure which will answer the following queries: ...
Optimal Data structure for queries involved rectangles and cartesian coordinates
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of- {rectangle_id,left_bottom_corner_x, left_bottom_corner_y, right_top_corner_x, right_top_corner_y}. I need to use a structure which will answer the following queries:...
What data structure would be optimal in terms of time and space for the following usecase: Given information about rectangles in the form of- {rectangle_id,left_bottom_corner_x, left_bottom_corner_y, right_top_corner_x, right_top_corner_y}. ### I need to use a structure which will answer the following quer...
null