instruction stringlengths 0 29.8k β |
|---|
null |
The **work** $W(n)$ is the total number of nodes in your computation
graph and the **span** $D(n)$ is the number of nodes on the longest path
of that graph. $T_P(n)$ is the **runtime** of the algorithm
using $P$ processors; $T_1(n) = W(n)$ and $T_\inf(n) = D(n)$.
Suppose your code has the following shape
p... |
You should be able to do this in exponential time, but much faster than n^3 operations.
Get a quick upper bound by sorting the tasks in descending length, then scheduling each task in turn to the processor that has the least work. Thatβs 17, 11+6, 9+7+5. So you can do it in 22 units, and you only look for solutions... |
The C semantics treat the result of a comparison or any `true`/`false` operation as just an `int` with value `1` for `true` or `0` for `false`. This is simple and intuitive.
However, mainstream processors do not work this way. Comparison instructions do not output a byte or integer or any value with `1` or `0` as th... |
What is the reason or advantage of having special purpose status flags for the result of comparisons? |
|cpu|c|assembly|instruction-set| |
From a list of practice problems for a graduate Theory of Computation course. I've done quite a few problems at this point on deterministic Turing Machines, I just don't think I have fully grasped the notion of non-determinism in the context of TM's yet.
I suppose this TM would work *something* like this: Given an i... |
Informal description of Non-deterministic TM for the language $L = \{w^n \mid w \in \{a, b\}^* \text{ and } n \geq 2\}$ |
|formal-languages|turing-machines|automata|nondeterminism| |
Find an algorithm for edge connectivity in undirected graph using flow networks. Try to use $O(m)$ edges.
So basically the flow network should be used as a "helper function" and the graph that I give this helper function should have $O(m)$ edges.
How can I do that? So far I know about Ford-Fulkerson algorithm an... |
Edge connectivity using flow network |
|algorithms|graphs|network-flow|ford-fulkerson| |
You have two choices. Either you have separate compare instructions for ==, !=, <, <= etc. which all create 0 or 1, or you have one compare instruction creating flags and various branch instructions. Just s matter of choice.
However, it seems that storing the result of a compare instruction in a special place wher... |
There exist plenty or practical FEC algorithms - RS, Golay, convolutional codes of all sorts. All of them assume that the original data and the FEC code are sent over the same channel with the same error rate. Are there any algorithms where the size of the error correction code can be reduced, assuming that the code is... |
Are there any forward error correcting code algorithms for a partially reliable channel? |
|error-correcting-codes| |
I am currently studying algorithms and computational complexity at University.
I have recently got through three questions I found in an old exam:
1) *Is it possible to sort in asymptotically linear time an array of rational numbers between $[1, 1.5]$ with limited numerator?*
2) *Is it possible to sort in a... |
Sorting rational numbers in linear time |
|time-complexity|asymptotics|sorting|linear-complexity| |
I am currently studying algorithms and computational complexity at University.
I have recently got through three questions I found in an old exam:
1) *Is it possible to sort in asymptotically linear time an array of rational numbers between $[1, 1.5]$ with limited numerator?*
2) *Is it possible to sort in a... |
I am currently studying algorithms and computational complexity at University.
I have recently got through three questions I found in an old exam:
1) *Is it possible to sort in asymptotically linear time an array of rational numbers between $[1, 1.5]$ with limited numerator?*
2) *Is it possible to sort in a... |
|algorithms|asymptotics|sorting|arrays|linear-complexity| |
I am currently studying algorithms and computational complexity at University.
I have recently got through three questions I found in an old exam:
1) *Is it possible to sort in asymptotically linear time an array of rational numbers between $[1, 1.5]$ with limited numerator?*
2) *Is it possible to sort in a... |
$D = 5$ (and is not a funtion of $n$ here) and goes $1 - 2 -
4 - 5 - 6$.
> What is the minimum number of processors that are needed to achieve
> depth?
It clearly cannot be achieved with one processor, but here is a
schedule that achieves it using two processors:
| Time | $P_1$ | $P_2$ |
|------|-------|--... |
In version gamma of the [ACM/IEEE/AAAI Computer Science Curricula 2023](https://csed.acm.org/wp-content/uploads/2023/09/Version-Gamma.pdf), on page 50, one of the illustrative learning outcomes for the "Computational Models and Formal Languages" section of the curriculum states that students should be able to
> Use ... |
What does it mean to prove the halting problem is undecidable "using arithmetization"? |
|undecidability|halting-problem|education|diagonalization| |
You can sort an array in linear time if the set of possible array elements is finite. Because in that case you just pick the array elements that have the smallest possible value, then the array elements that have the second smallest possible value, and so on. Each of these operations is linear in time, and there is a f... |
You have two choices. Either you have separate compare instructions for ==, !=, <, <= etc. which all create 0 or 1, or you have one compare instruction creating flags and various branch instructions. Just s matter of choice.
However, it seems that storing the result of a compare instruction in a special place wher... |
Here's an idea that doesn't work: Assume K = N-1. Take any node X and create another node X' at a distance epsilon from X, and calculate all the distances to X', then solve the N problem. If that solution directly connects X and X', then removing X' gives an optimal solution for the original problem, otherwise move X' ... |
Store the tree in an array $A$ so that $A_i$ contains the index of the
parent's node. For example:
A = [-1 0 1 1]
would be a four-node-tree where the root node has one child and that
child in turn has two children. The root node has no parent, denoted
by -1.
Now go through all array elements in parallel... |
I would guess/assume that by "arithmetization", they mean the concept that every Turing machine can be associated with a bit-string or natural number (the fact that we can encode a description of a Turing machine as a bit-string and hence as a natural number). See, e.g., https://en.wikipedia.org/wiki/Halting_problem#F... |
I'm performing a sequence of text formatting using regex in Python. I'm curious to know if it's possible to formally verfiy whether a single (or a sequence of) regex modification(s) is an involution, i.e. if we denote the resulting total modification as a function d, then for any text, d β d (text) = d (text).
The m... |
How to Formally Verify if a (or a Sequence of) Regex Modification(s) is an Involution |
|regular-expressions| |
null |
null |
The problem of interest is
$$
\min_{x\in\mathbb{Z}^n} \frac{1}{2}x^\top Q x + c^\top x
$$
where $Q$ is a positive definite matrix. I am reasonably sure this can't be solved in poly-time, since the closest lattice vector problem (in $\ell_2$ norm) can be reformulated in the above form. Do we have a proof of NP-hard... |
What is the complexity of minimising a convex quadratic function over the integers? |
|complexity-theory|np-hard|integer-programming|quadratic-programming| |
null |
null |
I looked through many sources which give this as an example for cfl. It also makes sense according to this:
[![Properties of CFL][1]][1]
[1]: https://i.stack.imgur.com/1WVMM.png
But it fails the pumping lemma test.
Let's take n=5.
According to the Pumping Lemma, we can decompose
s into uvxyz like:
u=0, ... |
Is L={0^n 1^n β£nβ₯0} context free language? |
|formal-languages|automata|context-free|pumping-lemma| |
You have just shown that the given language does not meet the condition of the pumping lemma for $n=5$ and **one particular decomposition**.
To conclude that $L$ is not context free you need to show that the language does not mees the condition of the pumping lemma for some **sufficiently large $n$** and **all** de... |
You have just shown that the given language does not meet the condition of the pumping lemma for $n=5$ and **one particular decomposition**.
To conclude that $L$ is not context free you need to show that the language does not meet the condition of the pumping lemma for some word of **sufficiently large length $n$**... |
There is this [paper][1] in which HIV is modelled using cellular automaton. I am trying to replicate this work but I am not getting the same results as the authors. In this paper the authors describe the rules they are implementing. I will post my implementation of the code after the rules description.
constants and... |
Trying to model HIV using cellular automaton but can't replicate the results of some paper |
|python|modelling|cellular-automata| |
I'm performing a sequence of text formatting using regex in Python. I'm curious to know if it's possible to formally verify whether a single (or a sequence of) regex modification(s) is an idempotent, i.e. if we denote the resulting total modification as a function `d`, then for any `text`, `d β d (text) = d (text)`.
... |
How to Formally Verify if a (or a Sequence of) Regex Modification(s) is an Idempotent |
Let's say f is partially computable. Then you can bound the number of computational steps. for example if e is the index of the machine which computes f you can define B(S) to be the following set:
{<i,f(i)> | the machine with index e halts and give f(i) as output with i as input in less than S computational steps.}... |
1) For sure you have to do $n-1$ comparisons with the pivot, you can't do less, so it is $\Omega(n-1)$=\Omega(n). At the same time you do at most $n-1$ comparisons and swaps. Thus it is $O(n-1)=O(n)$. Thus it is $\Theta(n)$.
2) As stated in 1., summing constants does not affect asymptothic notation, so $\Theta(n)=\The... |
null |
When "marking a letter" on the Turing tape, we replace a symbol $a$ by another symbol, like $X$, $\bar a$, or $\underline a$. Since various markings might be needed it is practically more convenient to consider a tape with various parallel components. We may write on each of these components to record phases of the com... |
The problem of interest is
$$
\min_{x\in\mathbb{Z}^n} \frac{1}{2}x^\top Q x + c^\top x
$$
where $Q$ is a positive definite matrix. I am reasonably sure this can't be solved in poly-time, since the closest lattice vector problem (in $\ell_2$ norm) can be reformulated in the above form. Do we have a proof of $\maths... |
Here's an idea that doesn't work: Assume K = N-1. Take any node X and create another node X' at a distance epsilon from X, and calculate all the distances to X', then solve the N problem. If that solution directly connects X and X', then removing X' gives an optimal solution for the original problem, otherwise move X' ... |
You have two choices. Either you have separate compare instructions for ==, !=, <, <= etc. which all create 0 or 1, or you have one compare instruction creating flags and various branch instructions. Just s matter of choice.
However, it seems that storing the result of a compare instruction in a special place wher... |
1) For sure you have to do $n-1$ comparisons with the pivot, you can't do less, so it is $\Omega(n-1)=\Omega(n)$. At the same time you do at most $n-1$ comparisons and swaps. Thus it is $O(n-1)=O(n)$. Thus it is $\Theta(n)$.
2) As stated in 1., summing constants does not affect asymptothic notation, so $\Theta(n)=\The... |
null |
{"OriginalQuestionIds":[30477],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
As far as I know, it is not known that the shortest vector problem is NP-hard for any $L^p$ norm other that $L^\infty$. It is known that the shortest vector problem is "NP-hard under randomized reductions" for all $L^p$, a result first proved by Ajtai. See for example [Miccanccio's paper][1] and the results he referenc... |
There is a mismatch in terminology in your question. The problem you specify is known as the shortest vector problem (SVP). You called it the closest vector problem (CVP), but the CVP is something different.
If you are asking about the SVP, as your mathematical formulation implies, it is known to be NP-hard in the... |
The closest lattice vector problem is NP-hard in the $L_2$ norm. See https://cs.stackexchange.com/q/33828/755 for a reference to the proof. |
null |
Typically the destination register isnβt touched until the final result is stored. If you wanted for example an imul instruction where you can access intermediate results after one and two cycles plus the final result, youβd need three writes to the register. Register writes are a very limited resource. This would for ... |
I recently faced this problem in _CLRS ed.4_ and couldn't find out how to attack it and solve it. Here's the recurrence:
$$T(n)=3T(\frac{n}{3})+8T(\frac{n}{4})+\frac{n^2}{\log{n}}$$
Here's what I tried:
$$\frac{3}{3^p}+\frac{8}{4^p}=1$$
For $p=1$, we get $\frac{3}{3}+\frac{8}{4}>1$ and for $p=2$, we get $\frac{3}... |
Solve a recurrence using Akra-Bazzi method where $p$ is not integer and integration is not easy |
|recurrence-relation| |
I recently faced this problem in _CLRS ed.4_ and couldn't find out how to attack it and solve it. Here's the recurrence:
$$T(n)=3T(\frac{n}{3})+8T(\frac{n}{4})+\frac{n^2}{\log{n}}$$
Here's what I tried:
$$\frac{3}{3^p}+\frac{8}{4^p}=1$$
For $p=1$, we get $\frac{3}{3}+\frac{8}{4}>1$ and for $p=2$, we get $\frac{3}... |
null |
This is a problem inspired by a video game that I've been thinking about for a long while, and I haven't convinced myself that I can do any better than brute force + pruning techniques, which would still take way too long to solve.
Is there anything better? Any class of algorithm I should look into more?
## Probl... |
Maximum reachable checkers on a checkerboard |
|algorithms|optimization| |
Just get a list of post codes and their locations - for example, the UK has a list of about 1,100,000 post codes and their location, basically down to street level. That way you can check if a post code is valid, and how far away it is from another post code, at least the direct distance (driving distance would be more... |
As far as I and this [wikipedia][1] page know, there are no collisions (2 inputs with the same output) found in SHA-256 (yet).
what would happen if a collision were to be found,
**1. would it be easier to find more collisions? (based on the first collision found)**
**2. is a single collision found a major securi... |
What would happen SHA-256 collision were to be found? |
|hash|security| |
null |
Suppose $L_1\preccurlyeq_T L_2$, and $L_1$ is unrecognizable, can $L_2$ be recognizable?
With decidability, if $L_1$ is undecidable, then $L_2$ is undecidable, because $L_1$ is the βeasierβ question. Would this apply to recognizability, too? |
Can an unreocognizable language be Turing-reducible to a recognizable language? |
|computability|reductions|turing-recognizable| |
The integral is in $\Theta(\frac{n^{2-p}}{\log n})$, and substituing in the Akra-Bazzi formula, you get $T(n) = \Theta(n^p \cdot \frac{n^{2-p}}{\log n}) = \Theta(\frac{n^2}{\log n})$.
For the lower bound you can use:
$$
\int_{2}^n \frac{1}{x^{p-1} \log x} \text{d}x \ge
\int_{2}^n \frac{1}{x^{p-1} \log n} \text{d... |
If given some data we could at will create different data with the same SHA that would be a bad problem. Dump SHA.
If we could at will create two sets of data with the same SHA, someone will figure out a way to turn that into a fatal problem.
If someone uses a supercomputer to create _one_ collision at a cost t... |
The integral is in $\Theta(\frac{n^{2-p}}{\log n})$ and, substituing it back in the Akra-Bazzi formula, you get $T(n) = \Theta(n^p \cdot \frac{n^{2-p}}{\log n}) = \Theta(\frac{n^2}{\log n})$.
For the lower bound you can use:
$$
\int_{2}^n \frac{1}{x^{p-1} \log x} \text{d}x \ge
\int_{2}^n \frac{1}{x^{p-1} \log n}... |
TLDR: It means that they are using a technique to represent Turing machines as **numbers** in order for the circularity to be possible, hence "arithmetization".
It is not trivial (especially, it was not at the time) that such a thing as code existed, or that things like binary numbers (which are just numbers) could ... |
Suppose I have an undirected graph $G=(V,E)$, and boolean variables $x_v$ (one for each vertex $v \in V$). These variables select a subset $S \subseteq V$ of vertices, namely the vertices $S=\{v \mid x_v\}$ whose corresponding boolean variable is true.
I want to express the constraint that $S$ is connected, i.e., ... |
One approach would be to express this as an instance of SAT, and use an off-the-shelf SAT solver. See https://cs.stackexchange.com/q/159983/755 for a technique for encoding reachability and thus enforcing all of your constraints via a CNF formula.
In particular, you can use SAT to check whether there exists a solut... |
null |
There is a mismatch in terminology in your question. The problem you specify is known as the shortest vector problem (SVP). You called it the closest vector problem (CVP), but the CVP is something different.
If you are asking about the SVP, as your mathematical formulation implies, it is known to be NP-hard in the... |
Firstly, we need to prove that `G` is a single connected component. If `n` is a node in a connected component of `G`, then there are `L-1` other nodes that are also in that component (the ones from which `n` received their messages). So this component has the size of at least `(L-1)+1 = L` nodes. So each connected comp... |
Another simple one, that turned up in another question. Given a finite set S, sorting any array of elements of S can be sorted in linear time using counting sort (or without any additional storage: By moving every element s of S to the beginning of the array). This is linear instead of n log n, but has the size of S as... |
[This cstheory.SE][1] post gives various randomized approximation algorithms for the set cover problem. Is there a randomized algorithm (which runs in $\mathrm{poly}(n)$ time) for the set cover problem which achieves an approximation ratio of $1$? Is it possible to achieve such an algorithm, or is this still unknown?
... |
Optimal randomized algorithm for set cover |
|algorithms|approximation|randomized-algorithms| |
[This cstheory.SE][1] post gives various randomized approximation algorithms for the set cover problem. Is there a randomized algorithm (which runs in $\mathrm{poly}(n)$ time) for the set cover problem which achieves an approximation ratio of $1$ (with high probability)? Is it possible to achieve such an algorithm, or ... |
null |
Approximation ratio of 1 means that it outputs an exact solution (so it is not an approximation algorithm but rather an exact algorithm). Set cover is known to be NP-hard, so there is no such polynomial-time algorithm, unless P = NP. |
|algorithms|turing-machines|computability|reductions|turing-recognizable| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.