instruction
stringlengths
0
29.8k
⌀
null
|proof-techniques|cryptography|
|regular-languages|formal-grammars|context-free|
You mention correctly that the language is regular, so a regular grammar is the easiest way to go: $\qquad \begin{align} S &\to aS \mid bT \\ T &\to aT \mid bS \mid b \end{align}$ This solution uses the "counting" trick: we store in the "state" (whether we have $S$ or $T$ in the sentential form) whether we...
1. An example of such an algorithm is randomized Quick Sort, where you randomly permute the list or randomly pick the pivot value, then use Quick Sort as normal. Quick Sort has a worst case running time of $O(n^{2})$, but on a random list has an expected running time of $O(n\log n)$, so it always terminates after $O(n^...
|computability|terminology|
$H(x)$ is the program size complexity of $x$ for some universal Turing machine $U$. $H$ is not computable, however $H$ is "*computable in the limit from above*". From my notes: >i.e the set $\{(x,n) \mid x \in B^*,n \geq 0, H(x) \leq n\}$ is computably enumerable. Can someone tell me what this means? I understan...
As the both the formula itself is given $f(n) = \frac{n-2}{3}$ as well as the inductive structure $f(n) = \frac{n-2}{n} + \frac1n \sum_{i=0}^{n-1}{\dots}$, it seems you are requested to show the formula by (mathematical) induction. Hint (2) only explains the formula. Inductively you apply the formula for $f(k), k<n$...
> Let $f(N)$ be the average number of full nodes (nodes with two children) in an $N$-node binary search tree. > 1. Determine the values of $f(0)$ and $f(1)$. > 2. Given that for $N > 1$, > $\qquad \displaystyle f(N) = \frac{N-2}{N} + \frac{1}{N} \sum_{i=0}^{N-1} [f(i) + f(N - i - 1)]$, > show that $f(...
Average number of full nodes in a binary search tree
|data-structures|combinatorics|recurrence-relation|binary-trees|
As the both the formula itself is given $f(n) = \frac{n-2}{3}$ as well as the inductive structure $f(n) = \frac{n-2}{n} + \frac1n \sum_{i=0}^{n-1}{\dots}$, it seems you are requested to show the formula by (mathematical) induction. Hint (2) only explains the formula. Inductively you apply the formula for $f(k), k<n$...
I have a bipartite graph with $|E|=O(|V|^2)$, a super-source and a super-sink. I am looking for the min-cost max-flow (the max-flow of all possible max-flows that has the minimum cost). For the sake of my question, denote $n=|E|$. Are there algorithms that will run in $O(n^2)$, or even $O(n\log(n))$, or for that ...
Min cost max flow in bipartite run time
|graphs|optimization|
If we suppose that we'd like to convert an instance of 3-SAT to an instance of 4-SAT, by how much can we reduce the amount of variables? **CONVERSION METHODS FOR PRODUCTS OF SUMS** If we are given a 3-SAT clause $(A \lor B \lor C)$, we can readily convert this to 4-SAT by rewriting it as $(A \lor B \lor C \lor x)...
How can we reduce variables when converting from 3-SAT to 4-SAT?
|satisfiability|3-sat|
This question has gotten a lot of attention on SO: http://stackoverflow.com/questions/12748246/sorting-1-million-8-digit-numbers-in-1mb-of-ram The problem is to sort a stream of 1 million 8-digit numbers using only 1 MB of memory (8388608 bits) and no external storage. The program must read values from an input s...
Minimum space needed to sort a stream of integers
|combinatorics|sorting|space-complexity|data-compression|
This question has gotten a lot of attention on SO: http://stackoverflow.com/questions/12748246/sorting-1-million-8-digit-numbers-in-1mb-of-ram The problem is to sort a stream of 1 million 8-digit numbers using only 1 MB of memory (8388608 bits) and no external storage. The program must read values from an input s...
This question has gotten a lot of attention on SO: http://stackoverflow.com/questions/12748246/sorting-1-million-8-digit-numbers-in-1mb-of-ram The problem is to sort a stream of 1 million 8-digit numbers using only 1 MB of memory ($2^{20}$ bits) and no external storage. The program must read values from an input ...
The only examples I've seen use bits as a measurement of entropy, but all these examples happen to use binary code alphabets. If we wanted to see how well a coding with a code alphabet of length n works, would we measure entropy in units of n? Or would it make sense to stay using bits if we're comparing codings with...
What units should Shannon entropy be measured in?
|information-theory|
The paper [Effective Preprocessing in SAT through Variable and Clause Elimination](http://minisat.se/downloads/SatELite.pdf) covers the variable elimination techniques used in Minisat. Broadly, variables can be eliminated by 1. Substitution, in which a variable to be removed is defined in terms of other variables ...
This question has gotten a lot of attention on SO: [Sorting 1 million 8-digit numbers in 1MB of RAM](http://stackoverflow.com/questions/12748246/sorting-1-million-8-digit-numbers-in-1mb-of-ram) The problem is to sort a stream of 1 million 8-digit numbers (integers in the range $[0,\: 99\mathord{,}999\mathord{,}99...
|algorithms|sorting|space-complexity|data-compression|streaming-algorithm|
This question has gotten a lot of attention on SO: [Sorting 1 million 8-digit numbers in 1MB of RAM](http://stackoverflow.com/questions/12748246/sorting-1-million-8-digit-numbers-in-1mb-of-ram) The problem is to sort a stream of 1 million 8-digit numbers (integers in the range $[0,\: 99\mathord{,}999\mathord{,}99...
Im trying to figure out the following but am getting extremely confused. Let the input alphabet be Σ = { a b c } and L be the language of all words in which all of the a’s come before all of the b’s and there are the same number of a’s as b's and arbitrarily many c’s that can be in front, behind or among the a’s an...
Deterministic PDA
|automata|pushdown-automata|
Let the input alphabet be $\Sigma = \{a,b,c\}$ and *L* be the language of all words in which all of the *a*’s come before all of the *b*’s and there are the same number of *a*’s as *b*'s and arbitrarily many *c*’s that can be in front, behind or among the *a*’s and *b*’s. Some words in *L* are: *abc ccacaabcccbccbc* ...
Constructing deterministic PDA for not regular language
null
Recipe in shorthand. Ignore $c$'s. Use a bottom fo stack symbol $Z$ that stays there. Keep the surplus of $a$'s or $b$'s on the stack. So $ZAAA$ (top of stack right) means three $a$'s more than $b$'s. If we read another $a$ push $A$, if we read another $b$ pop an $A$.
The following is an excerpt from the [Wikipedia article on the Miller-Rabin primality test][1]: >It can be shown that for any odd composite $n$, at least $\frac{3}{4}$ of the bases $a$ are witnesses for the compositeness of $n$. In the Fermat primality test, if $n$ is not a Carmichael number, [at least half of ...
Why are at least $\frac{3}{4}$ of the bases in the Miller-Rabin primality test witnesses of compositeness for a composite number?
|cryptography|number-theory|
For a composite number, why are at least $\frac{3}{4}$ of the bases witnesses of compositeness in the Miller-Rabin primality test?
In the Miller-Rabin primality test, for a composite number, why are at least $\frac{3}{4}$ of the bases witnesses of compositeness?
Generally bit was introduced by Shannon in 1948. Using bit instead of any other information measurement unit it's because of convenience any information can be represented by single bit or by set of bits. I bet you already ran into most popular example which is coin tossing. You can represent head as *1* and tails a...
|computer-architecture|program-optimization|
I'm reading a paper that refers to the limit as n goes to infinity of Renyi entropy. It defines it as ${{H}_{n}}\left( X \right)=\frac{1}{1-n}Lo{{g}_{2}}\left( \sum\limits_{i=1}^{N}{p_{i}^{n}} \right)$. It then says that the limit as $n\to \infty $ is $-Lo{{g}_{2}}\left( {{p}_{1}} \right)$. I saw another article that...
Renyi Entropy at infinity or min-entropy
|information-theory|
I'm reading a paper that refers to the limit as n goes to infinity of Rényi entropy. It defines it as ${{H}_{n}}\left( X \right)=\dfrac{1}{1-n} \log_2 \left( \sum\limits_{i=1}^{N}{p_{i}^{n}} \right)$. It then says that the limit as $n\to \infty $ is $-\log_2 \left( p_1 \right)$. I saw another article that uses the maxi...
Rényi entropy at infinity or min-entropy
If we regard a tree as a partial ordered set, it becomes a special case of a join-semilattice. For a join-semilattice, we want to be able to compute the (unique) least upper bound of two elements (more or less) efficiently. In the case of a tree, a data structure which would enable this would be to store for each eleme...
Is there a data-structure for semilattices similar to a tree data-structure?
|data-structures|lattices|
Generally bit was introduced by Shannon in 1948. Using bit instead of any other information measurement unit it's because of convenience any information can be represented by single bit or by set of bits. I bet you already ran into most popular example which is coin tossing. You can represent head as *1* and tails a...
Let the input alphabet be $\Sigma = \{a,b,c\}$ and *L* be the language of all words in which all of the *a*’s come before all of the *b*’s and there are the same number of *a*’s as *b*'s and arbitrarily many *c*’s that can be in front, behind or among the *a*’s and *b*’s. Some words in *L* are: *abc ccacaabcccbccbc* ...
Ok, it's way past my bedtime, but this won't let me go, so here's a second try (deleted my first)... Before going into the specifics of how to sort the numbers, I will start by representing them not as a sequence of integers $i_1, i_2, \dots , i_n$, but as a sequence of their differences, i.e. $\delta_k = i_k - i_{k...
null
Do "inductively" and "recursively" mean very similar? For example, if there is an algorithm that determines a n-dim vector by determine its first k+1 components based on its first k components having been determined, and is initialized with the first component, would you call it works recursively or inductively? I h...
Do "inductively" and "recursively" have very simiar meanings?
|algorithms|terminology|
|information-theory|entropy|
|information-theory|entropy|
|pattern-recognition|image-processing|entropy|computer-vision|
|reference-request|information-theory|entropy|
|reference-request|information-theory|data-compression|database-theory|entropy|
null
Suppose $p_1 = \max_i p_i$. We have $$ p_1^n \leq \sum_{i=1}^n p_i^n \leq N p_1^n. $$ Therefore $$ \frac{n \log p_1}{1-n} \leq H_n(X) \leq \frac{n \log p_1 + \log N}{1-n}. $$ As $n \rightarrow \infty$, $\log N/(1-n) \rightarrow 0$ while $n/(1-n) \rightarrow -1$.
I will preface my question with the definition of a simple tree that applies to my question: *-"A simple tree is an undirected and connected graph with no cycles."-* I am having difficulty coming up with a compelling argument that a tree of the above definition can be constructed by taking a set of disjoint valid...
Constructing a tree from disjoint graphs
|untagged|
Here are the three tests you're (implicitly) considering: - Fermat: test whether $a^{n-1} \equiv 1 \pmod{n}$ - Solovay-Strassen: test whether $a^{(n-1)/2} \equiv \left( \dfrac{a}{n} \right) \pmod{n}$ (where $\left( \dfrac{a}{n} \right)$ is a Jacobi symbol, which can be calculated using quadratic reciprocity via a...
If you look at [wikipedia](http://en.wikipedia.org/wiki/Topological_entropy) you see that *topological entropy* is modeled after *Kolmogorov-Sinai (KS)* entropy, but it is defined without reference to a measure $\mu$ on the space. For [KS entropy,](http://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Sinai_entropy#Measu...
If you look at [wikipedia](http://en.wikipedia.org/wiki/Topological_entropy) you see that *topological entropy* is modeled after *Kolmogorov-Sinai (KS)* entropy, but it is defined without reference to a measure $\mu$ on the space. For [KS entropy,](http://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Sinai_entropy#Measu...
If you look at [wikipedia](http://en.wikipedia.org/wiki/Topological_entropy) you see that *topological entropy* is modeled after *Kolmogorov-Sinai (KS)* entropy, but it is defined without reference to a probability measure $\mu$ on the space. For [KS entropy,](http://en.wikipedia.org/wiki/Kolmogorov%E2%80%93Sinai_e...
I have a bipartite graph with $|E|=O(|V|^2)$, a super-source and a super-sink. I am looking for the min-cost max-flow (the max-flow of all possible max-flows that has the minimum cost). For the sake of my question, denote $n=|E|$. Are there algorithms that will run in $O(n^2)$, or even $O(n\log(n))$, or for that ...
null
The reverse direction is relatively straight forward, as we start with disjoint vertices, and at each step only add edges to a *new* vertex, we cannot introduce a cycle, furthermore at each step we connect the "graph so far", so we finish with a connected graph. For the forward direction, we just need to consider ho...
Let the input alphabet be $\Sigma = \{a,b,c\}$ and *L* be the language of all words in which all of the *a*’s come before all of the *b*’s and there are the same number of *a*’s as *b*'s and arbitrarily many *c*’s that can be in front, behind or among the *a*’s and *b*’s. Some words in *L* are: *abc ccacaabcccbccbc* ...
I know that we can visualize a Non deterministic TM as a TM which splits into multiple copies of itself whenever it sees a non deterministic path (Yes, I also know that this is just a visualization and is usually used by beginners like me for understanding non determistisism). Further, I also know that a Decider is...
Visualizing a Non Deterministic Decider
|turing-machines|undecidability|nondeterminism|
Let the input alphabet be $\Sigma = \{a,b,c\}$ and *L* be the language of all words in which all of the *a*’s come before all of the *b*’s and there are the same number of *a*’s as *b*'s and arbitrarily many *c*’s that can be in front, behind or among the *a*’s and *b*’s. Some words in *L* are: *abc ccacaabcccbccbc* ...
Your diagram looks like you have the correct answer. Just for comparison:![enter image description here][1] Somewhat overannotated, but I don't think I've missed anything. As best I can tell, your diagram expresses the same idea. [1]: https://i.stack.imgur.com/eK4Xl.jpg
Perhaps this diagram will explain in a clear manner![enter image description here][1] [1]: https://i.stack.imgur.com/E5Cwm.jpg Simply put, <pre> When you start, put a $ symbol as starting marker. Now, if you see c dont do anything. If you see a put a symbol into your stack. Go on doing this till you se...
For a nondeterministic decider the answer is *At-least one "copy" halts on a "yes" state*; copy-paste from another answer: 1. for a Nondeterministic Turing machine (NDTM) there can be infinite computations, one for each possible non-deterministic transition; some of them will halt on the accept state $q_Y$, some wil...
For a nondeterministic decider the answer is *At-least one "copy" halts on a "yes" state*; copy-paste from another answer: 1. for a Nondeterministic Turing machine (NDTM) processing an input $x$ there can be infinite computations (paths); some of them will halt on the accept state $q_Y$, some will halt on the reject...
For a nondeterministic decider the answer is *At-least one "copy" halts on a "yes" state*; copy-paste from another answer: 1. for a Nondeterministic Turing machine (NDTM) processing an input $x$ there can be infinite computations (paths); some of them will halt on the accept state $q_Y$, some will halt on the reject...
Recipe in shorthand. Ignore $c$'s. Use a bottom fo stack symbol $Z$ that stays there. Keep the surplus of $a$'s on the stack. So $ZAAA$ (top of stack right) means three $a$'s more than $b$'s. If we read another $a$ push $A$, if we read another $b$ pop an $A$ (and move to another state to indicate we have now seen $b$)....
Ok, it's way past my bedtime, but this won't let me go, so here's a second try (deleted my first)... Before going into the specifics of how to sort the numbers, I will start by representing them not as a sequence of integers $i_1, i_2, \dots , i_n$, but as a sequence of their differences, i.e. $\delta_k = i_k - i_{k...
For a nondeterministic decider the answer is *At-least one "copy" halts on a "yes" state*; copy-paste from another answer: 1. for a Nondeterministic Turing machine (NDTM) processing an input $x$ there can be infinite computations (paths); some of them will halt on the accept state $q_Y$, some will halt on the reject...
null
|algorithms|terminology|recursion|induction|
I will preface my question with the definition of a simple tree that applies to my question: > A simple tree is an undirected and connected graph with no cycles. I am having difficulty coming up with a compelling argument that a tree of the above definition can be constructed by taking a set of disjoint valid gra...
|graphs|trees|
Ok, it's way past my bedtime, but this won't let me go, so here's a second try (deleted my first)... Before going into the specifics of how to sort the numbers, I will start by representing them not as a sequence of integers $i_1, i_2, \dots , i_n$, but as a sequence of their differences, i.e. $\delta_k = i_k - i_{k...
A threshold gate implementing a linear threshold function on $n$ boolean inputs $x_1, x_2 \ldots, x_n$ is given by the equation: $w_1 x_1 + w_2 x_2 + \ldots, w_n x_n \ge t$ where $w_1, \ldots, w_n, t \in \mathbb{R}$. The $w_i$'s are called the weights of the threshold function and $t$ is called the threshold, and nat...
Assumption on weights in threshold circuits
|complexity-theory|circuits|
To me it mostly is a question of viewpoint. If I define objects based on smaller one, I do it inductively, so that is bottom-up. If I solve a problem by breaking it down in smaller pieces that are solved in the same manner I call it recursion, that is top-down.
Doing the following exercise: > Let $\overline{HALT(x,y)}$ be defined as >$\overline {HALT(x,y)} \iff \text{program number y never halts on input x}$ > Show that it is not computable. Just want to make sure I have understood the concept correctly. We had in a theorem that HALT(x,y) is not computable which ...