instruction
stringlengths
0
29.8k
⌀
Here is a simple trial. Let $g: \{0,1\}^{i(n)} \to \{0,1\}^{o(n)}$ with $i(n) \ne o(n)$ be a one way function. We can assume that $g(x)$ ends with 1 for all $x$ as $p(x) = g(x)||1$ otherwise has this property. Define $$g'(x) = g(x)||0^{o(n) - |g(x)|}$$ this function always has $|g'(x)| = o(n)$. and is trivi...
**Edit: My initial solution contained a false assumption. *** See [the proof here][1]. [1]: http://my.safaribooksonline.com/book/software-engineering-and-development/cryptography/9780511031601/2dot2dot3dot-two-useful-length-conventions/2232_lengthregular_and_lengthp#X2ludGVybmFsX0J2ZGVwRmxhc2hSZWFkZXI/eG1saWQ9...
In response to Shaull's comment above : ![enter image description here][1] ![enter image description here][2] The first one is an image of 1-counter accepting $a^ib^j$ s.t. $j<i$ The secong one is an image of 1-counter accepting $a^ib^j$ s.t. $j>i,\ j<2i$ The third one is an image of 1-counter accepting $a^i...
{"Voters":[{"Id":472,"DisplayName":"Juho"},{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":6716,"DisplayName":"frafl"},{"Id":4249,"DisplayName":"Pål GD"},{"Id":169,"DisplayName":"uli"}]}
Let $P$ be the set of people and $\mathcal{S}$ be the modified multi-set of subsets. By checking if an $\mathcal{S}$-saturated matching into $P$ exists (i.e. [Hall's condition](http://en.wikipedia.org/wiki/Hall's_marriage_theorem)) you are indeed finding a diverse group. If you are checking that some group $P$ is a...
Length-preserving one-way functions
Let $P$ be the set of people and $\mathcal{S}$ be the modified multi-set of subsets. By checking if an $\mathcal{S}$-saturated matching into $P$ exists (i.e. [Hall's condition](http://en.wikipedia.org/wiki/Hall's_marriage_theorem)) you are indeed finding a diverse group. If you are checking that some group $P$ is a put...
Sudoku is well known puzzle which is known to be NP-complete and it is a special case of more general problem known as Latin squares. A correct solution of the $N \times N$ square consists of filling every row and every column with numbers from $1$ to $N$ under the condition that every number appears exactly once in an...
How hard is a variant of Sudoku puzzle?
|complexity-theory|np-complete|
null
Sudoku is well known puzzle which is known to be NP-complete and it is a special case of more general problem known as Latin squares. A correct solution of the $N \times N$ square consists of filling every row and every column with numbers from $1$ to $N$ under the condition that every number appears exactly once in an...
Cache memory levels are inherently a "subdivision" of main memory (RAM). To speed up the access of RAM, the cache was created using the notion of "The Principle of Locality". Frequently in programs, memory is accessed in locations that are close (local) to previously accessed locations, so it benefits to keep sections ...
A class of languages $\mathcal{C}$ is *closed under countable union* (*cucu*) if for all series of languages in $\mathcal{C}$ ($(L_i)_{i\in\mathbb{N}} \in \mathcal{C}^\mathbb{N}$) the language $\bigcup_{i\in\mathbb{N}}L_i = \{x\mid \exists i\in\mathbb{N}: x \in L_i\}$ is an element of $\mathcal{C}$. As we know most ...
Is the union of two classes of decidable languages closed under countable union also closed under countable union?
|formal-languages|sets|
The answer to (1) is yes. Suppose that $S \subseteq \mathcal{C} \cup \mathcal{C}'$ is countable, and let $T = S \cap \mathcal{C}$, $T' = S \cap \mathcal{C}'$. Suppose both $T$ and $T'$ are infinite. By assumption $L = \bigcup T \in \mathcal{C}$, $L' = \bigcup T' \in \mathcal{C}'$. Since $L,L'$ are decidable, $L \cup L'...
A class of languages $\mathcal{C}$ is *closed under countable union* (*cucu*) if for all series of languages in $\mathcal{C}$ ($(L_i)_{i\in\mathbb{N}} \in \mathcal{C}^\mathbb{N}$) the language $\bigcup_{i\in\mathbb{N}}L_i = \{x\mid \exists i\in\mathbb{N}: x \in L_i\}$ is an element of $\mathcal{C}$. As we know most ...
The answer to (1) is **no**: Given $L \in \mathcal{C} = \{n\text{-}\mathrm{SAT}\mid n\in\mathbb{N}\}$ and $L' \in \mathcal{C'} = \{n\text{-}\mathrm{UNSAT}\mid n\in\mathbb{N}\}$ the union $L\cup L'$ does contain satisfiable and unsatisfiable formulas, which non of the languages in $\mathcal{C}\cup\mathcal{C'}$ does. ...
this question has a lot to do with very recent trends in computing that favor a massive shift to mobile and tablet computing, thereby favoring RISC cpus, and has caught Intel (probably worlds largest CISC purveyor) at a disadvantage in a so-called ["inflection point"](http://en.wikipedia.org/wiki/Inflection_point) exac...
The trick here is to get rid of the sum. Note that the sum is up and down, it can be replaced by twice up: $$ \begin{align*} (n + 1) T(n + 1) &= 2 \sum_{1 \le k \le n} T(k) + c (n + 1)^2 \\ n T(n) &= 2 \sum_{1 \le k \le n - 1} T(k) + c n^2 \\ (n + 1) T(n + 1) - n T(n) &= 2 T(n) + c (2 n + 1) \end{...
The solution in the question is correct. The constraint $i\ne j$ is the one that gives us trouble. To get around it we have to split into two cases: (i) $i<j$, and (ii) $i>j$ (but still $i<2j$) thus $S\to S_{(i)} \mid S_{(ii)}$ as the first production splits into this two cases. Now, divide and conquer...
|complexity-theory|cryptography|one-way-functions|
The trick here is to get rid of the sum. Note that the sum is up and down, it can be replaced by twice up: $$ \begin{align*} (n + 1) T(n + 1) &= 2 \sum_{1 \le k \le n} T(k) + c (n + 1)^2 \\ n T(n) &= 2 \sum_{1 \le k \le n - 1} T(k) + c n^2 \\ (n + 1) T(n + 1) - n T(n) &= 2 T(n) + c (2 n + 1) \end{...
If you are writing a parser, this kind of stuff is handled by the lexical analyzer. And there you can express this by regular expressions, or (as the [`flex`][1] examples I've seen show) just "escape into the underlying language" and finish off the job there. I.e., on seeing `/*` just skip ahead until you find `*/` (a ...
Look at the assumptions, specifically that no process stays in the critical section indefinitely (that certainly includes just going away). I don't think there is a way to solve that general problem with any synchronization mechanism. This solution is also _only_ for two processes, there are solutions for $n$ proces...
null
The answer to (3) is yes. Suppose that $S \subseteq \mathcal{C} \cup \mathcal{C}'$. Then $S$ is countable, because $\mathcal{C}\cup\mathcal{C'}$ contains only decidable languages of which there are only countable many. Now let $T = S \cap \mathcal{C}$, $T' = S \cap \mathcal{C}'$. By assumption $L = \bigcup T \in \mathc...
null
Inspired by [this question][1] in which the asker wants to know if the running time changes when the comparator used in a standard search algorithm is replaced by a fair coin-flip, and also [Microsoft's][2] prominent failure to write a uniform permutation generator, my question is thus: Is there a comparison based s...
Is there a "sorting" algorithm which returns a random permutation when using a coin-flip comparator?
|sorting|randomized-algorithms|permutations|
The answer to (1) is **no**: Given $L \in \mathcal{C} = \{n\text{-}\mathrm{SAT}\mid n\in\mathbb{N}\}$ and $L' \in \mathcal{C'} = \{n\text{-}\mathrm{UNSAT}\mid n\in\mathbb{N}\}$ the union $L\cup L'$ does contain satisfiable and unsatisfiable formulas, which non of the languages in $\mathcal{C}\cup\mathcal{C'}$ do. ...
$\newcommand{\L}{\text{L}}\newcommand{\P}{\text{Pr}}\newcommand{\E}{\text{E}}$This answer is based on the scenario described in your 2nd link. Recall the definition of likelihood: $$\L[\theta | X] = \P[X| \theta] = \sum_Z \P[X, Z | \theta]$$where $\theta = (\theta_A, \theta_B)$ are the estimators for the probabilit...
$\newcommand{\L}{\text{L}}\newcommand{\P}{\text{Pr}}\newcommand{\E}{\text{E}}$This answer is based on the scenario described in your 2nd link. Recall the definition of likelihood: $$\L[\theta | X] = \P[X| \theta] = \sum_Z \P[X, Z | \theta]$$where $\theta = (\theta_A, \theta_B)$ are the estimators for the probabilit...
The following deterministic (without the comparator) algorithm works: 1. Do the [Fisher-Yates shuffle][1] using your comparator as a coin flip. 2. Try a single pair $n$ times, where $n$ is the length or your input. 3. If all comparisons have the same result, sort your array using merge sort. Given a determin...
$\newcommand{\L}{\text{L}}\newcommand{\P}{\text{Pr}}\newcommand{\E}{\text{E}}$This answer is based on the scenario described in your 2nd link. Recall the definition of likelihood: $$\L[\theta | X] = \P[X| \theta] = \sum_Z \P[X, Z | \theta]$$where $\theta = (\theta_A, \theta_B)$ are the estimators for the probabilit...
$\newcommand{\L}{\text{L}}\newcommand{\P}{\text{Pr}}\newcommand{\E}{\text{E}}$This answer is based on the scenario described in your 2nd link. Recall the definition of likelihood: $$\L[\theta | X] = \P[X| \theta] = \sum_Z \P[X, Z | \theta]$$where $\theta = (\theta_A, \theta_B)$ are the estimators for the probabilit...
This is true in general, in a way. Consider a regex $r$. You can construct a DFA (or NFA) for the matching problem. Denote this NFA by $A$. To solve the searching problem, you can proceed in several ways. First, you can just solve the matching problem for the regex $\Sigma^*\cdot r\cdot \Sigma^*$. Alternatively...
Your approach will work. There are no hard and fast rules in micro-op scheduling. The number of micro-ops that can be executed in parallel depends on the internal organization of the CPU. Clearly, we cannot reload the program counter (PC) until we save its contents, but there is nothing stopping us from saving its co...
Well these patterns will make KMP work faster: T=aaaaaaaaaa P=aaaa KMP will try 10 compare steps were Boyer-Moore will take 28 Another example: T=aaaaaaaaaa P=abab KMP will try 8 compare steps where BM will try 12.
null
Recently ACM held Ubiquity symposium '[What is Computation?][1]' in which Peter Wegner published an article which reflects his views on Interactive computing. Here are two excerpts from the article by Peter Wegner: >One new concept, missing from early Turing machines, is "Interactive Computing," which accommodat...
null
I am a beginner in data structures and recently came across a vector implemented on an array, which is extended on demand. Of course the table cannot be extended "in place", we must allocate a new array, then copy elements from the previous one which is a linear operation itself (invoked log(n) times, where n is the nu...
A vector-like data structure with allocation table; O(1) indexing time required
|data-structures|
The following deterministic (without the comparator) algorithm works: 1. Do the [Fisher-Yates shuffle][1] using your comparator as a coin flip. 2. (optional speedup: Try a single pair $n$ times, where $n$ is the length or your input.) 3. If all comparisons have the same result, sort your array using merge sort....
The indexing time is always O(1) for an array whether you reallocate or not! Reallocating is not a bad idea if the table size doubles each time the array overflows, insertion takes constant time amortized. Your idea is no different from a linked list of arrays of fixed size (correct if I'm wrong). If the list gets r...
I have the following language $\qquad \{0^i 1^j 2^k \mid 0 \leq i \leq j \leq k\}$ I am trying to determine which Chomsky language class it fits into. I can see how it could be made using a context-sensitive grammar so I know it is atleast context-sensitive. It seems like it wouldn't be possible to make with a co...
When dealing with the analysis of time and space complexity of algorithms, is it safe to assume that any function which has tight bounds ( i.e. $f(n)=\Theta(g(n))$ is asymptotically positive and asymptotically monotonically increasing. I mean that for all $n$ greater than or equal to some $n_0$ both those properties h...
Asymptotic Properties of Functions in Complexity Analysis
|time-complexity|asymptotics|landau-notation|
The following deterministic (without the comparator) algorithm works: 1. Do the [Fisher-Yates shuffle][1] using your comparator as a coin flip. 2. (optional speedup: Try a single pair $n$ times, where $n$ is the length or your input. If any two of the outputs differ return the permutation obtained in (1)) 3. So...
How to improve the worst case scenario for a depth first search on an Euler graph, starting at some point and ending at that same point? I need to do the whole search but it is not fast enough for large amounts of data. I have tried [bidirectional search](https://en.wikipedia.org/wiki/Bidirectional_search) but I can...
Improve worst case time of depth first search on Euler graphs
$\newcommand{\L}{\text{L}}\newcommand{\P}{\text{Pr}}\newcommand{\E}{\text{E}}$This answer is based on the scenario described in your 2nd link. Recall the definition of likelihood: $$\L[\theta | X] = \P[X| \theta] = \sum_Z \P[X, Z | \theta]$$where in our case $\theta = (\theta_A, \theta_B)$ are the estimators for th...
It is safe to assume that $f$ is everywhere positive, hence, asymptotically positive. You can't use negative time or space. It is not safe to assume that $f$ is asymptotically monotonically increasing, since this excludes constant functions, i.e., those which are $\Theta(1)$. It isn't even safe to assume that $f$...
|computer-architecture|memory-hardware|
I do not know where the posters who are complaining about flip-flops not being computer science (CS) attended school, but I covered this material as an undergraduate computer science. Computer science is a huge field that is engineering one end of the spectrum and applied mathematics on the other end. A flip-flop...
|formal-languages|closure-properties|
Does closure against countable union survive union of classes?
|computability|computation-models|
I do not know where the posters who are complaining about flip-flops not being computer science (CS) attended school, but I covered this material as an undergraduate computer science. Computer science is a huge field that is engineering one end of the spectrum and applied mathematics on the other end. A flip-flop...
|data-structures|efficiency|arrays|
I do not know where the posters who are complaining about flip-flops not being computer science attended school, but I covered this material as an undergraduate computer science student. Computer science is a huge field that is engineering one end of the spectrum and applied mathematics on the other end. A flip-f...
No. There are complexity functions that oscillate, for example [runtime of Mergesort](http://cs.stackexchange.com/questions/2374/how-to-describe-algorithms-prove-and-analyse-them/2390#2390). It is not even true that every meaningful complexity function is in $\Theta$ of a monotonically increasing function; see [this...
Let $g$ be a one way function. Since $g$ is PPT computable by assumption, there is a polynomial $p$ s.t $|f(x)| \le p(|x|)$ for all $x$ Define $$g'(x) = g(x)||10^{p(|x|) - |g(x)|}$$ this function always has $|g'(x)| = p(|x|)$. and is trivially one way We now have to force $|x| = |f(x)|$. This we can do by ...
Let $g$ be a strong one way function. Since $g$ is PPT computable by assumption, there is a polynomial $p$ s.t $|f(x)| \le p(|x|)$ for all $x$ Define $$g'(x) = g(x)||10^{p(|x|) - |g(x)|}$$ this function always has $|g'(x)| = p(|x|)$. and is trivially one way We now have to force $|x| = |f(x)|$. This we can...
Wlog let $g$ be a strong one way function. Since $g$ is PPT computable by assumption, there is a polynomial $p$ s.t $|f(x)| \le p(|x|)$ for all $x$ Define $$g'(x) = g(x)||10^{p(|x|) - |g(x)|}$$ this function always has $|g'(x)| = p(|x|)$. and is trivially strongly one way. We now have to force $|x| = |f(x)|$....
null
A flip-flop is implemented as a bi-stable multivibrator; therefore, Q and Q' are guaranteed to be the inverse of each other. A flip-flop always has a state before signals are applied to S and R. The excitation tables are helpful in understanding what occurs when signals are applied to the inputs of an SR flip-flop. ...
A flip-flop is implemented as a bi-stable multivibrator; therefore, Q and Q' are guaranteed to be the inverse of each other. A flip-flop always has a state before signals are applied to S and R. The excitation table for the RS flip-flop is helpful in understanding what occurs when signals are applied to the inputs of ...
A flip-flop is implemented as a bi-stable multivibrator; therefore, Q and Q' are guaranteed to be the inverse of each other. The excitation table for the RS flip-flop is helpful in understanding what occurs when signals are applied to the inputs of an SR flip-flop. S R Q(t) Q(t+1) ---------------- ...
A flip-flop is implemented as a bi-stable multivibrator; therefore, Q and Q' are guaranteed to be the inverse of each other. The excitation table for the RS flip-flop is helpful in understanding what occurs when signals are applied to the inputs. S R Q(t) Q(t+1) ---------------- 0 x 0 0 ...
No, this is impossible unless $n \leq 2$. The probability that a permutation is generated by your algorithm using a random comparator is dyadic, i.e. of the form $A/2^B$, whereas the probability should be $1/n!$. When $n > 2$, there is no way to write $1/n!$ in the form $A/2^B$.
Here is an elaboration of your approach. Every $m$ iterations, we use the FFT algorithm to compute $m$ values of the convolution in time $O(n\log n)$, assuming that the subsequent $m$ values are zero. In other words, we are computing $$ \sum_{i=0}^{n-1} w_i a_{t-i+k}, \quad 0 \leq k \leq m-1, $$ where $w_i$ are the...
The answer is always YES. Suppose the matrix has size $N\times N$. Consider a random permutation of the columns. Each row (by itself) is a random permutation. The probability that the numbers $i,i+1,i+2$ appear in positions $t,t+1,t+2$ is $1/(N(N-1)(N-2))$. There are $N-2$ choices for $t$ and $i$, and $N$ different ...
If the matrices are stored in the usual way, that is as long vectors, then the complexity is $\Theta(n^2)$. The reason is that if all the off-diagonal entries in the matrix are different, you will need to change all of them, and there are $n^2-n$ of them.
An important aspect that no one has brought up thus is that almost all CISC CPUs are microcoded architectures. A microsequencer and a control store consume far less real estate than a hardwired controller, and the instruction set can be modified without modifying the hardware. Microprocessors were novelty devices wh...
One standard measure is the [Kendall tau distance][1], which is the number of "inversions", i.e. positions $i < j$ such that $\pi(i) > \pi(j)$. It is also the number of transpositions $(k \; k+1)$ you need to apply to sort $\pi$, or vice versa, the number of such transpositions needed to generate $\pi$. (So it's the di...
null
Here is an elaboration of your approach. Every $m$ iterations, we use the FFT algorithm to compute $m$ values of the convolution in time $O(n\log n)$, assuming that the subsequent $m$ values are zero. In other words, we are computing $$ \sum_{i=0}^{n-1} w_i a_{t-i+k}, \quad 0 \leq k \leq m-1, $$ where $w_i$ are the...
Why is {$x \in L \mid x = x^R $} context-free if $L$ is a regular language? Trying to understand the approach to determining whether a regular language is context-free
Why is {$x \in L \mid x = x^R $} context-free if $L$ is a regular language?
|regular-languages|context-free|
Sudoku is well known puzzle which is known to be NP-complete and it is a special case of more general problem known as Latin squares. A correct solution of the $N \times N$ square consists of filling every row and every column with numbers from $1$ to $N$ under the condition that every number appears exactly once in an...
(This answer uses the second link you gave.) $\newcommand{\Like}{\text{L}}\newcommand{\E}{\text{E}}$Recall the definition of likelihood: $$\Like[\theta | X] = \Pr[X| \theta] = \sum_Z \Pr[X, Z | \theta]$$ where in our case $\theta = (\theta_A, \theta_B)$ are the estimators for the probability that coins A and B res...
When the row and column permutations are different and the consecutive triples have to be increasing: The answer is always YES. Suppose the matrix has size $N\times N$. Consider a random permutation of the columns. Each row (by itself) is a random permutation. The probability that the numbers $i,i+1,i+2$ appear in p...
Hint: The intersection of a context-free language with a regular language is still context-free.
Weighted sum of last N numbers
I work in mathematics mainly and have only a bit of familiarity with this type of problem. However, set theory is one of my favorite areas of study, and this seems to be a set theory question. So, to begin with, both P and NP are countably infinite as others have pointed out before. So, it does not make sense to dis...
Regular language is always context-free (but not vice-versa). The language you as for (call it $A$) is based on a regular language $L$, but need not be regular. To show that $A$ (or any other language) is context free, you need to come up with either a context-free grammar that generates $A$, or a PDA that accepts $...
null
Regular language is always context-free (but not vice-versa). The language you as for (call it $A$) is based on a regular language $L$, but need not be regular. To show that $A$ (or any other language) is context free, you need to come up with either a context-free grammar that generates $A$, or a PDA that accepts $...
Public-key cryptography as we know it today are built on [one-way](http://en.wikipedia.org/wiki/One-way_function) [*trapdoor*](http://en.wikipedia.org/wiki/Trapdoor_one-way_function) permutations, and the trapdoor is essential. For a protocol to be publicly secure, you need a key available to anyone, and a way to en...
There is a land divided to D districts. There are C citizens. We want to divide the land to the citizens, such that each citizen receives a single land-plot in a single district. Each citizen prefers certain districts, however, the preference also depends on the size of plot. For example, Johnny prefers a plot...
minimal-envy land division
|reference-request|game-theory|
This is inspired by an interview question. You are given an array of integers $a_1, \dots, a_n$ We have to determine if there are distinct $i \lt j \lt k$ such that - $a_k - a_j = a_j - a_i$ - $k - j = j - i$ i.e, the sequences $\{a_i, a_j, a_k\}$ and $\{i,j,k\}$ are both in arithmetic progression. ...