instruction stringlengths 0 29.8k ⌀ |
|---|
"Are there some programs for which there is no other proof system except for the computation itself, where no properties of the program is know in advanced?" No. For a Turing machine T and input X such that T(X) halts, there is a formal system consisting of the appropriate Turing machine axioms and the axiom "T(X) halt... |
Performance is mostly restricted by the number of cache lines you have to read. Let's say you have 256 bit = 32 bytes cache lines: Then reading one byte from RAM takes almost as long as reading 32 bytes. So an application that reads small amounts of data from random locations takes much more time per byte.
Then the... |
In order to show that the next problem is NP-hard:
Problem: Vertex Cover and Independent Set
Input: Graph G and integer k
Output: Does G have a vertex cover of k and an independent set of k?
The sets does not have to be complementary (just about size k). I have tried to reduce Vertex Cover but I cannot fin... |
Reducing Vertex Cover (or Independent Set) to Vertex Cover and Independent Set at the same time |
|algorithms|graphs|np-complete|np-hard|vertex-cover| |
Since for all programs with a set of possible inputs which are countably infinite [except 0-arry functions i.e. constant functions], it would not be possible even to run the program until it terminates for all inputs.
Therefor it would not even be possible to prove termination by simply running the program until it ... |
To simulate the lambda calculus on a Turing machine, all you need to do is build an interpreter for the lambda calculus. That is easy. If you want a reference, I recommend [Structure and Interpretation of Computer Programs](https://en.wikipedia.org/wiki/Structure_and_Interpretation_of_Computer_Programs). In general,... |
If you want a reduction from Vertex Cover: given $(G, k)$ an input of VC, create a graph $G'$ with a copy of $G$ and an additionnal $k$ vertices with no additionnal edge.
Then $G'$ has a vertex cover and an independant set of size $k$ if and only if $G$ has a vertex cover of size $k$. |
The halting problem concerns programs which take input.
By framing the halting problem on the diagonal argument it is clear why this is so.
What about programs with no input, constant functions.
Can it always be determined if they terminate? |
Is it possible to determine if a 0-arity function [a program with no input] will always terminate |
|turing-machines|computability|halting-problem|decidability| |
No, given any program-input pair $(T,x)$ (formally a Turing machine and a word in $\Sigma^*$ for some alphabet $\Sigma$) you can construct a Turing machine with no input that first writes down $x$ and then simulates $T$.
It follows that the problem is undecidable. |
Classic searching algorithms such as binary searching and dictionary searching search sorted arrays based on a given element and make estimations on their own. What I'm looking for is a list of more such algorithms to solve the generic problem- given a sorted array, find an element $x$ present in the array. I'd like to... |
Is there a comprehensive list of searching algorithms for sorted (and possibly unsorted) arrays available anywhere? |
|algorithms|search-algorithms|search-problem|searching| |
null |
A canonical labeling of a graph is a labeling of the nodes. One can construct the isomorphism mapping by tracking how the nodes are labeled when computing the canonical form, and undoing the mapping with the two graphs. In particular, the labeling is usually a coloring where each node of a given color is connected to t... |
#### Amassing many elements significantly lower than median at once
The basic idea is to maintain a list of small elements that are guaranteed to be lower than median. Also maintain a list of all other elements that may or may not be lower than median, which will accept all new elements.
`extract_lowerthan_media... |
A canonical labeling of a graph is a labeling of the nodes. One can construct the isomorphism mapping by tracking how the nodes are labeled when computing the canonical form, and undoing the mapping with the two graphs. In particular, the labeling is usually a coloring where each node of a given color is connected to t... |
null |
Our professor gave us this solution, which has $O(N^2 + K)$ time complexity, and $O(N+K)$ space complexity (since for the biggest test cases $K$ is about $N^{1.5}$, it is as good as $O(N^2)$ for these upper bounds).
We start by initializing an array $Lengths$ of size $K$, every value set to $N+1$, and calculating a ... |
null |
Yes, and it includes the Halting Problem, but it's not very useful.
The solution to the Halting problem is known in the particular case of the program that ends immediately. Actually there are arbitrarily many programs that are known to halt; for example all programs with no looping instructions.
So suppose we w... |
An [undecidable problem](https://en.wikipedia.org/wiki/Undecidable_problem) is a decision problem proven to be impossible to construct an algorithm that always leads to a correct yes-or-no answer. I wonder if there are examples of probabilistic approaches (in the following sense below) that solve such problems.
**By... |
null |
null |
Suppose you are given a bit string $B[1 ... n]$. Now, suppose that some bits are just padding bits conveying no information, the rest of the bits may be permuted and some meaningful (that is, non-padding) bits should be inverted from $0$ to $1$ and vice versa.
According to my intuition, the total number of interpret... |
Number of bit string interpretations correct? |
|strings|information-theory|bit-manipulation| |
{"Voters":[{"Id":49711,"DisplayName":"coderodde"}]} |
{"Voters":[{"Id":49711,"DisplayName":"coderodde"}]} |
Suppose you are given a bit string $B[1 ... n]$. Now, suppose that some bits are just padding bits conveying no information, the rest of the bits may be permuted and some meaningful (that is, non-padding) bits should be inverted from $0$ to $1$ and vice versa.
According to my intuition, the total number of interpret... |
When there are $i$ significant bits, you can form $2^i$ arrangements that can be permuted in $i!$ ways, and interspersed each with the remaining $n-i$ bits. Hence in total
$$\sum_{i=0}^n2^ii!\binom ni.$$
E.g., for $n=2$,
$$1\cdot1\cdot1+2\cdot1\cdot2+4\cdot2\cdot1=13.$$
This just confirms your findings. |
null |
Your "potentially infinite" (I would say: finite but unbounded) list of properties is known, depending on the programming language, as an *association list, property list, dictionary, associative array*, or *hash*. No doubt other terms are in use as well; I haven't used more than some 20-30 different languages. In math... |
In a text file you can write both the letter 'A' and number '65'. But obviously one of these data will be saved with different bits while the ASCII standard gives the letter 'A' the binary code for 65. Does a .txt file use some sort of container for different interpretations of binary? How does this work? |
How does a text file distinguish a letter and number in binary |
|binary| |
I don't understand what you mean by container. But any file, may it be a text file, image, videos, executables, etc. are stored in binary. Now the interpretation of a file is dependent on the particular program that will read it. As for text editors, it will interpret the content based on a selected [character encondin... |
I'm looking for the name of the family of algorithms whose exact runtime is dependent *only* on the size of the input. An example of such an algorithm would be naive $O(n^3)$ matrix multiplication. If we know $n$, we know exactly how many operations it will execute and how many cycles it will take to complete (ignore r... |
Name for algorithms whose runtime only depends on the problem size? |
|algorithms|terminology| |
I'm looking for the name of the family of algorithms whose exact runtime is dependent *only* on the size of the input. An example of such an algorithm would be naive $O(n^3)$ matrix multiplication. If we know $n$, we know exactly how many operations it will execute and how many cycles it will take to complete (ignore r... |
null |
These would be referred to as "constant-time algorithms". Their worst-case and average-case time is the same as the constant time c which the algorithm takes to execute on inputs of size n (where the constant c depends on n). This includes Bubble-Sort but not Insertion-Sort (when measuring the time as the number of com... |
I am sure this question has been asked, but I was unable to search for it in a manner that would give me the solution. So I will present it here.
I seen this in another database years ago, and I want to implement it in one of my apps. It is perfect:
Pets
1. fish
2. dog
4. cat
8. monkey
... |
How to derive selections from a series of numbers |
|database-theory| |
0
I am learning about the instructions-set in my computer science course, and I am wondering if it is possible to split an instruction into more than four sub-instructions.
Thank you |
Split an instruction into more than four sub instructions? |
|cpu-pipelines| |
I'm looking for the name of the family of algorithms whose exact runtime is dependent *only* on the size of the input. An example of such an algorithm would be naive $O(n^3)$ matrix multiplication. If we know $n$, we know exactly how many operations it will execute and how many cycles it will take to complete (ignore r... |
Here is a proof (not the only one). This proof appeals to the fact that our hypothesis class is a subset of a linear hypothesis class of degree $n+1$.
Let $\cal{P}_n$ denote the set of all d-degree polynomials $p_n: \mathbb{R} \to \mathbb{R}$.
Define the hypothesis class as follows:
$$
\cal{H}_{P_n} := \{ f_n :... |
If you're asking if instructions can be split into smaller instructions, then the answer is no. That's not how instructions work.
Instructions are a sequence of bits (the opcode) and an operand (the data to be operated on). The operand can be an immediate value, a register, or a memory address. The operand can be e... |
Caveat. You have to show this specifically by showing there exists an infinite set that is pairwise disjoint with respect to L.
This question was on a quiz which we had 12 minutes to complete (this wasn't the only question!) I can see that this isn't a regular language but I can not come up with any set that is pair... |
Show that the the language $L = \{0^kww0^m | k,m >= 1 and w \in \{0, 1\}*\}$ is nonregular |
|regular-languages| |
Show that the the language $L = \{0^kww0^m | k,m >= 1, w \in \{0, 1\}*\}$ is nonregular |
Show that the the language $L = \{0^kww0^m | k,m >= 1, w \in \{0, 1\}^*\}$ is nonregular |
This is just the regular representation of a binary number, where the no. of bits represent the no. of types of that entity(pets in this case). You simply assign each bit position a unique type and then the bit value tells you whether that type is included or not. Binary representation is suitable cause you have 2 opti... |
Show that the the language $L = \{0^kww0^m | k,m \ge 1, w \in \{0, 1\}^*\}$ is nonregular |
null |
Caveat. You have to show this specifically by showing there exists an infinite set that is pairwise disjoint with respect to L.
This question was on a quiz which we had 12 minutes to complete (this wasn't the only question!) I can see that this isn't a regular language but I can not come up with any set that is pair... |
Caveat. You have to show this specifically by showing there exists an infinite set that is pairwise distinguishable with respect to L.
This question was on a quiz which we had 12 minutes to complete (this wasn't the only question!) I can see that this isn't a regular language but I can not come up with any set that ... |
Caveat. You have to show this specifically by showing there exists an infinite set that is pairwise distinguishable with respect to L.
This question was on a quiz which we had 12 minutes to complete (this wasn't the only question!) I can see that this isn't a regular language but I cannot come up with any set that i... |
Let $$\mathcal{D}_L := \{ 0^j 1 0 1 \mid j \ge 1\}$$ be the desired set. Clearly it is infinite. We show that the set is pairwise distinguishable with respect to the given language $L$.
For any two strings $0^i 1 0 1$ and $0^{i-1} 1 0 1, \text{ }(i \ge 2)$ in $\mathcal{D}_L$, we have — by appending the string $0$ — ... |
Let $$\mathcal{D}_L := \{ 0^j 1 0 1 \mid j \ge 1\}$$ be the desired set. Clearly it is infinite. We show that the set is pairwise distinguishable with respect to the given language $L$.
For any two strings $0^i 1 0 1$ and $0^{i-1} 1 0 1, \text{ }(\text{for }i \ge 2\text{, even})$ in $\mathcal{D}_L$, we have — by app... |
null |
Many processors with complex instructions split them up internally into less complex instructions and execute those. Often these are called “micro-OPs”. There is no reason why an instruction couldn’t be split into more.
Whether having instructions of that complexity is a good idea is a different question. |
Is there a formal definition of a 'Quantum Turing machine'? I am mainly interested in how the tape position would move.
> https://en.wikipedia.org/wiki/Turing_machine
> https://en.wikipedia.org/wiki/Quantum_computing |
Quantum Turing machine |
|turing-machines|quantum-computing| |
ETA: adjusted to "size-based constant time algorithms". Indeed, as pointed out, constant time typically refers to constant time on all inputs. In average-case and worst-case analysis, typically the time is per size n, so in that contest the algorithms that do not change behaviour on each given size are (size-based) con... |
ETA: adjusted to "size-based constant time algorithms". Indeed, as pointed out, constant time typically refers to constant time on all inputs. In average-case and worst-case analysis, typically the time is per size n, so in that contest the algorithms that do not change behaviour on each given size are (size-based) con... |
null |
The Graph Isomorphism Problem is a *classic* in Computer Science.
In its *decision* version $(DGI)$, we are given two graphs $G$ and $H$ and we are asked if *there exists* an isomorphism between the two. In its *function* version $(FGI)$, we want to *produce in output* the found isomorphism (if it exists).
It is ... |
Graph Isomorphism Problem: decisional vs functional |
|complexity-theory|graphs|reductions|decision-problem| |
Well, yes, you were almost there : https://en.wikipedia.org/wiki/Quantum_Turing_machine |
null |
null |
Could one use the Radix Sort to find the Longest Common Subsequence problem? I am new to algorithms and was wondering if the string was converted to a list and then one was able to apply Radix Sort and instead of sorting able to search for the longest common subsequence by matching up the positions. Or would this be an... |
Could Radix Sort be used to tackle LCS algorithm? |
|algorithms|radix-sort|longest-common-substring| |
Let $$\mathcal{D}_L := \{ 0^j 1 0^j 1 \mid j \ge 1\}$$ be the desired set. Clearly it is infinite. We show that a subset of the set is pairwise distinguishable with respect to the given language $L$.
For any two strings $0^i 1 0^i 1$ and $0^{i+1} 1 0^{i+1} 1, \text{ }(\text{for }i \ge 2)$ in $\mathcal{D}_L$, we have... |
Yes $FGI \preceq_P DGI$ also holds. Assume you have a black box $B$ that solves $DGI$ in polynomial time. You can easily solve $FGI$ in deterministic polynomial time with polynomial many calls to $B$.
First let $K_n$ be a clique on $n$ vertices. Let us define the function `addClique(G, v, n)` that adds to a graph $G... |
Yes $FGI \preceq_P DGI$ also holds. Assume you have a black box $B$ that solves $DGI$ in polynomial time. You can easily solve $FGI$ in deterministic polynomial time with polynomial many calls to $B$.
First let $K_n$ be a clique on $n$ vertices. Let us define the function `addClique(G, v, n)` that adds to a graph $G... |
Could one use the Radix Sort to find the Longest Common Subsequence problem? I am new to algorithms and was wondering if the string was converted to a list and then one was able to apply Radix Sort and instead of sorting able to search for the longest common subsequence by matching up the positions. Or would this be an... |
null |
null |
Yes $FGI \preceq_P DGI$ also holds. Assume you have a black box $B$ that solves $DGI$ in polynomial time. You can easily solve $FGI$ in deterministic polynomial time with polynomial many calls to $B$.
First let $K_n$ be a clique on $n$ vertices. Let us define the function `addClique(G, v, n)` that adds to a graph $G... |
There are a few potential ways to approach this question. One way would be to use a data compression algorithm on the output of another data compression algorithm. This can be done by taking the output of one data compression algorithm and compressing it with a second data compression algorithm.
Another way to compr... |
null |
null |
null |
null |
Slight modification to other answers that may help:
1. Since one subarray must have a sum from 0 to K/2, and the other must have a sum from K/2 to K, only look at subarrays with a sum <= K. This may help a lot, especially if K is much smaller than the total size of all array elements.
2. If K is large, but heuri... |
I am looking for the fastest algorithm (in practice) to multiply two polynomials $f(X)\cdot h(X)$ in $\mathbb{F}_p[X]$. The prime $p$ is roughly $256$ bits but the integer $p-1$ might not have any large smooth divisors. The polynomials are of degree less that $2^{30}$.
In the absence of large $2$-power roots of unit... |
Fastest algorithm for polynomial multiplication in 256-bit finite fields |
|polynomials|multiplication|modular-arithmetic|fast-fourier-transform| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.