instruction stringlengths 0 29.8k ⌀ |
|---|
Is this version of SAT NP-Complete? |
|complexity-theory|np-complete| |
We can prove this without using Parikh's theorem.
Assume that a language $L$ over the two-letter alphabet $\{0,1\}$ is given by a finite-state machine.
For the language $\mathrm{SCRAMBLE}(L)$ we construct an automaton with one register capable of holding any integer (positive or negative).
The states are the same as... |
Let $\Sigma$ be the set \{a,b\} of letters. For a language $L\subset\Sigma^{*}$ over $\Sigma$, we define $\Gamma(L)$ as follows; $\Gamma(L)=\{v\in\Sigma^{*}|\exists w\in \Sigma^{*}.(|v|=|w|\wedge vw\in L)\}$. Here, $|x|$ denotes the length of the string $x$.
Then, for every context-free language $L\subset \Sigma^{*... |
The language made from the context free Language (CFL) is also a CFL? |
|context-free|substrings| |
I have the following ternary constraint that needs to be converted into a set of binary constraints in order to be used for a constraints solving problem:
A = max(b,c)+1
How can I do this? |
Convert ternary constraint into set of binary |
|constraint-satisfaction| |
null |
$ L = \{ <G,k> |\ G \ has \ a \ simple \ cycle
\ at \ length \ k \} $
I think this language is in NP but my friend thinks this language is in P.
NP proof:
if a graph has a simple cycle of a specific length can be verified quickly if we are given the cycle as a certificate.We can check in polynomial time tha... |
does $$ L = \{ <G,k> |\ G \ has \ a \ simple \ cycle \ at \ length \ k \} $$ in P or in NP |
|turing-machines|computability| |
null |
Is $L = \{ \langle G,k\rangle \mid G $ has a simple cycle at length $k \}$ in P or in NP |
Your understanding of how to demonstrate that a language belongs to NP is correct. If a language L consists of instances where each instance is a graph G and an integer k, and L is defined as the set of all instances <G,k> where G contains a simple cycle of length k, then yes, the verification process you've described ... |
Your understanding of how to demonstrate that a language belongs to NP is correct. If a language L consists of instances where each instance is a graph G and an integer k, and L is defined as the set of all instances <G,k> where G contains a simple cycle of length k, then yes, the verification process you've described ... |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
Find 1s in almost all 0 array using comparisons only |
|algorithms|dynamic-programming|python|comparison|dynamic-algorithms| |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
I am currently writing an LL(1) parser. At several places (Engineering a Compiler book, Dragon book, [or this discussion](https://stackoverflow.com/questions/1044600/difference-between-an-ll-and-recursive-descent-parser)), I have seen two ways to go about this, either with a table driven parser (using FIRST, FOLLOW set... |
Table driven parser vs Recursive Descent parser |
|compilers|parsers| |
Given a knowledge base and a proposition alpha we can check if our knowledge base entails alpha using a model checking algorithm that functions as such : we generate a set of all the possible models ,and if for each model where our knowledge base is true alpha is also true we can conclude that our knowledge base entail... |
Model checking algorithms |
|algorithms| |
100 x 100 entries wouldn’t be considered large. And in each row of the table, you can store only entries for members of the follow set, which reduces the table size massively. So 1,000 x 1,000 entries with 50 entries in the follow set on average you need only 50,000 entries which is quite trivial. And a recursive desce... |
Say that a PDA is $\varepsilon$-free if it contains no $\varepsilon$ transitions (that is to say, $\varepsilon$ is not in the recognized string symbols even if it still is a stack symbol), but it may instead push any finite number of symbols to the stack during a single transition. Does every PDA have an equivalent $\... |
PDA equivalent to an $\varepsilon$-free PDA |
|automata|context-free|pushdown-automata| |
Start by splitting the 100 elements in 50 pairs of two, and use a comparison on each pair. If a comparison returns -1 or 1, then you've found one of the elements which is 1 (and the other one must be a 0).
Now there are two cases after these 50 comparisons: either we've found all three 1's, or we've found one 1, bec... |
null |
We can build a specific example over the alphabet $\{a,b,c\}$ as follows.
Let $L_1 = \{ a^k b^m c^j \mid j < m \lor k < m \}$ and $L_2 = \{ a^k b^m c^j \mid k < 2m \}$.
Obviously,
$L_1 \cap L_2 = \{ a^k b^m c^j \mid ( j < m \land k < 2m ) \lor k < m \}$.
We are going to prove that both $L_1 \cap L_2$ and $(L_1 \cap... |
The question asks to write down a regular expression $r$ indicating the language of all the words above $\Sigma = \{a, b\}$ , in which the number of $a$ is even and there is no sub-word $aab$ in them.
I am aware of the fact that there is an algorithm that converts a finite automaton into a regular expression.
I w... |
regular expression : #a(w) mod 2 = 0 and w≠Σ^* aabΣ^* |
|regular-languages|finite-automata|regular-expressions| |
null |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
If your knowledge base contains contradictory propositions, then everything can be derived from that. See, e.g., https://en.wikipedia.org/wiki/Principle_of_explosion. |
You can't. You add the constraints `A <= b+1` and `A <= c+1` but there is no set of binary constraints that are equivalent to your original constraint. |
{"OriginalQuestionIds":[32627],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
null |
You can't. You add the constraints `A <= b+1` and `A <= c+1` but there is no set of binary constraints that are equivalent to your original constraint. This is true even if you're allowed to add additional variables. |
I have the following ternary constraint that needs to be converted into a set of binary constraints in order to be used for a constraints solving problem:
A = max(b,c)+1
How can I do this?
I am allowed to introduce a new variable R to do this. |
I have the following ternary constraint that needs to be converted into a set of binary constraints in order to be used for a constraints solving problem:
A = max(b,c)+1
How can I do this?
I am allowed to introduce a new variable X to do this. |
You can't. It's not possible to do this in $O(\log n)$ time.
Consider the following two possibilities for the tritonic array:
1. We have an array $A^1$ that contains the values $1,2,3,4,\dots,n$, except that at index $i$, we have the value $2n$.
1. We have an array $A^2$ that contains the values $1,2,3,4,\dot... |
regular expression for $\{w\in \{a,b\}^*\mid |w|_a \mod 2 = 0\}\setminus \Sigma^*aab\Sigma^*$ |
I know that exponential time complexity is $ O(k^n) $, where $k$ is some constant and $n$ is the input size, and that subexponential time is anything slower than that, $o(k^n)$ . If we define superexponential time complexity as anything faster than exponential time, $\omega(k^n)$, and given $O(n^{f(n)})$, where $f(n)$ ... |
Is $O(n^{f(n)})$ superexponential if $f(n)$ is a poynomial function such that $f(n) > n$? |
|algorithms|complexity-theory|time-complexity|asymptotics| |
Is $O(n^{f(n)})$ superexponential if $f(n)$ is a polynomial function such that $f(n) > n$? |
I know that exponential time complexity is $ O(k^n) $, where $k$ is some constant and $n$ is the input size, and that subexponential time is anything slower than that, $o(k^n)$ . If we define superexponential time complexity as anything faster than exponential time, $\omega(k^n)$, and given $O(n^{f(n)})$, where $f(n)$ ... |
Is $O(n^{f(n)})$ superexponential if $f(n)$ is a polynomial function such that $f(n) > n$ as n approaches $\infty$,? |
Is $O(n^{f(n)})$ superexponential if $f(n)$ is a polynomial function such that $f(n) > n$ as n approaches $\infty$? |
Is $O(n^{f(n)})$ superexponential if $f(n)$ is a polynomial function such that $f(n) > n$ as $n$ approaches $\infty$? |
The only systematic ways to find regular expression I know of are using automata. As D.W. mentionned in his comment, I am not sure why you are rejecting this method.
A non-systematic approach for this language could be as follow.
The language of words without $aab$ as substring can be represented with the regular... |
Exponential time is often described as complexity in $\mathcal{O}(2^{p(n)})$ for a polynomial function $p$ rather than $\mathcal{O}(k^n)$. See [here](https://en.wikipedia.org/wiki/EXPTIME) for some references.
What you describe is the complexity of the class [$\mathsf{E}$](https://en.wikipedia.org/wiki/E_(complexity... |
null |
null |
null |
Your current code has the following issues:
> ` for i in range(0, len(data), 2):`
This is where you need to put the optimization to (conditionally) avoid comparing the final pair. You have two options for how to do that optimization:
* Subtract 2 from the endpoint of the range, and then check after the loop fo... |
Let $L$ be a unary context-free language. According to the pumping lemma, there is a constant $p$ such that if $a^n \in L$ then either $n < p$ or there exists $q \in \{1,\ldots,p\}$ such that $a^{n+tq} \in L$ for all $t \geq 0$ (actually, the pumping lemma gives $t \geq -1$). Let $L_0$ be the set of words in $L$ of len... |
null |
Clearly, whether a formula is minimally unsatisfiable depends on the exact details of how it is formulated, so let me give a specific definition of Tseitin formulas. Given a graph $G=(V,E)$ and a vertex labelling $l\colon V\to\{0,1\}$, the CNF $T_{G,l}$ uses variables $\{p_e:e\in E\}$, and it includes clauses expressin... |
Hint: Here is an automaton for this language
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/nItBh.png |
In my script I have the following term:
> x => y => both (x) (y)
>
> This is reduced to
both
My interpretation is that this function (the whole term) takes two arguments and returns a function and two variables, but these aren't used by the function thus we can remove them? Is this interpretation correct? |
Is my understanding of Eta reduction correct? |
|lambda-calculus| |
We can prove this without using Parikh's theorem. Assume that a language $L$ over the two-letter alphabet $\{0,1\}$ is given by a finite-state machine. For the language $\mathrm{SCRAMBLE}(L)$ we construct an automaton with one register capable of holding any integer (positive or negative). The states are the same as in... |
I am reading this Wikipedia article:
https://en.wikipedia.org/wiki/Memory_segmentation
And I am in this paragraph:
> **Segmentation with paging**
>
> Instead of a memory location, the segment information includes the
> address of a page table for the segment. When a program references a
> memory location ... |
Are they talking about virtual memory in this article? |
|memory-management|virtual-memory|paging| |
Let $T$ be the original spanning tree, and let $uv$ be the modified edge. Let $xy$ be a heaviest edge on the unique $u$-$v$-path in $T$.
Remove $xy$ from $T$ to obtain $T'$, two disconnected trees consisting of connected components $A$ and $B$. Clearly, $A$ and $B$ are minimum spanning trees of their respective sets... |
Your current code has the following issues:
> ` for i in range(0, len(data), 2):`
This is where you need to put the optimization to (conditionally) avoid comparing the final pair. You have two options for how to do that optimization:
* Subtract 2 from the endpoint of the range, and then check after the loop fo... |
> returns a function and two variables
No, it returns the result of applying the function to these two arguments. This result of course uses the arguments.
Instead, consider this. I don't know what function `both` is, but let's say it works on numbers. if you calculate e.g. `(x => y => both x y) 1 2`, it will be:... |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
I'm reading about the Atlas operating system and I came across this:
> The Atlas system used a British computer with 48-bit words. Addresses were 24 bits but were encoded in decimal, which allowed 1 million words to be addressed.
Why is it 1 million here if it's encoded in decimal? |
The Atlas system word addresses |
|computer-architecture|memory-hardware| |
Your current code has the following issues:
> ` for i in range(0, len(data), 2):`
This is where you need to put the optimization to (conditionally) avoid comparing the final pair. You have two options for how to do that optimization:
* Subtract 2 from the endpoint of the range, and then check after the loop fo... |
The only systematic ways to find regular expression I know of are using automata. As D.W. mentionned in his comment, I am not sure why you are rejecting this method.
A non-systematic approach for this language could be as follow.
The language of words without $aab$ as substring can be represented with the regular... |
So, we are given a 100 long array, with 97 0s and 3 1s of which we do not know the locations. We must find them using only a compare function, which I managed to write (in Python):
def compare(i, j):
comparisons.append((i, j))
if data[i] == data[j]:
return 0
else:
... |
null |
Your current code has the following issues:
> ` for i in range(0, len(data), 2):`
This is where you need to put the optimization to (conditionally) avoid comparing the final pair. You have two options for how to do that optimization:
* Subtract 2 from the endpoint of the range, and then check after the loop fo... |
null |
null |
In a directed graph, if you find scc (strongly connected components), then for each negative edge, if its 2 vertices are in the same scc and that scc has size > 1, then there is a negative cycle with that edge, and is easy to find it with a simple dfs.
Is this approach correct? |
Find a negative cycle linearly? |
|graphs| |
No it's not true. Consider a graph with two nodes, A and B, with an edge A->B with length 1 and an edge B->A with length -1.
The edge B->A is a negative edge and its vertices are in the same SCC and that SCC has size > 1. That edge is not part of a negative cycle. |
null |
I'm currently implementing a RISC prozessor in a HDL and realized that I seem to have a somewhat incorrect understanding of how pipeling works for control signals. Here's my general understanding:
- Ideally, each phase should take exactly one clock cycle (this is the case in my implementation)
- The pipeline regi... |
Issue understanding how control signals are pipelined in a RISC architecture |
|computer-architecture|cpu-pipelines|general| |
null |
Actually, I was curious about all the $Y$-combinator-related questions, so I decided to put up my old (optimal) combinator evaluator [Combo](https://github.com/RockBrentwood/Combo).
I'll use this as a reference implementation for the question on hand and make brief mention of the alternatives.
Here's where I get.... |
I mean why value of 0 value in binary is not used by ascii encoding , it would have been used to represent char 0 or anything else why they used it to represent NULL
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/Ca7EL.png |
why didn't ASCII/utf-8 used 00000000 to represent char 0 or rather any other character |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.