instruction stringlengths 0 29.8k ⌀ |
|---|
A starting point for this would be the heap management algorithms, start perhaps [here][1]. I remember Knuth in his Art of Computer Programming has a detailed discussion, I believe in volume 1. The algorithms described are good for RAM, adding in the non-uniform access of rotating disks will be quite a challenge...
... |
null |
I'm reading my textbook and it claims that the regular expression $c^*(b \cup (ac)^*)^*$ defines the language $L$ over $\{a,b,c\}$ which consists of **all** strings that do not contain the substring $bc$.
However, I'm failing to see how that language would contain strings such as $bbbaaa$ or $aaabbb$. Am I missing ... |
Does $c^*(b \cup (ac)^*)^*$ define strings over $\{a,b,c\}$ that don't contain $bc$ |
|regular-languages|regular-expressions| |
Does $c^*(b \cup (ac)^*)^*$ define all strings over $\{a,b,c\}$ that don't contain the substring $bc$ |
null |
The way the question is asked you should come up with an **upper bound** and a **lower bound** on the space complexity.
The first part is usually done by presenting an algorithm for your problem but a reduction **to** some other well studied problem would also work (and indirectly yield an algorithm, too). Since you... |
null |
hi i have question about stack program but i cant solve it
Write a stack program to evaluate the following equation
X=(((A+B)-(A*B))*C)/(((A-B-C))⁄2)
can any body help me ? |
how i solve the stack program equation? |
|stack| |
Suppose we are given $n$ variables $X_i, i=1,\dots,n$, each taking values from $\{0,1\}$, and a constant integer $k$ with $ 0\leq k \leq n$.
What are some efficient ways to enumerate all possible combinations of values of $X_i$'s subject to the constraint $\sum_{i=1}^n X_i = k$?
A naive way is to first enumerate ... |
How to enumerate all combinations of $n$ $\{0,1\}$-valued variables s.t. their sum is $k$? |
|algorithms| |
|data-structures|stack| |
Stan has two pure strategies for each type of card. Since there are three types of cards (Texas Holdem), in total he has $2\times 2\times 2 = 8$ strategies. Here is a list of them:
* Always stay.
* Always raise.
* Stay only if H.
* Stay only if M.
* Stay only if L.
* Raise only if H.
* Raise only if M.
* Rais... |
null |
In many papers I've read that it is well known that the Shannon entropy of a random variable can be converted to min-entropy (up to small statistical distance) by taking independent copies of the variable.
Can anyone explain to me what exactly this means?
|
Shanno Entropy to Min-Entropy |
|complexity-theory|cryptography| |
Shannon Entropy to Min-Entropy |
I am supposed to write a Context free grammar that generates the language:
$\qquad L(G) = \{0^{3n}1^{2n}0^{m}1^{m} : n \ge 1, m \ge 1\}$
I have the rules:
$$S \rightarrow 000S$$
$$S \rightarrow S11T$$
$$T \rightarrow 0T$$
$$T \rightarrow T1$$
This looks correct in terms of the structure of the grammar bu... |
|computability|finite-automata| |
|formal-languages|regular-languages|regular-expressions|parsers| |
I have to implement a limitation algorithm in order to avoid to reach a throughput limit imposed by the service I'm interacting with.
The limit is specified as «N request over 1 day» where N is of the order of magnitude of 10^6.
I have a distributed system of clients interacting with the service so they should sh... |
Throughput measure |
|optimization| |
Here is how you can make sure there is a mistake in the book:
1. Use the algorithm from the book to transform the regular expression into an NFA.
2. Optional: determinise the automaton, using the algorithm from the book.
3. Run your example through the automaton and note whether it accepts.
Provided you foll... |
|formal-languages|regular-languages|regular-expressions| |
|algorithms|combinatorics|enumeration| |
Suppose we are given $n$ variables $X_i, i=1,\dots,n$, each taking values from $\{0,1\}$, and a constant integer $k$ with $ 0\leq k \leq n$.
What are some efficient ways to enumerate all possible combinations of values of $X_i$'s subject to the constraint $\sum_{i=1}^n X_i = k$?
A naive way is to first enumerate ... |
How to enumerate all combinations of $n$ binary variables s.t. their sum is $k$? |
I have been given a question about a stack program which I can not solve.
> Write a stack program to evaluate the term
> $\qquad (((A+B)-(A*B))*C)/(((A-B-C))⁄2)$
How do I approach this problem? |
How to write stack programs for arithmetic terms? |
|programming-languages| |
null |
If I translate your description properly, here is what you want to ask:
> Given two regular language $A$, $B$, is there a prefix of a word in $B$ that is a suffix of a word in $A$?
Formally:
> Given regular $A$ and $B$, is there $w \sqsubseteq b \in B$ so that $w \sqsupseteq a \in A$?
Deciding this boils do... |
I checked an older edition of Sudkamp, and it had the same example. Actually the expression is $c^*(b\cup ac^*)^*$, which has a different bracketing.
Your $(ac)^*$ specifies strings of the form $acac\dots ac$, whereas Sudkamp has $ac^*$ which means strings like $acc\dots c$.
It follows the arguments of the answer b... |
If I translate your description properly, here is what you want to ask:
> Given two regular language $A$, $B$, is there a prefix of a word in $B$ that is a suffix of a word in $A$?
Formally:
> Given regular $A$ and $B$, is there $w \sqsubseteq b \in B$ so that $w \sqsupseteq a \in A$?
Deciding this boils do... |
If I translate your description properly, here is what you want to ask:
> Given two regular language $A$, $B$, is there a prefix of a word $b$ in $B$ that is a suffix of a word in $A$ so that the rest of $b$ is a prefix of another word in $B$?
Formally:
> Given regular $A$ and $B$, are there $a = wx \in A$ and... |
Here is how you can make sure there is a mistake in the book:
1. Use the algorithm from the book to transform the regular expression into an NFA.
2. Optional: determinise the automaton, using the algorithm from the book.
3. Run your example through the automaton and note whether it accepts.
Provided you foll... |
First, separate the set of variables $I = \{1,\dots,n\}$ according to their values:
$\qquad\begin{align}
I_+ &= \{ i \mid X_i = 1\} \text{ and} \\
I_- &= \{ i \mid X_i = 0\} \;.
\end{align}$
Let $n_+ = |I_+|$ and $n_- = |I_-|$.
Given $X_1, \dots, X_n$ and $k$, it is clear that we have to choose $k$ indi... |
Given $n$ jobs $J_1,J_2,...,J_n$, each job requires $T_i > 0, T_i \in N$ time to complete.
Each job must be pre-processed and post-processed by a single machine M that can handle only *1 job at a time* and both phases require 1 unit of time. After being pre-processed, job $J_i$ is sent to a machine with unlimited ... |
Job scheduling with a bottleneck problem |
|reference-request|scheduling| |
what you want to do is either first translate the expression into something that is easier for a stack machine to handle (like reverse polish)
the other is to use a modified [shunting yard algorithm](http://en.wikipedia.org/wiki/Shunting_yard_algorithm) which can handle parenthesis
you have 2 stacks: a result st... |
|optimization|distributed-systems|approximation| |
|terminology|probability-theory|entropy| |
|complexity-theory|reference-request|scheduling| |
What you want to do is; either first translate the expression into something that is easier for a stack machine to handle (like reverse polish).
The other is to use a modified [shunting yard algorithm](http://en.wikipedia.org/wiki/Shunting_yard_algorithm) which can handle parenthesis.
You have 2 stacks: a result ... |
There's has been some work in Computational Linguistics on 'regular approximations' of context-free grammars -- converting CFGs into roughly equivalent regular grammars. A lot of this revolves the notion of a 'strongly-regular-grammar', this is a CFG that doesn't have self-embedding rules, such as A --> alpha A beta (... |
Given $n$ jobs $J_1,J_2,...,J_n$, each job requires $T_i > 0, T_i \in N$ time to complete.
Each job must be pre-processed and post-processed by a single machine M that can handle only *1 job at a time* and both phases require 1 unit of time. After being pre-processed, job $J_i$ is sent to a machine with unlimited po... |
This looks like a minor variation of the so called *master-slave scheduling model* introduced by [Sahni][1]. In particular, your problem falls under the Single-Master Master-Slave Systems. You can distinguish several cases:
1) If you do not add any additional constraint on the order of job execution (as in your case... |
This looks like the so called *master-slave scheduling model* introduced by [Sahni][1]. In particular, your problem falls under the Single-Master Master-Slave Systems. You can distinguish several cases:
1) If you do not add any additional constraint on the order of job execution (as in your case), the problem is cal... |
I was looking at the pumping lemma for CFG. I came across the first problem $a^nb^nc^n$ and understood the answer. Then I thought of the problem $a^nb^n$. I know that this is context free and thought of applying it. I came across a weired situation. Someone please tell me where I went wrong.
So our language is $a^n... |
Pumping lemma for CFG doubt |
|context-free|automata|pumping-lemma| |
null |
It's wrong to take $u$ to be $\epsilon$. Pumping lemma for regular languages says that the substring to pump will be somewhere near the beginning of the string. Pumping lemma for context free languages says no such thing. In general, neither pumping lemma lets you make many assumptions about what to pump. In the case o... |
There's has been some work in Computational Linguistics on 'regular approximations' of context-free grammars -- converting CFGs into roughly equivalent regular grammars. A lot of this revolves the notion of a 'strongly-regular-grammar', this is a CFG that doesn't have self-embedding rules, such as A --> alpha A beta (... |
null |
null |
I could find that different texts follow different steps in the conversion of CFG to Chomsky Normal Form. I couldn't find any presumptions they made in the conversion steps. I have some questions regarding the conversion.
1. Most text books tell us about only two rules $A \rightarrow BC$ and $A \rightarrow a$. But s... |
CFG to CNF conversion steps |
|context-free|automata| |
If the number of citizens is large enough, such that the effect of one citizen changing his/her selection is negligible, then an envy-free division is equal to a Nash equilibrium in a [congestion game](http://en.wikipedia.org/wiki/Congestion_game).
Specifically, [Igal Milchtaich's papers](http://faculty.biu.ac.il/~m... |
I have two regular languages *A* and *B*, and I want to determine whether there is any pair of strings, *a* in *A* and *b* in *B*, such that (*a* *b*) is a prefix of a string in (*A* *B*) and the left-most match of *B* in (*a* *b*) includes one or more characters from *a*.
Raphael's formulation is g... |
I am interested in procedures for fair division of land (i.e. envy-free division, or at least proportional division).
In contrast to the well-studied cake-division problem, land-division is two-dimensional, i.e., the preferences of the users may vary both horizontally and vertically. Therefore, it is not practical t... |
Fair division of two-dimensional cake |
|reference-request|game-theory| |
null |
Earlier I asked the question: <a href="http://cs.stackexchange.com/questions/10848/can-a-turing-machine-decide-if-an-nfa-accepts-a-string-of-prime-length">Can a Turing Machine decide if an NFA accepts a string of prime length?</a>. The answer introduced me to Parikh's theorem, which I've been reading about. The concept... |
Can a Turing Machine decide if a regular expression matches all strings of exactly some length l >= 1? |
|computability|finite-automata|regular-expressions| |
I think this procedure should work...
First, construct a DFA for the language. Now, start tracing all possible paths of length $k$ (start with $k = 1$). Call $S_k$ the set of states reached by strings of length $k$.
If at any point you find $S_k \subseteq A$, the set of accepting states, the answer is yes, and re... |
Stan has two pure strategies for each type of card. Since there are three types of cards (H, M, L), in total he has $2\times 2\times 2 = 8$ strategies. Here is a list of them:
* Always stay.
* Always raise.
* Stay only if H.
* Stay only if M.
* Stay only if L.
* Raise only if H.
* Raise only if M.
* Raise onl... |
null |
This is a consequence of the [asymptotic equipartition property][1] (AEP), which is a form of the law of large numbers. The AEP states that if a random variable has (binary) entropy $H$ and you take $n$ copies of it, then most of the data points have probability roughly $2^{-nH}$. This is only true for most data points... |
null |
Here is a DFA from a research project. We created the DFA manually.
We are interested in which regex is this DFA corresponding to.
Certainly, there could be multiple regex corresponding to it; we prefer a simpler one.
![enter image description here][1]
[1]: https://i.stack.imgur.com/cV5V4.png |
What's the regex corresponding to this DFA? |
|regular-expressions| |
$$(00^*10^*1 ~~~ | ~~~ 10^*(10)^*110^*1)^*~~~10^*(10)^*110^*$$
This should be one representation. Not sure if it could be made simpler. The part from $($ to $|$ represents one lap in the upper cycle. The part from $|$ to $)$ represents a lap in the lower cycle. The last part represents the path from $A$ to $D$. |
null |
Given $n$ jobs $J_1,J_2,...,J_n$, each job requires $T_i > 0, T_i \in N$ time to complete.
Each job must be pre-processed and post-processed by a single machine M that can handle only *1 job at a time* and both phases require 1 unit of time. After being pre-processed, job $J_i$ is sent to a machine with unlimited po... |
Given $n$ jobs $J_1,J_2,...,J_n$, each job requires $T_i > 0, T_i \in N$ time to complete.
Each job must be pre-processed and post-processed by a single machine M that can handle only *1 job at a time* and both phases require 1 unit of time. After being pre-processed, job $J_i$ is sent to a machine with unlimited po... |
I have a hard time understanding the following lines from our lecture notes:
-------
$f \in \text{FP}$ iff there is a transducer T that computes $f$ and there exists a polynomial $p$ such that $TIME(T(x)) \leq p(|x|).$
Note: If $f \in \text{FP},$ then $|f(x)| \leq p(|x|)$ holds for a fixed polynomial $p.$
Exa... |
The complexity class FP |
|complexity-theory| |
Machine Learning:
modeling for static model and dynamic model
, System Identification:
focus on dynamic model or dynamic process |
Recall that Turing Machines are often defined to output only a yes/no answer. Transducers are used to extend this to a general output, which is sometimes more appropriate for a certain task (e.g. defining mapping-reductions).
When we use transducers, we can also analyze their runtime, and in this case they compute f... |
Given $n$ arrays of size $k$ each, we want to show that at least $\Omega(nk \log k)$ comparisons are needed to sort all arrays (indepentent of each other).
My proof is a simple modification of the decision tree argument used to obtain the lower bound for comparison-based sorting of one array. More specifically, I a... |
Lower bound for sorting n arrays of size k each |
|algorithms|sorting|arrays|lower-bounds|check-my-proof| |
Let $B = G(L, R, E)$ be a bipartite graph. I want to find out whether this graph has a perfect matching. One way to test whether this graph has a perfect matching is Hall's Marriage Theorem, but it is inefficient (i.e $|\mathcal P(L)| = 2^{|L|}$ tests -- not polynomial). I can always find out whether a perfect matching... |
Existence of bipartite perfect matching |
|graphs|bipartite-matching| |
Let $B = G(L, R, E)$ be a bipartite graph. I want to find out whether this graph has a perfect matching. One way to test whether this graph has a perfect matching is Hall's Marriage Theorem, but it is inefficient (i.e $|\mathcal P(L)| = 2^{|L|}$ tests -- not polynomial). I can always find out whether a perfect matching... |
Can a two-stack PDA accept language $L=${$a^nb^mc^nd^m \mid n \geq m$}, which has no context-free grammar?
I don't believe this has a context-free grammar, but please correct me if I'm wrong. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.