instruction stringlengths 0 29.8k ⌀ |
|---|
Let $E$ be the set of your edges, and let $V$ be the set of all the edge's endpoints. Consider the graph $G=(V,E)$. You're asking for a [Directed Eulerian trail of $G$][1].
[One possible way][2] to so so, is the following: assume that $G$ is connected (otherwise there is no Eulerian trail) and that each vertex has... |
null |
Above all, hardware floating-point units are optimised for normalised numbers.
Multipliers, and even more dividers, can be a bit simpler if the two inputs are already normalised :
- there is the implicit leading 1 always in the same place.
- rounding as well always occurs on same digits, which can allow some simpl... |
null |
Consider the following grammar:
```
S → A | B
A → aA | bA | ɛ
B → C | B#B
C → aCa | bCb | aDa | bDb
D → # | #B#
```
The first rule (S) basically says that our string can be anything (rule A) without any delimiting #'s, or will follow the ...$\#x\#...\#x^R\#$... pattern (rule B).
For rules B, C, and D, thin... |
Let $E$ be the set of your edges, and let $V$ be the set of all the edge's endpoints. Consider the graph $G=(V,E)$. You're asking for a [Directed Eulerian trail of $G$][1].
[One possible way][2] to so so, is the following: assume that each vertex has the same in- and out-degree (more on how this assumption can be ... |
null |
Time complexity of obtaining the support set of an unsorted sequence? |
[This paper][1] studies a similar problem: finding an approximate fixed-point of a two-dimensional function from the unit square to itself, which is accessible via value queries. The authors prove that computing a fixed point with $p$ decimal digits requires $\Omega(2^p)$ queries. Equivalently, computing a square of si... |
I am new to optimization methods. What is the meaning of "crossover probability" in optimization methods? I was reading the following lines from an article that this question came into my mind:
> In unmodified differential
evolution (DE) algorithm, ***crossover probability*** is constant and remains unchanged durin... |
What is "crossover probability" in optimization techniques? |
|algorithms|algorithm-analysis|optimization| |
Let $f$ be a continuous real function on $[-1,1]$. The function is accessible via *queries*: for any $x$, the value of $f(x)$ can be computed in constant time.
If $f(-1)<0$ and $f(1)>0$, then by the intermediate value theorem, $f$ has a *zero* --- an $x \in [-1,1]$ for which $f(x)=0$. Suppose we want to find a zero a... |
[This paper][1] studies a similar problem: finding an approximate fixed-point of a two-dimensional function from the unit square to itself, which is accessible via value queries. The authors prove that computing a fixed point with $p$ decimal digits requires $\Omega(2^p)$ queries. Equivalently, computing a square of si... |
null |
null |
Chaitin’s version of Gödel’s theorem roughly states that there exists a constant c such that for each string of one’s and zeroes x, the sentence “the algorithmic complexity of x is greater than c” is unprovable, even though there are an infinite number of x’s in which the sentence is true.
I am wondering if it were ... |
Chaitin’s version of Gödel’s theorem and pseudorandomness |
|complexity-theory|pseudo-random-generators|kolmogorov-complexity| |
Chaitin’s version of Gödel’s theorem roughly states that there exists a constant c such that for each string of one’s and zeroes x, the sentence “the algorithmic complexity of x is greater than c” is unprovable, even though there are an infinite number of x’s in which the sentence is true.
I am wondering if it were ... |
Chaitin’s version of Gödel’s theorem roughly states that there exists a constant c such that for each string of one’s and zeroes x, the sentence “the algorithmic complexity of x is greater than c” is unprovable, even though there are an infinite number of x’s in which the sentence is true.
I am wondering if it were ... |
null |
Chaitin’s version of Gödel’s theorem roughly states that there exists a constant c such that for each string of one’s and zeroes x, the sentence “the algorithmic information complexity (Kolmogorov complexity) of x is greater than c” is unprovable, even though there are an infinite number of x’s in which the sentence is... |
null |
It's unlikely you're going to prove anything like that. There are plenty of candidates that are believed to be likely to be [pseudorandom generators](https://en.wikipedia.org/wiki/Pseudorandom_generator) (PRGs). It would be surprising if they aren't PRGs, and it would be surprising if they are PRGs but that fact is u... |
Consider the following string:
```lang-python
stryng = "{"Jordi", "Jordy", "Jorde", "Jordie", "Jordee", "Joardi", "Joardy", "Joarde", "Joardie", "Joardee"}"
```
That string represents a mathematical set.
$\begin{Bmatrix} \mathtt{Jordi}, \mathtt{Jordy}, \mathtt{Jorde}, \mathtt{Jordie}, \mathtt{Jordee}, \m... |
How do you convert a string represneting finite set of strings into a regulair expression without using lots of vertical bars? |
|regular-expressions|compilers|parsers| |
null |
{"OriginalQuestionIds":[14159],"Voters":[{"Id":4287,"DisplayName":"Hendrik Jan"},{"Id":79440,"DisplayName":"Nathaniel"},{"Id":91753,"DisplayName":"John L."}]} |
null |
null |
If `Jordye` was in the set too, then `Joa+rd[iye]e+` would work, where:
* `[iye]` means "one character which can be `i, y` or `e`";
* `a+` means "zero or one `a`".
But without `Jordye` in the set I'm afraid you have to content with either
```
Joa+rd(i|y|e|ie|ee)
```
or
```
Joa+rd([iye]|[ie]e)
```
or
```
... |
With $p:=\dfrac ms$ and collecting all the constants to avoid the mess, the equation reads
$$e^{p^2}=\lambda p^2$$ or $$-p^2e^{-p^2}=-\lambda.$$
Hence using the Lambert function,
$$s=\frac m{\sqrt{-W(-\lambda)}}.$$
You can probably find ready-made implementations of that function in Java, or adapt from a C/... |
With $p:=\dfrac ms$, squaring and collecting all the constants to avoid the mess, the equation reads
$$e^{p^2}=\lambda p^2$$ or $$-p^2e^{-p^2}=-\lambda^{-1}.$$
Hence using the Lambert function,
$$s=\frac m{\sqrt{-W(-\lambda^{-1})}}.$$
You can probably find ready-made implementations of that function in Java... |
Does anyone know of the data structure/algorithm for this use case?
Given 300k words, -> find all words with some letters present (letters could be in any order)?
For example find all words with letters a,a,d? (so for example "academics" and "captained" are some of the matches)
I initially looked into GADDAG, bu... |
Given the 300k words -> find all words with given letters present (in any order)? Any Data structure for this? |
|data-structures| |
With $p:=\dfrac ms$, squaring and collecting all the constants to avoid the mess, the equation reads
$$e^{p^2}=\lambda p^2$$ or $$-p^2e^{-p^2}=-\lambda^{-1}.$$
Hence using the Lambert function,
$$s=\frac m{\sqrt{-W(-\lambda^{-1})}}.$$
The positive square root must be taken, and the two branches of $W$ yield... |
null |
Given two regular languages (fx given by it's accepting regular expression), is there an algorithm to determine if one is a subset of the other?
If so is it also possible for an algorithm to do the same if we allow regular expressions as used by modern implementations of regex (fx allowing backreferences would make ... |
Is the algorithm to determine if a regular language (expression) is subset of another? |
|computability|regular-languages|regular-expressions| |
Is there a algorithm to determine if a regular language (expression) is subset of another? |
Prove that for $A, B \in \mathbb{Z}$, $A + B = (A \& B) + (A | B) = (A \oplus B) + 2(A \& B)$ where $\&$ is bitwise AND, $|$ is bitwise OR and $\oplus$ is bitwise XOR. (It is reasonable to assume that the bit representation of integers is two's complements.)
The statement above appears as item 23 in [HAKMEM][1] but ... |
Prove HAKMEM Item 23: connection between arithmetic operations and bitwise operations on integers |
|boolean-algebra|integers| |
BDDs are a way of representing Boolean formulas.
DPLL is an algorithm to determine satisfiability of Boolean formulas.
My understanding is that the two are used for SAT solving.
How are they combined? |
What's the relation between DPLL and BDDs? |
|algorithms|satisfiability|sat-solvers|bdd| |
null |
Prove it for the cases that A and B are both true, that exactly one of them is true, and that none of them is true. |
null |
> Prove that for $A, B \in \mathbb{Z}$, $A + B = (A \& B) + (A | B) = (A \oplus B) + 2(A \& B)$ where $\&$ is bitwise AND, $|$ is bitwise OR and $\oplus$ is bitwise XOR. (It is reasonable to assume that the bit representation of integers is two's complements.)
You have interpreted item 23 so that it is almost correc... |
They're not combined. They are two separate techniques.
DPLL is used with a Boolean formula represented in CNF form. BDD algorithms represent the Boolean formula as a BDD.
Generally, if you want to test satisfiability, DPLL-based SAT solvers are likely to be more effective. BDDs do allow performing other operat... |
Given two regular languages (fx given by it's accepting regular expression), is there an algorithm to determine if one is a subset of the other? |
Yes, there is an algorithm for it, but there is unlikely to be an efficient algorithm.
Notice that you can convert between a regular expression and a NFA in polynomial time. Moreover, determining one regular language is a subset of another, if both are represented as NFAs, is PSPACE-complete. Therefore, there is u... |
{"OriginalQuestionIds":[159454],"Voters":[{"Id":755,"DisplayName":"D.W."}]} |
There's unlikely to be any really good solution, but here is an approach.
For each word in your dictionary, sort the letters in alphabetic order. For instance, "smile" becomes "eilms" and "honolulu" becomes "hllnoouu". Store these words in a trie.
Next, given a query (a set of required letters), you can traver... |
null |
I agree with D.W. that there likely isn't a good general solution, and as long as we don't know exactly what the expected sequence of input is, and how the dictionary looks like, it's hard to give good answers.
I would (for lack of better information) simply cache all possible combinations of queries. Say that the ... |
I agree with D.W. that there likely isn't a good general solution, and as long as we don't know exactly what the expected sequence of input is, and how the dictionary looks like, it's hard to give good answers.
I would (for lack of better information) simply cache all possible combinations of queries. Say that the ... |
null |
Partial answer: The problem admits an $O(n^{\log_3(2)}) \leq O(n^{0.631})$ algorithm.
The algorithm $\mathcal A$ works as follows:
1. Query $x = A[n/3]$ and $y = A[2n/3]$.
2. If $x = y$, return $\max \{x, \mathcal A(A[1, n/3]), \mathcal A(A[2n/3, n])\}$
3. If $x < y$, return $\max \{\mathcal A(A[n/3, 2n/3]),... |
> Prove that for $A, B \in \mathbb{Z}$, $A + B = (A \& B) + (A | B) = (A \oplus B) + 2(A \& B)$ where $\&$ is bitwise AND, $|$ is bitwise OR and $\oplus$ is bitwise XOR. (It is reasonable to assume that the bit representation of integers is two's complements.)
You have interpreted item 23 so that it is almost correc... |
null |
null |
This answer isn't rigorous or starting from first principles, but I thought this was elegant so here it is anyway.
Given that addition is commutative and associative and bit-shifting all summands left also bit-shifts the result by the same amount, and that $(...A_3A_2A_1) = ... + A_300 + A_20 + A_1$, we have that ... |
Consider a graph with $n$ nodes and $m = \mathcal{O}(n^2)$ edges. The maximum capacity among all edges is denoted by $C$. The running time is given by: $\mathcal{O}(nmC)$
If I consider the input size in bits, it can be stated as: $\mathcal{O}(n \log n + m \log n + m \log C)$
Denote $v:= \log n, b:= \log C $.
... |
Note that the L.H.S. is $\mathcal{O}(n \log n + m \log n + m \log C)$.
It is easy to see the following three inequalities:
1. $n \log n \in \mathcal{O}(mn2^b)$
2. $m \log n \in \mathcal{O}(mn2^b)$
3. $m \log C \in \mathcal{O}(mn2^b)$
Therefore, $\mathcal{O}(n \log n + m \log n + m \log C) \in \mathcal{O}(mn2^b... |
Yes, there is an algorithm for it, but there is unlikely to be an efficient algorithm.
Notice that you can convert between a regular expression and a NFA in polynomial time. Moreover, determining whether one regular language is a subset of another, if both are represented as NFAs, is PSPACE-complete. Therefore, th... |
Yes and No.
Dictionary
Definitions from Oxford Languages · Learn more
an·a·log
adjective
adjective: analogue; adjective: analog
relating to or using signals or information represented by a continuously variable physical quantity such as spatial position, voltage, etc.
"analog signals"
(of a cl... |
null |
Thank you to @InuyashaYagami for pointing out that paper in the comment above. It cites ["Cutting Hyperplanes for Divide-and-Conquer" (Chazelle, 1993)](https://www.cs.princeton.edu/~chazelle/pubs/CuttingHyperplanes.pdf) which gives an $O(n^{2d/(d+1)}(\log n)^{1/(d+1)})$
algorithm for determining intersections between ... |
null |
Consider the following string:
```lang-python
stryng = "{\"Jordi\", \"Jordy\", \"Jorde\", \"Jordie\", \"Jordee\", \"Joardi\", \"Joardy\", \"Joarde\", \"Joardie\", \"Joardee\"}"
```
That string represents a mathematical set of strings.
$\begin{Bmatrix} \mathtt{Jordi}, \mathtt{Jordy}, \mathtt{Jorde}, \mat... |
How do you convert a string representing a finite set of strings into a regulair expression without using lots of vertical bars? |
How do we quantify the size of a regular expression?
A problem in computer science which sometimes arises is converting a regular expression into a tree.
What rules can we use to ensure that the tree will have a predictable number of nodes?
---------------------------------------------------------------
... |
What algorithm will convert a regex into a tree of predictable size? |
|graphs|trees|regular-expressions| |
We seek an algorithm.
Inputs to the algorithm are a set of strings $A$ and the output of the algorithm $A$ is a regular expression $r$ such that:
> 1. The ***size*** of regular expression $r$ is minimized.
>
> 2. If $A^{\prime}$ is set of strings described by regular expression $r$, then $A \subseteq A^{\... |
What algorithm accepts a set of strings as input and outputs a regex of minimal size? |
|optimization|trees|regular-expressions| |
Consider the following problem: You are given two arrays $A$ and $B$ of size $N$ and $M$, respectively. You are guaranteed that $1 <= A[i] <= M$ and $1 <= B[i] <= N$ for all $i$ (so each array's elements is at most the other array's size). The sizes of the arrays, $N$ and $M$, may be up to $100,000$. Construct two subs... |
Finding an equal-sum subset from two arrays |
|algorithms|time-complexity|mathematical-analysis|subset-sum| |
null |
null |
The minimal regular expression is `[abcd...]*`, where `abcd...` is the list of characters that appear in the input. This always accepts a superset of the specified strings. |
null |
#### Bitlength and bound needed for two's complements
> Prove that for $A, B \in \mathbb{Z}$, $A + B$ $= (A\operatorname{\&}B) + (A \mid B)$ $= (A \oplus B) + 2(A\operatorname{\&}B)$ where $\operatorname{\&}$ is bitwise AND, $\mid$ is bitwise OR and $\oplus$ is bitwise XOR. (It is reasonable to assume that the bit ... |
Prove that for $A, B \in \mathbb{Z}$, $A + B = (A \operatorname{\&} B) + (A \mid B) = (A \oplus B) + 2(A \operatorname{\&} B)$ where $\&$ is bitwise AND, $|$ is bitwise OR and $\oplus$ is bitwise XOR. (It is reasonable to assume that the bit representation of integers is two's complements.)
The statement above appea... |
|arithmetic|boolean-algebra|integers| |
null |
null |
Consider the addition of two random binary numbers like these:
$$
\begin{matrix}
&00101011& (A)\\
+ &01100101& (B)\\\hline
= &10010000& (A+B)
\end{matrix}
$$
Ignore the signed vs unsigned problem for now.
Now, $1$s are heavier than $0$s, so if a $1$ in $A$ is on top of a $0$ in $B$, they swap places:
... |
null |
It is an easy matter to check these identity that are true for single bits (the case $1+0$ follows by commutativity).
$$0+0=0\land0+0\lor0=0\oplus0+2\,(0\land0)$$
$$0+1=0\land1+0\lor1=0\oplus1+2\,(0\land1)$$
$$1+1=1\land1+1\lor1=1\oplus1+2\,(1\land1)$$
And these results immediately generalize to bitwise operati... |
Let $C_1, ..., C_m \in \mathbb{R}^n$ Is there a polynomial algorithm in $n,m$ which finds the Minimum Enclosing Ball (MEB) for this points?
My research
-
I see mentions of algorithms like Megido, Waltz etc. which are known to solve the problem in linear time in $m$, the number of points, but these seem to be expo... |
Is there an algorithm polynomial in dimension of space and number of points for the Minimum Enclosing Ball? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.