instruction
stringlengths
0
29.8k
⌀
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
{"Voters":[{"Id":98102,"DisplayName":"Irishmanluke"}]}
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
I suspect you're implicitly using the probability of a collision here is a proxy for the "guessability" of a working password. The issue with this is that to the extent that adding a max length constraint reduces the probability of a collision it also reduces the number of possible passwords at the same rate which in ...
Looking at the image from [Wikipedia page][1] for tree traversal [![enter image description here][2]][2] what is the name for a traversal that follows the dashed line exactly with repeating visits to obtain: F, B, A, B, D, C, D, E, D, B, F, G, I, H, I, G, F; Also is there a well known algorithm for this task? ...
What is the technical name for one sided tree traversal and which algorithms are good for it?
|binary-trees|graph-traversal|
null
null
null
null
null
Maybe you're looking for Eulerian tour on trees. You can check these: * [Eulerian tour technique](https://en.m.wikipedia.org/wiki/Euler_tour_technique) * [On Euler tour trees](https://codeforces.com/blog/entry/18369)
null
reduce the cfg into gnf S->aSb S-> ab
Sort every sublist, then sort the main list with lexicographical ordering. The duplicates will appear next to each other. $$[[1,2,0], [6,5,4], [0,1,2], [2,1,0], [4,5,6]]$$ then $$[[0,1,2], [4,5,6], [0,1,2], [0,1,2], [4,5,6]]$$ then $$[[0,1,2], [0,1,2], [0,1,2], [4,5,6], [4,5,6]]$$
Given an instance of $3SAT$ the objective is to reduce it directly to $2P2N-3SAT$ without the reduction having any 'trivial' clauses. The trivial clauses can be where the same variable in a clause is used twice as follows: $x+\overline{x}+y=1$ or $x+x+y=1$. Both these clauses are trivial since the first is trivially TR...
Reduction of $3SAT$ to $2P2N-3SAT$ (without trivial clauses)
|complexity-theory|time-complexity|satisfiability|
null
If given graph is a tree (in other words, if tnhe graph doesn't contain cycles/loop/self-edges/self-loops), then the BFS traversal (level order traversal) would be the same.
null
The second loop is indeed tricky. Without a deeper look, it is hard to tell its time complexity tightly, because it could be that the break always occurs very early. But you are on the safe side by assuming $O(n)$ for this loop, which, fortunately, is absorbed by the $O(n\log n)$ of the sort. The space is indeed $O(...
An uninhabited type is a type which **cannot have a representation at runtime** no matter what you do, and enforces this is **in a structural manner**. I'm going to use Rust as an example, because it does have uninhabited types. Rust has enums, for example: ```rust enum Color { Red, Yellow, Rgb(u8...
null
null
I'm unsure if this satisfies the definition of vertex cover, the graph is unweighted and undirected: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/hu7wl.png if not, an explanation would be super enlighting.
Is this considered a vertex cover?
|algorithms|graphs|reductions|vertex-cover|
null
**This is not correct** It is left for educational value. Another strong NP-completeness proof is a simple reduction from [distinct 3-partition][1] problem. **Distinct 3-partition** > > **Input:** A set $X = \{a_1,a_2,\ldots,a_{3n}\}$ of positive distinct integers, and a positive integer $B$ where $\Sigma_{i=1...
I found an NP-complete problem, [Applying a permutation on a sequence with multiplication,][1] that reduces to my problem. The reduction produces an input to my problem where sequence $a_i$ is the set $L$, $M=\{1,2,3, ..., n\}$, and C=x. This proves that the problem of numerical perfect matching is NP-complete. [...
I found an NP-complete problem, [Applying a permutation on a sequence with multiplication,][1] that reduces to my problem. The reduction produces an input to my problem where sequence $a_i$ is the set $L$, $M=\{1,2,3, ..., n\}$, and C=x. This proves that the problem of numerical perfect matching is NP-complete. *...
null
Yes, this is a vertex cover (VC). By definition, a vertex cover of a graph G=(V,E) is a subset of nodes $U\subset V$ such that $\forall \ e \in E \ \exists u \in U$ such that $e$ is incident in $u$. Every edge in your graph has one of its extreme in the VC, so yes
Yes, this is a vertex cover (VC). By definition, a vertex cover of a graph G=(V,E) is a subset of nodes $U\subset V$ such that $\forall \ e \in E \ \exists u \in U$ such that $e$ is incident in $u$. Every edge in your graph has one of its extremes in the VC, so yes
null
I've been reading the Peter Selinger's article "Control Categories and Duality: On the Categorical Semantics of the Lambda-Mu Calculus". I'm wondering about the categorical interpretation of the reduction rules. In particular, I'm trying to demonstrate that the left and right sides of $$[\alpha']\mu \alpha_i^A. M = M[\...
Categorical interpretation of beta-reduction for mu abstractions in lambda-my calculus
|type-theory|category-theory|
I want to prove a question Assume you have a undirected graph $G=(V,E)$, and a positive int $j$. Set $a$ consists of vertices that are atleast 4 edges from every other edge in $a$. There is also a vertex weight function $w:V\to\mathbb{N}$. Is there is a set $a\subseteq V$ with total weight $\sum_{u\in S}w(u)\geq j$? ...
how to reduce independent Set into independent Set of distance 4 between all vertices
|np-complete|reductions|np-hard|
I want to prove a question Assume you have a undirected graph $G=(V,E)$, and a positive int $j$. Set $a$ consists of vertices that are atleast 4 edges from every other edge in $a$. There is also a vertex weight function $w:V\to\mathbb{N}$. Is there is a set $a\subseteq V$ with total weight $\sum_{u\in S}w(u)\geq j$? ...
reduce independent Set into independent Set of distance 4 between all vertices
In the slides' based animation given for backtracking, [here][1] (with code [here][2], in the [web-page ][3]); have few doubts, in the code restated below, and the execution as shown in the call #5. #include <stdio.h> char *next; int calls = 0; int eat(char c) { calls++; if (...
Categorical interpretation of beta-reduction for mu abstractions in lambda-mu calculus
The $k$-vertex complete graph, $K_k$, is a $k$-tree. A $k$-tree with $n+1$ vertices $(n \geq k)$ is constructed from a $k$-tree on $n$ vertices by adding a vertex adjacent to all vertices of one of its $K_k$ subgraphs, and only to those vertices. Is there an algorithm to recognize whether a graph is a k-tree? What i...
Recognizing whether a graph is a k-tree
|graphs|
The $k$-vertex complete graph, $K_k$, is a $k$-tree. A *$k$-tree* with $n+1$ vertices $(n \geq k)$ is constructed from a $k$-tree on $n$ vertices by adding a vertex adjacent to all vertices of one of its $K_k$ subgraphs, and only to those vertices. Is there an algorithm to recognize whether a graph is a k-tree? What...
I was going through the book Operating Systems by Galvin. First they explain Semaphores acting like a mutex. While talking about semaphores as mutex, they mention that the wait operation of semaphores are always atomic in nature. This is how a simple snippet of wait would look. ``` wait() { while(s<=0);...
How are waits in semaphores made atomic in nature?
|operating-systems|concurrency|synchronization|mutual-exclusion|semaphore|
A possible implementation is to have the semaphore counter protected by a spinlock, in order to avoid concurrent accesses (a spinlock manages a lightweight critical section). When the value is found positive, it is decremented and that's it. Otherwise, the process is set in a waiting state and control is passed to the ...
A possible implementation is to have the semaphore counter protected by a spinlock, in order to avoid concurrent accesses (a spinlock manages a lightweight critical section). When the value is found positive, it is decremented and that's it. Otherwise, the process is set in a waiting state and control is passed to the ...
A possible implementation is to have the semaphore counter protected by a spinlock, in order to avoid concurrent accesses (a spinlock manages a lightweight critical section). When the value is found positive, it is decremented and that's it. Otherwise, the process is set in a waiting state and control is passed to the ...
I found an NP-complete problem, [Applying a permutation on a sequence with multiplication,][1] that reduces to my problem. The reduction produces an input to my problem where sequence $a_i$ is the set $L$, $M=\{1,2,3, ..., n\}$, and C=x. This proves that the problem of numerical perfect matching is NP-complete. *...
Two facts: - The $k$-trees are exactly the chordal graphs where every maximal clique has $k+1$ vertices and every minimal separator has $k$ vertices (or it's $K_k$ or $K_{k+1}$) - In chordal graphs, the maximal cliques and the minimal separators can be enumerated in linear time (see e.g. [this paper][1]) In co...
null
null
null
By an algorithm $A(p, t)$ attempting to decide whether the program $p$ halts or not by running the program for $t$ seconds (the timeout) and trying to prove that it doesn't halt at the same time, can it decide more and more programs as the time gets bigger, so that any program would result in the algorithm in showing u...
Does exist an algorithm that decides whether a program halts or not as its timeout approaches to infinity?
|decision-problem|halting-problem|
because in $S(2)$ can match $aaaa$ so $S(2)$ can't match $aa \to S(1)$ can't match $aaaa$. why $S$ only match $a^{2^n}$ ? $\to$ why $\frac{2^{n}}{2}-1$ can match $aa$ but $S(\frac{len}{2}-1)$ can't match $aa$ in not like $a^{2^n}$ . The reason may like it?
By your definition such an algorithm does not exist. In fact, the algorithm should give an answer in finite time. At whatever timestamp $t>0$ the algorithm $A$ stops, there always exists a program $p$ which halts after $T>t$ time, so that $A$ can not detect if $p$ halts or not. The problem is that $A$, being al a...
By your definition such an algorithm does not exist. In fact, the algorithm should give an answer in finite time. At whatever timestamp $t>0$ the algorithm $A$ stops, there always exists a program $p$ which halts after $T>t$ time, so that $A$ can not detect if $p$ halts or not. The problem is that $A$, being al a...
Programs are enumerable, so you can organize rounds where you execute one elementary step of every program in turn and in the end add a new program. The more time you spend, the more halting programs you will find.
In my answer I assume you are acquainted with formal grammars, especially, the Backus Naur form. The lexical analizer, alone, could never state the sentence you provided actually belongs to C. Telling whether it belongs or not to the language, is a joint duty of the lexical and syntactical analyzers. On one hand...
null
I didn't find an exact description for this, but I know that any integer type is a simple bit pattern, it seems to me that the simple bit pattern should have a more exact description
Exact Definition of simple bit pattern?
|arithmetic|binary|bit-manipulation|
{"Voters":[{"Id":162173,"DisplayName":"user502233"}],"DeleteType":1}
{"Voters":[{"Id":162173,"DisplayName":"user502233"}]}
{"Voters":[{"Id":162173,"DisplayName":"user502233"}],"DeleteType":1}
{"Voters":[{"Id":162173,"DisplayName":"user502233"}]}
I want to prove the following problem is NP-complete: **4-Spaced-Set:** Assume you have a undirected graph $G=(V,E)$, and a positive integer $k$. Let's say a set of vertices $A \subseteq V$ is $4$-spaced if the distance between any two distinct vertices in $A$ is at least $4$. There is also a vertex weight function ...
null
null
{"Voters":[{"Id":162173,"DisplayName":"user502233"}],"DeleteType":1}
{"Voters":[{"Id":162173,"DisplayName":"user502233"}]}
I didn't find an exact description for this, but I know that any integer type is a simple bit pattern, it seems to me that the simple bit pattern should have a more exact description as I understand simple bit pattern are synonym for [**`primitives`**](https://en.wikipedia.org/wiki/Primitive_data_type)
I've been reading the Peter Selinger's article "Control Categories and Duality: On the Categorical Semantics of the Lambda-Mu Calculus". I'm wondering about the categorical interpretation of the reduction rules. In particular, I'm trying to demonstrate that the left and right sides of $$[\alpha']\mu \alpha^A. M = M[\al...
For an input to independent set, subdivide each edge twice, add a new vertex that is incident to every subdivision-vertex. Now, the distance between two vertices in the new graph is 4 if and only if they correspond to two non-adjacent vertices in the input graph.
null
I've been reading the Peter Selinger's article "Control Categories and Duality: On the Categorical Semantics of the Lambda-Mu Calculus". I'm wondering about the categorical interpretation of the reduction rules. In particular, I'm trying to demonstrate that the left and right sides of $$[\alpha']\mu \alpha^A. M = M[\al...
**Hint:** $$\color{blue}1\color{blue}2\color{red}3\color{blue}4\color{red}5\color{blue}6\color{red}7\color{red}8\color{blue}9$$ $$\color{blue}1\color{blue}2\color{red}3\color{blue}4\color{red}5\color{red}8\color{red}7\color{blue}6\color{blue}9$$ $$\color{blue}1\color{blue}2\color{red}3\color{red}7\color{red}5\...
null
In my answer I assume you are acquainted with formal grammars, especially, the Backus Naur form. The lexical analyzer, alone, could never state the sentence you provided actually belongs to C. Telling whether it belongs or not to the language, is a joint duty of the lexical and syntactical analyzers. On one hand...
It took me a few minutes to figure out what functions $e()$ and $v()$ do but after some careful reading I got to the conclusion they implement a recursive descent parser whose language $\mathcal{L}$ is the one made of arithmetic expressions on identifiers $x$ and $y$. Regarding your first question, I don't think ope...
In section 3.7.1, of the book (made available freely online, by the author [here][1]), have on page #176, the mention of grammar, for a right-recursive list: stmt_list -> stmt stmt_list | stmt stmt -> A | B| C while on the previous page, the left recursive version is given: stmt_list -> stmt_list ...
Change of associativity for a given right-recursive grammar
|compilers|recursion|
In section 3.7.1, of the book (made available freely online, by the author [here][1]), have on page #176, the mention of grammar, for a right-recursive list: stmt_list -> stmt stmt_list | stmt stmt -> A | B| C while on the previous page, the left recursive version is given: stmt_list -> stmt_list ...