instruction
stringlengths
0
29.8k
⌀
**Preface** (long): Letʼs consider an inter-processor synchronization using a pure spinlock (avoid queues and task switching). While a spinlock is held, the data protected by it can be read or written. All these operations shall be finished (reads - values moved to the processor, writes - values exposed to other pro...
We know that $\widetilde{O}(f(n))$ — $O$ with a tilde above it — which means $O(f(n) \text {polylog}(f(n)))$, i.e., $O(f(n) (\log f(n))^k)$ for some $k$. Also I have seen in [Wikipedia](https://en.m.wikipedia.org/wiki/Big_O_notation) that $n2^n=\widetilde{O}(2^n).$ My question is that if $\text{poly}(n) \space 2...
I am trying the understand the following statement from the book of Grotschel, Lovasz and Schrijver: [![enter image description here][1]][1] Here, $\delta(W)$ is the set of edges incident to a set of vertices $W$. They define an optimization problem whose solution is a nonnegative real vector. If we add a cons...
null
As mentioned by D.W., asking for a complete problem for $\mathrm{NP} \cap \mathrm{coNP}$ is going to be messy. However, for the purpose of *"Can I work on a polytime algorithm for this concrete problem in an attempt to prove $\mathrm{NP} \cap \mathrm{coNP} = \mathrm{P}$?"*, we do have options available to us. We just n...
I can tell yes... It is not working fine but you can go for some work around that I may not be preferable with. But recently I was working with 0/1 knapsack problem where If I go with the tail recursion approach or the head recursion approach that result it gives is correct. But If I try to apply DP(Dynamic Programmi...
As motivation, a Space Craft known as the [Mars Climate Orbiter][1] failed in the year 1999. The failure occurred because the distinction between pound-force seconds and newton-seconds was made as an comment, instead of being part of the code itself. Suppose that a student created a [generic class][2] (als...
What sub-sequences do strings for the standard scientific units have in common?
|strings|substrings|string-matching|string-metrics|exact-string-matching|
In this problem we consider two stacks A and B manipulated using the following operations (n denotes the size of A and m the size of B ):   PushA(x ): Push element x on stack A .   PushB(x ): Push element x on stack B .   MultiPopA(k ): Pop min(k;n) elements from A .   MultiPopB(k ): Pop min...
Amortized cost for Stack Operations
|algorithms|algorithm-analysis|amortized-analysis|stacks|
I came across this weird expression while learning about regular expressions. $R^+ \cup \varepsilon = R^*$ why does doing union with an empty string makes this regex go from 1 or more to 0 or more?
What does empty string ε actually mean?
|regular-languages|regular-expressions|
we're focusing on the final step of the process. At this point, we assume that the two child heaps are already built and properly organized. The cost to "fix" the heap at this stage is given as 2logn -2 (the last 2).but Additionally, we need to include the cost of the two children. total :T(n)=2T(n/2)+2(log(n)-1) -...
Regular expression represents set of strings so $\varepsilon$ in that expression represents the set that contain 0 length string $\{\varepsilon\} $. This of course is not the same as the empty set $\emptyset$. So the union will add the empty string to the set that does not contain an empty string ($R^+$) , hence the re...
Regular expression represents set of strings so $\varepsilon$ in that expression represents the set that contain only the 0 length string, $\{\varepsilon\} $. This of course is not the same as the empty set $\emptyset$. So the union will add the empty string to the set that does not contain an empty string ($R^+$) , he...
Let $P=u_1,u_2,\ldots$ a solution to the STSP with cost $l$, we associate to it the vector $x_P$ such that $(x_P)_e = \frac{1}{2}\#\{i; \{u_i,u_{i+1}\}=e\}$ (each time the tour takes an edge, we add $\frac{1}{2}$ to $x_P$). It is a solution to $\frac{1}{2}$-Spanning Tree: let $W$ be a cut, the tour has to leave it and ...
null
I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (*wp*) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following reinforcement learning equation and we want to constrain it across 2 timesteps - $v' = v + 0.1a + \epsilon$ Base...
How to deal with missing variables when utilizing weakest precondition for verification?
|machine-learning|programming-languages|formal-methods|hoare-logic|
I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (*wp*) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following reinforcement learning equation and we want to constrain it across 2 timesteps - $v' = v + 0.1a + \epsilon$ Base...
I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (*wp*) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following reinforcement learning equation and we want to constrain it across 2 timesteps - $v' = v + 0.1a + \epsilon$ Base...
I am reading the example given in [1], section 4.2. It deals with applying weakest precondition (*wp*) rules to ensure that the velocity of a car doesn't exceed a certain limit. We have the following reinforcement learning equation and we want to constrain it across 2 timesteps - $v' = v + 0.1a + \epsilon$ Base...
null
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedne...
Do these courses fall under theoretical computer ccience
|graphs|logic|information-theory|
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedne...
Do these courses fall under theoretical computer ccience
|graphs|logic|information-theory|
I am planning to apply for master's degree at TU Berlin and have to take some courses on theoretical computer science since the university requires me to take some credits on theoretical computer science.Do these courses come under this category? 1-Graph theory:Basic definitions, trees, Cayley's formula, connectedne...
Do these courses fall under theoretical computer ccience
|graphs|logic|information-theory|
null
null
I would like to find a target point among a very very large number of other points in a 3-dimensional space. I do not know the exact location of the target, but I can measure to it from some of the points in the space with a metric that roughly approximates distance to the target (smaller metric values are closer to t...
Iterative minimization algorithm to find a target among many points
|optimization|
I have questions about how to put the grammar below in CNF - Chomsky Normal Form: S ->aAa | bBb | ВВ; A -> C; B -> S | A; C -> S | ε; I did it like this: 1. I eliminated empty productions: S ->aAa | aa | bBb | bb| ВВ; A -> C; B -> S | A; C -> S; 2. I eliminated unit productions: ...
CFG to CFN conversion
|formal-languages|automata|context-free|normal-forms|
I am preparing for my algorithm and data structures exam. In the code below, I need to prove the correctness of tripSort. I am trying to do that by using loop invariants. The subarray A[n-2j+1,n] is the loop invariant I chose, where j refers to the iterations of the while loop. Is this the correct way to prove the corr...
Proving the correctness of a sorting algorithm that contains a whole loop
|algorithms|correctness-proof|
I am preparing for my algorithm and data structures exam. In the code below, I need to prove the correctness of tripSort. I am trying to do that by using loop invariants. The subarray A[n-2j+1,n] is the loop invariant I chose, where j refers to the iterations of the while loop. Is this the correct way to prove the corr...
You can not prove this sorting algorithm as correct because it is not correct. Hint: what happens if the input contains two elements?
I am preparing for my algorithm and data structures exam. In the code below, I need to prove the correctness of tripSort for arrays of a size >=3. I am trying to do that by using loop invariants. The subarray A[n-2j+1,n] is the loop invariant I chose, where j refers to the iterations of the while loop. Is this the corr...
Assuming the input has at least length 3, you can do it in two steps: 1. Prove the outer loop terminates. You can do this by an argument that the total number of [inversions](https://en.wikipedia.org/wiki/Inversion_(discrete_mathematics)) is always non-negative, and strictly decreasing in each iteration where `done ...
{"OriginalQuestionIds":[165480],"Voters":[{"Id":755,"DisplayName":"D.W.","BindingReason":{"GoldTagBadge":"graphs"}}]}
{"OriginalQuestionIds":[165480],"Voters":[{"Id":755,"DisplayName":"D.W.","BindingReason":{"GoldTagBadge":"graphs"}}]}
Regular expressions represent sets of strings, so $\varepsilon$ in that expression represents the set that contain only the 0 length string, $\{\varepsilon\} $. This of course is not the same as the empty set $\emptyset$, so the union will add the empty string to the set that does not contain an empty string ($R^+$) , ...
null
> In this problem we consider two stacks $A$ and $B$ manipulated using the following operations ($n$ denotes the size of $A$ and $m$ the size of $B$):   PushA($x$): Push element $x$ on stack $A$.   PushB($x$): Push element $x$ on stack $B$.   MultiPopA($k$):...
null
@D.W. gives a good answer to the question as asked which doesn't quite work for my application. the solution i've settled on is to use *non-erasing deterministic stack automata*. a stack automaton is a PDA with the additional ability to move up and down the stack in read-only mode, introduced in [Ginsberg, Greibach ...
null
Can putting information systems through a "functional bottleneck" to approximate their Algorithmic Information reduce their attack and argument surfaces substantially? Software *surface* may be defined in terms of its complexity, both as *attack* surface and as *argument* surface. While cyber attack surface is well...
Algorithmic Information Approximation As Software Surface Minimization
|information-theory|software-verification|software-engineering|software-testing|
If you want a really interesting logic to work with, take a look at [Description Logics][1]. They're an astonishingly large fragment of first order logic. They have three major components: * Individuals - objects to talk about. There can be infinite numbers of individuals. Your fights might be individuals. * Co...
What you seem to be asking for is for assignment and `&&` to have *different* relevant precedence depending on which occurs on the left or the right -- `=` has higher precedence when it is to the left of the `&&` and lower when it is to the right. This turns out to be remarkably hard to do with a traditional "pure" ...
What you seem to be asking for is for assignment and `&&` to have *different* relevant precedence depending on which occurs on the left or the right -- `=` has higher precedence when it is to the left of the `&&` and lower when it is to the right. This turns out to be remarkably hard to do with a traditional "pure" ...
What you seem to be asking for is for assignment and `&&` to have *different* relevant precedence depending on which occurs on the left or the right -- `=` has higher precedence when it is to the left of the `&&` and lower when it is to the right. This turns out to be remarkably hard to do with a traditional "pure" ...
What you seem to be asking for is for assignment and `&&` to have *different* relevant precedence depending on which occurs on the left or the right -- `=` has higher precedence when it is to the left of the `&&` and lower when it is to the right. This turns out to be remarkably hard to do with a traditional "pure" ...
I have assumed amortized cost for Push A and B as - 2 for remaining operations it will be zero except for Transfer - 2n Can this costs be possibee ?
null
null
null
null
It is the case that $C$ becomes inaccessible, but your grammar isn't in normal form (yet). Rules like $S \to aAa$ or $S \to bb$ aren't allowed in [CNF](https://en.wikipedia.org/wiki/Chomsky_normal_form). Also your grammar isn't equal to the original, since you forgot that $B$ as well as $S$ are nullable when removi...
It is the case that $C$ becomes inaccessible, but your grammar isn't in normal form (yet). Rules like $S \to aAa$ or $S \to bb$ aren't allowed in [CNF](https://en.wikipedia.org/wiki/Chomsky_normal_form). Also your grammar isn't equal to the original, since you forgot that $S$ is nullable when removing the $\varepsi...
null
I suspect that it's not in RE, since you'd have to first know for M all the inputs for which it halts, which you can't do in a finite time. I wanted to show that $\overline {HP} \leq L$, and so because $\overline {HP} \notin RE$, also $L \notin RE$, but I can't seem to find a reduction function. Thanks in advance
Is the language $L={<M>|\text{There exists an M' that stops on the same input words, but } L(M)\neq L(M')}$ in RE or R?
|complexity-theory|turing-machines|
Notice that all machines $M$ that halt on no input accept the same language, $\emptyset$. Thus if $M$ halts on no input then also $\langle M \rangle \notin L$. Now define the TM $M'$ for some TM $M$ such that on input $x$ - $M'$ runs $M$ on $x$ - If $M'$ rejects if $M$ halts accepting - If $M'$ accepts if $M$ ...
Notice, that all machines $M$ that halt on no input accept the same language, $\emptyset$. Thus if $M$ halts on no input then also $\langle M \rangle \notin L$. Now define the TM $M'$ for some TM $M$ such that on input $x$ - $M'$ runs $M$ on $x$ - If $M'$ rejects if $M$ halts accepting - If $M'$ accepts if $M$...
Is the language $$L = \{M | \exists M' \text{ that stops on the same input words but L(M)} \neq L(M')\}$$ in RE or R? I suspect that it's not in RE, since you'd have to first know for M all the inputs for which it halts, which you can't do in a finite time. I wanted to show that $\overline {HP} \leq L$, and so be...
Is the language L = {<M> | There exists an M' that stops on the same input words, but L(M) ≠ L(M')} in RE or R?
null
Notice, that all machines $M$ that halt on no input accept the same language, $\emptyset$. Thus if $M$ halts on no input then also $\langle M \rangle \notin L$. Now define the TM $M'$ for some TM $M$ such that on input $x$ - $M'$ runs $M$ on $x$ - $M'$ rejects if $M$ halts accepting - $M'$ accepts if $M$ halts...
null
null
I have large cnf with thousands of variables, but with known compact [backdoor set](https://www.cse.unsw.edu.au/~tw/kstwaaai05.pdf). I think this set can be used by CDCL solvers to choose assignment variables to simplify formula much faster, but I failed to find solver with such feature. Kissat and cadical (top per...
Sat solvers with backdoor set
|satisfiability|sat-solvers|
null
What is the algorithm behind this routine and is there documentation available for it?
How does numpy.linalg.inv calculate the inverse of a matrix?
|python|
null
>Show that it is not possible to construct the toffoli gate using only CNOT gates, given we are allowed to choose any number of ancilla bits. **My Attempt** The action of a toffoli gate can be defined as, \begin{align} f_{toffoli}:(x,y,z)= &(x,y,z\oplus xy)\\ =&(x,y,z\overline{xy}\vee\bar{z}xy)\\ =&(x,y,z(...
Prove that it is impossible to construct the toffoli gate using only CNOT gates
|boolean-algebra|xor|reversible-computing|
null
Let $\epsilon > 0$. For $P\subset \mathbb R^d$, a subset $Q\subset P$ is called an *$\epsilon$-packing* if: 1. for every $p \in P$ there is a $q\in Q$ such that $d(p,q) \leq \epsilon$, and 2. for every $q, q' \in Q$, we have $d(q,q') \geq \epsilon$. (See also the definitions [here](https://en.wikipedia.org/wiki/D...
Algorithm for computing $\epsilon$-packings of Sets in Euclidean Space