instruction
stringlengths
0
29.8k
⌀
I have a recursive algorithm with time complexity equivalent to choosing k elements from n with repetition, and I was wondering whether I could get a more simplified big-O expression? Specifically, I'd expect some explicit exponential expression. The best I could find so far is that based on Stirling's approximatio...
Simplify complexity of n multichoose k
|time-complexity|combinatorics|
In the context of graph theory, a homomorphism $h:G\rightarrow G'$ is a mapping between two graphs that maps adjacent vertices in $G=(V,E)$ to adjacent vertices in $G'=(V',E')$. In other words, for every edge $e=(u,v) \in E$, the edge $(h(u),h(v))\in E'$. Graph homomorphism imply many properties, including results in g...
Isomorphism formalizes the notion of "equal" graphs. For example on this figure you see three isomorphic graphs ![enter image description here][1] More formally, an isomorphism of graphs $G_1$ and $G_2$ is a bijection $f:V(G_1) \mapsto V(G_2)$ that preserves adjacency. That is to say: $$u \sim_{G_1} v \iff f(u) \...
Isomorphism formalizes the notion of "equal" graphs. For example on this figure you see three isomorphic graphs ![enter image description here][1] More formally, an isomorphism of graphs $G_1$ and $G_2$ is a bijection $f:V(G_1) \mapsto V(G_2)$ that preserves adjacency. That is to say: $$u \sim_{G_1} v \iff f(u) \...
null
If $k=n-1$ then your expression becomes $O\left ({{2(n-1)}\choose{n-1}}\right)$. Notice that by Stirling's formula for any $0<\alpha<1$ $${m \choose {\alpha m}}= \Theta(m^{-{1/2}} 2^{H(\alpha)m}),$$ where $H(q)=-q \log q - (1-q) \log (1-q)$ is the binary entropy. In particular $H(1/2)=1$. Therefore we have for $k=n...
I have a recursive algorithm with time complexity equivalent to choosing k elements from n with repetition, and I was wondering whether I could get a more simplified big-O expression? Specifically, I'd expect some explicit exponential expression. The best I could find so far is that based on Stirling's approximatio...
|asymptotics|combinatorics|runtime-analysis|
Isomorphism formalizes the notion of "equal" graphs. For example on this figure you see three isomorphic graphs ![enter image description here][1] More formally, an isomorphism of graphs $G_1$ and $G_2$ is a bijection $f:V(G_1) \mapsto V(G_2)$ that preserves adjacency. That is to say: $$u \sim_{G_1} v \iff f(u) \...
null
Isomorphism formalizes the notion of "equal" graphs. For example on this figure you see three isomorphic graphs ![enter image description here][1] More formally, an isomorphism of graphs $G_1$ and $G_2$ is a bijection $f:V(G_1) \mapsto V(G_2)$ that preserves adjacency. That is to say: $$u \sim_{G_1} v \iff f(u) \...
A comment and a suggestion. For *fixed* $\ell$ the language of words with nesting limit $\ell$ is regular, with a very simple automaton, basically a line of states, each representing the current level. Form that automaton a recurrence formula can be obtained (in terms of the number of bracket pairs $n$, again for fi...
Wolfram says Sondow (2005)[1] and Sondow and Zudilin (2006)[2] noted the inequality: $$\frac{1}{4rm}\left[\frac{(r+1)^{r+1}}{r^r}\right]^m < {(r+1)m \choose m} < \left[\frac{(r+1)^{r+1}}{r^r}\right]^m$$ for $m$ a positive integer and $r\ge 1$ a real number. We can then use $${n+k-1\choose k} < {n+k\choose k} = {(...
Suppose we have a function on GPU which calculates elements of array from which we need to select top K elements. The number of elements can be quite big so we can't store them in memory and our algorithm should be online. Another requirement for algorithm is its good parallelization so it could be effectively run on G...
An online parallel algorithm for finding top K elements
|algorithms|parallel-computing|
Wolfram says Sondow (2005)[1] and Sondow and Zudilin (2006)[2] noted the inequality: $$\frac{1}{4rm}\left[\frac{(r+1)^{r+1}}{r^r}\right]^m < {(r+1)m \choose m} < \left[\frac{(r+1)^{r+1}}{r^r}\right]^m$$ for $m$ a positive integer and $r\ge 1$ a real number. We can then use $${n+k-1\choose k} < {n+k\choose k} = {(...
I’m trying to make a photo mosaic web application. I split the main picture in to a number of squares. I split this square up in to 9 squares ([See picture][1]) Then I calculate the mean color (RGB) of the entire square and the mean color of the 9 little squares. So I will get the following vector. Vector: Mean R; m...
Compare vectors, photo mosaic
|algorithms|
Here is one naive solution: Let the number of parallel processes be $m$. Then, keep a separate buffer/heap/balanced tree for each of the $m$ processes. Divide the range of input into $m$ sections. Whenever you read a number, insert it into the appropriate process' heap. This way, each process only works on its own h...
Wolfram says Sondow (2005)[1] and Sondow and Zudilin (2006)[2] noted the inequality: $$\frac{1}{4rm}\left[\frac{(r+1)^{r+1}}{r^r}\right]^m < {(r+1)m \choose m} < \left[\frac{(r+1)^{r+1}}{r^r}\right]^m$$ for $m$ a positive integer and $r\ge 1$ a real number. We can then use $${n+k-1\choose k} < {n+k\choose k} = {(...
null
Wolfram says Sondow (2005)[1] and Sondow and Zudilin (2006)[2] noted the inequality: $$\frac{1}{4rm}\left[\frac{(r+1)^{r+1}}{r^r}\right]^m < {(r+1)m \choose m} < \left[\frac{(r+1)^{r+1}}{r^r}\right]^m$$ for $m$ a positive integer and $r\ge 1$ a real number. We can then use $${n+k-1\choose k} < {n+k\choose k} = {(...
Suppose I have a set of sets of integers $A$, is there an efficient algorithm/data structure that will allow me to query for all sets of integers that contain a given input set? That is, given input $I$, $\forall_{x \in I}x\in\mathbb Z$ find $C$, the sets in $A$ that include all of $I$, or $C=\left\{ B \in A \space | B...
Finding containing sets in a set of sets
|sets|set-theory|
If $k=n-1$ then your expression becomes $O\left ({{2(n-1)}\choose{n-1}}\right)$. Notice that by Stirling's formula for any $0<\alpha<1$ $${m \choose {\alpha m}}= \Theta(m^{-{1/2}} 2^{H(\alpha)m}),$$ where $H(q)=-q \log q - (1-q) \log (1-q)$ is the binary entropy. In particular $H(1/2)=1$. Therefore we have for $k=n...
Suppose I have a set of sets of integers $A$, is there an efficient algorithm/data structure that will allow me to query for all sets of integers that include a given input set? That is, given input $I$, $\forall_{x \in I}x\in\mathbb Z$ find $C$, the sets in $A$ that include all of $I$, or $C=\left\{ B \in A \space | B...
Suppose I have a set of sets of integers $A$, is there an efficient algorithm/data structure that will allow me to query for all sets of integers that include a given input set? That is, given input $I\subset \mathbb Z$, $\forall x \in I$ find $C$, the sets in $A$ that include all of $I$, that is $C=\left\{ B \in A \mi...
|algorithms|sets|
Suppose I have a set of sets of integers $A$, is there an efficient algorithm/data structure that will allow me to query for all sets of integers that include a given input set? That is, given input $I\subset \mathbb Z$, $\forall x \in I$ find $C$, the sets in $A$ that include all of $I$, that is $C=\left\{ B \in A \mi...
null
> **Applicative order:** Always fully evaluate the arguments of a function > before evaluating the function itself , like - > > $(\lambda x. x^2(\lambda x.(x+1) \ \ 2))) \rightarrow (\lambda x. > x^2(2+1))\rightarrow \ (\lambda x. x^2(3)) \rightarrow \ 3^2 \ > \rightarrow \ 9$ > > **Normal order:** The expre...
"Applicative order" and "Normal order" in lambda-calculus
|terminology|logic|lambda-calculus|
> **Applicative order:** Always fully evaluate the arguments of a function > before evaluating the function itself , like - > > $(\lambda x. x^2(\lambda x.(x+1) \ \ 2))) \rightarrow (\lambda x. > x^2(2+1))\rightarrow \ (\lambda x. x^2(3)) \rightarrow \ 3^2 \ \rightarrow \ 9$ > > **Normal order:** The expres...
> **Applicative order:** Always fully evaluate the arguments of a function > before evaluating the function itself , like - > > $(\lambda x. x^2(\lambda x.(x+1) \ \ 2))) \rightarrow (\lambda x. x^2(2+1))\rightarrow \ (\lambda x. x^2(3)) \rightarrow \ 3^2 \ \rightarrow \ 9$ > > **Normal order:** The express...
$(\lambda x.y \ (\lambda x.(x \ \ x) \ \lambda x.(x \ \ x)))$ is an infinite loop because $$\lambda x.(x \ \ x) \ \lambda x.(x \ \ x) \to \lambda x.(x \ \ x) \ \lambda x.(x \ \ x)$$ Notice that $\lambda x.(x \ \ x)$ just writes it's argument twice.
The term you are reducing is $(K_y \Omega)$ where $K_y$ is a constant function (it always returns $y$, ignoring its argument) and $\Omega$ is a non-terminating term. In some sense $\Omega$ is the ultimate non-terminating term: it beta-reduces to itself, i.e. $\Omega \to \Omega$. (Make sure to work it out on paper at le...
> **Applicative order:** Always fully evaluate the arguments of a function > before evaluating the function itself , like - > > $(\lambda x. x^2(\lambda x.(x+1) \ \ 2))) \rightarrow (\lambda x. x^2(2+1))\rightarrow \ (\lambda x. x^2(3)) \rightarrow \ 3^2 \ \rightarrow \ 9$ > > **Normal order:** The express...
|logic|lambda-calculus|normal-forms|
|algorithms|image-processing|
I'm currently working on a paper describing a new algorithm in computational science. If all goes well, this algorithm will be around for a while (within the specific community). As such, I want to set notation conventions that will _not_ drive other people insane. The primary difference is that this algorithm makes us...
Notation Conventions for Tree Data Structures
|untagged|
The right approach will generally tend to depend on your data -- size of sets, number of sets, range of elements, size of input, number of queries etc. Here is one approach: You could use a [Bloom filter][1] for each of the sets in $A$, and for the input set $I$. Assuming the same number of bits for each set, and th...
The term you are reducing is $(K_y \Omega)$ where $K_y$ is the constant function $\lambda x. y$ (it always returns $y$, ignoring its argument) and $\Omega = (\lambda x. (x \, x) \: \lambda x. (x \, x))$ is a non-terminating term. In some sense $\Omega$ is the ultimate non-terminating term: it beta-reduces to itself, i....
The right approach will generally tend to depend on your data -- size of sets, number of sets, range of elements, size of input, number of queries etc. Here are a couple of approaches: **Approach 1:** You could use a [Bloom filter][1] for each of the sets in $A$, and for the input set $I$. Assuming the same number o...
Isomorphism formalizes the notion of **equal** graphs. For example on this figure you see three isomorphic graphs ![enter image description here][1] More formally, an isomorphism of graphs $G_1$ and $G_2$ is a bijection $f:V(G_1) \mapsto V(G_2)$ that preserves adjacency. That is to say: $$u \sim_{G_1} v \iff f(u)...
|algorithms|trees|
I read many things about the Turing machine and understand how it works but what I can't get the grasp of (and what none of the books seem to try to teach) is how should I approach a problem I am given to solve? I mean: checking if a word is a palindrome, for example, consists of 11 states in the book I'm learning from...
Turing machine and coming up with an idea
|turing-machines|
null
Suppose you're given some string over a three-character alphabet $\{0,1,\,\_ \}$, where the latter is the blank character. You'd like to know if the input consists of a single "word" over $\{0,1\}$, ending with one or more blank characters, which is a palindrome. (There could be multiple words later on the tape, but yo...
Try using visual designers [like this][1] or [turingkara-x-en][2], which also contains exercises. Keep in mind that the TM is meant to be a theoretical, minimalistic model to simplify proofs. Programming on the other hand will get nasty fast. So don't think it's a shame to have problems with programs requiring more ...
You can use functions. Let $node$ be an arbitrary node of the tree. Then $data(node)$ is data associated with $node$, $children(node)$ is set of child nodes of $node$ and $parent(node)$ is parent of $node$. For data associated with $i^{th}$ child of $node$ you can use $data(children(node)_i)$ etc.
Try using visual designers [like this][1] or [turingkara-en][2], which also contains exercises. Keep in mind that the TM is meant to be a theoretical, minimalistic model to simplify proofs. Programming on the other hand will get nasty fast. So don't think it's a shame to have problems with programs requiring more th...
Just to expand the comments above, you should try to find an high level algorithm, and then refine its steps in smaller pieces. For example, if you want to recognize palindrome words, a high level agorithm can be: 1. check if the leftmost symbol is equal to the rightmost symbol 2. if they are not equal r...
Just to expand the comments above, you should try to find a high level algorithm, and then refine its steps in smaller pieces. For example, if you want to recognize palindrome words, a high level agorithm can be: 1. check if the leftmost symbol is equal to the rightmost symbol 2. if they are not equal re...
Just to expand the comments above, you should try to find a high level algorithm, and then refine its steps in smaller pieces. For example, if you want to recognize palindrome words, a high level agorithm can be: 1. check if the leftmost symbol is equal to the rightmost symbol 2. if they are not equal re...
A regular graph is a one in which each vertex has the same number of neighbors but in star topology the central vertex is connected to more than one vertex.So, how it is referred to as a regular graph?
how is star topology a regular graph?
|graphs|
null
Suppose we have a classification problem and we wish to solve the problem by Neural Network. What factors must one consider choosing an NN structure? e.g Feed Forward, Recurrent and other available structures.
What factors must one consider choosing an NN structure?
|artificial-intelligence|neural-networks|neural-computing|
Here is a list of parameters you should take into consideration (to name some): 1. The learning algorithm (gradient descent is the most explained of them) 2. The number of layers (3,4 layers is usually enough - input, 1 or 2 hidden, output) 3. Number of nodes in the hidden layers (you select that by trial and ...
Here is a list of parameters you should take into consideration (to name some): 1. The learning algorithm (gradient descent is the most explained of them) 2. The number of layers (3,4 layers is usually enough - input, 1 or 2 hidden, output). The output layer depends on your output (e.g., if you want to classify ...
Yes, Context-Sensitive-Grammars(CSG) powerful enough to make undefined/undeclared/unbound variables check but unfortunately we don't know any efficient algorithm to parse strings of CSG. A real example of Context Sensitive Language is `C-Programming language`. Feature like declare variables first then use them lat...
Yes, I would believe this to be possible, but no I am not willing to explicitly construct that context-sensitive grammar. I will explain my answer, by splitting the question in two different parts. (1) What would the non-toy example be? It should reflect declaration of variables. My proposal of such a language, abst...
My favourite example of a context-sensitive language (CSL) is SAT. The Landweber-Kuroda Theorem says that CSL = NSPACE$[n]$. Any SAT instance has a linear-size certificate. See my question _[Context-sensitive grammar for SAT?][1]_ for references and discussion. Many other NP-hard languages are also in CSL by the ...
I'm trying to understand context-sensitive grammars, and I understand why languages like > 1. {ww | w is a string} 2. {a<sup>n</sup> b<sup>n</sup> c<sup>n</sup> | a,b,c are symbols} are not context free, but what I'd like to know if a language similar to the untyped lambda calculus is context sensitive. I'd l...
Can someone give a simple but non-toy example of a context-sensitive grammar?
|programming-languages|lambda-calculus|formal-grammars|
are you looking for explanation on Big O? if Yes, this link might help you [http://en.wikipedia.org/wiki/Big_O_notation][1] [1]: http://en.wikipedia.org/wiki/Big_O_notation
The expression "$A(L) \le (1 + \varepsilon) \text{Opt}(L) + O(1/\varepsilon^2)$" is, as usual, shorthand for the following: > There exist constants $c>0$ and $\varepsilon_0>0$ such that for all $\varepsilon$ with $0<\varepsilon<\varepsilon_0$, the inequality $A(L) \le (1 + \varepsilon) \text{Opt}(L) + c/\varepsilon^...
I'm trying to understand the approximation ratio for the [Kenyon-Remila](http://mor.journal.informs.org/content/25/4/645.full.pdf) algorithm for the 2D cutting stock problem. The ratio in question is `(1 + ε)Opt(L) + O(1/(ε^2))`. The first term is clear, but the second doesn't mean anything to me and I can't seem...
What does big O mean as a term of an approximation ratio?
|algorithms|
If I remember correctly, this usage you feel confused predated (and actually inspired) the usage of $O$ for asymptotic functions. For example, you can have a short look at http://en.wikipedia.org/wiki/Prime_number_theorem.
This seems a looser variant of polynomial time approximation scheme (PTAS). If \epsilon is not small, you can achieve approximation with ratio very close to 1+\epsilon because O(\epsilon^{-2}) \le c \epsilon^{-2} is small. (c is a fixed positive real number independent of any other variable.) If \epsilon is small, the ...
I'm trying to understand the approximation ratio for the [Kenyon-Remila](http://mor.journal.informs.org/content/25/4/645.full.pdf) algorithm for the 2D cutting stock problem. The ratio in question is $(1 + \varepsilon) \text{Opt}(L) + O(1/\varepsilon^2)$. The first term is clear, but the second doesn't mean anyth...
In fact, the algorithm in question is a so-called "asymptotic polynomial time approximation scheme" (APTAS), which means that the approximation ratio is measured asymptotically in terms of the optimum; the approximation ratio of $(1+\epsilon)$ is approached as the optimal value gets larger since the additive term $O(\e...
This is my first post after being a passive user for some time now. I wish to ask some questions if I may. I am not a mathematician but my question relates to the field of maths/computer science. In particular, the P vs NP problem. I am aware that this is a problem that elite professionals have not yet been able to...
Proving P = NP without mathematical statements / computer program