instruction stringlengths 0 29.8k ⌀ |
|---|
|databases|data-sets| |
How do we determine minimum $k$ such that $G$ is a strong $LL(k)$
Like for grammer $G$ with the following rules
$S\rightarrow aAcaa \mid bAbcc,A\rightarrow a \mid bb \mid \epsilon$ |
Determining minimum $k$ such that $G$ is a strong $LL(k)$ |
|context-free| |
How do we determine minimum $k$ such that $G$ is a strong $LL(k)$ Grammar
Like for grammer $G$ with the following rules
$S\rightarrow aAcaa \mid bAbcc,A\rightarrow a \mid bb \mid \epsilon$ |
Determining minimum $k$ such that $G$ is a strong $LL(k)$ grammar |
I think that the first thing to consider is what is a supported operation?
Does "inserting a value with a specific, fixed key" (e.g. for keys taken from the integer realm, inserting with key = 3) correspond to a supported operation for the min heap?
No, because that operation can be trivially implemented with m... |
null |
null |
Say I have a set of points on a 2d plane, how do I find the point(s) where the maximum euclidian distance to any of the points in the set is minimized? |
Find the point with minimum max distance to any point in a set |
|untagged| |
|computational-geometry| |
This is the smallest enclosing circle problem, and can be solved in linear time. Check wikipedia: http://en.wikipedia.org/wiki/Smallest-circle_problem. Also these slides describe a randomized algorithm that runs in expected linear time: http://www.cs.uu.nl/docs/vakken/ga/slides4b.pdf. |
This is the [smallest enclosing circle problem](http://en.wikipedia.org/wiki/Smallest-circle_problem), and can be solved in linear time. Also, [these slides](http://www.cs.uu.nl/docs/vakken/ga/slides4b.pdf) describe a randomized algorithm that runs in expected linear time. |
null |
This is a problem from the practice session of the Polish Collegiate Programming Contest 2012 (http://main.edu.pl/en/archive/amppz/2012/dzi). Although I could find the solutions for the main contest, I can't seem to find the solution for this problem anywhere.
The problem is: Given a set of $N$ distinct positive int... |
Minimal subset with GCD = 1 |
|algorithms| |
Given a set $S$ of $n$ elements, and a set $\mathcal{X}$ of $m$ subsets of $S$, decide if there exist $U,V \in \mathcal{X}$, s.t. $U \cup V = S$.
Brute force would take time $O(nm^2)$ but is there any way of solving this more efficiently? |
Test if there are two subsets which cover a set |
|algorithms|data-structures|sets| |
Let $value(x)$ be the result when the symbols of $x$ are multiplied from left to right according to
<p>$\qquad \displaystyle\begin{array}{c|ccc}
\times & a & b & c \\
\hline
a & a & a & c \\
b & c & a & b \\
c & b & c & a
\end{array}$</p>
<p> Is $L=\{xy|\mbox{ $|x|=|y|$ and value($x... |
Automata Doubt |
|regular-languages| |
Hint for (1): consider a different type of value, $\mathrm{value}(s) = 1$ if $s$ ends with $z$, and $\mathrm{value}(s) = 0$ otherwise. Define the language $L$ as in your case, and consider $L \cap x^* z y^* z$.
Hint for (2): consider the language $L_\alpha = \{xy : \mathrm{value}(x) = \mathrm{value}(y) = \alpha \}$.... |
null |
This is a problem from the practice session of the Polish Collegiate Programming Contest 2012 (http://main.edu.pl/en/archive/amppz/2012/dzi). Although I could find the solutions for the main contest, I can't seem to find the solution for this problem anywhere.
The problem is: Given a set of $N$ distinct positive int... |
|algorithms|number-theory| |
null |
null |
I have a undirected graph with no edge costs. A subset of the nodes are labeled $c_1, c_2, ..., c_k$ and one node is labeled $K$. I want to find the minimum cut of the graph with the extra condition that all nodes $c_i$ are in the same half of the cut and the node K is in the other cut.
My idea was to begin by doing... |
min-cut with extra condition |
|algorithms| |
In the past years, the interest in [(E)DSL](http://en.wikipedia.org/wiki/Domain-specific_language)s and [fluent interfaces](http://en.wikipedia.org/wiki/Fluent_interface) has been steadily on the rise, in a great variety of languages: Haskell, the various scripting languages, C#, Java, and even C++ (think of the overlo... |
Lookahead set: Determining minimum $k$ such that $G$ is a strong $LL(k)$ grammar |
If $L$ is a binary language ($\Sigma =(0,1)^∗$) and $\overline{L}$ is the complement of $L$, the set of binary strings not in $L$.
How can I show that, if $L$ is in the complexity class $P$, then so is $\overline{L}$? |
Show complement of language in same complexity class? |
|complexity-theory|formal-languages|time-complexity|complexity-classes| |
I asked a question on Rabin-Karp Searching algorithm [here][1], which I am reading from the book "[Introduction to Algorithms" 3rd edition Cormen et al.][2].
After reading few para of the section on Rabin-Karp, I got some more confusions:
In the third paragraph the authors say that the if we could find **p** ... |
Time Complexity of Rabin-Karp matching algorithm |
|algorithms|complexity-theory|time-complexity|search-algorithms| |
I asked a question on Rabin-Karp Searching algorithm [here][1], which I am reading from the book "[Introduction to Algorithms" 3rd edition Cormen et al.][2].
After reading few para of the section on Rabin-Karp, I got some more confusions:
In the third paragraph the authors say that the if we could find **p** ... |
If $L$ is a binary language (that is, $L \subseteq \Sigma = \{0,1\}^∗$) and $\overline{L}$ is the complement of $L$:
How can I show that if $L \in \mathsf P$, then $\overline{L} \in \mathsf P$ as well? |
How to show that the complement of a language in $\mathsf P$ is also in $\mathsf P$? |
null |
I would say that the classic distinction of "automated theorem proving" (ATP) vs. "interactive theorem proving" (ITP) needs to be reconsidered. If you take a well-known ITP system like Isabelle/HOL today (Isabelle2013 from February 2013), it integrates quite a lot of add-on tools from the ATP portfolio:
* On-boar... |
Computer languages (even the rudimentary machine languages of days long past) _are_ human languages, as they are primarily for communication with fellow human beings, are defined by humans, and are used only secondarily to convey instructions to a machine. So they evolve much the same way "natural" languages evolve (ju... |
I need to disprove that a `PARITY` gate can be simulated using a __single__ `MAJORITY` gate, or even a `THRESHOLD` gate. How do I go about doing this? Some ideas as to how to go about contradiction or otherwise would be helpful. |
PARITY using depth one TC0 circuit |
|complexity-theory|complexity-classes|circuits| |
null |
null |
Your graph is a tree - so removing any node will resolve in having two connected components (unless the node was a leaf, than you will still have only one component).
If you graph is a balanced tree, then you should remove the root.
If it is a generic graph than maybe finding the Jordan center of the graph and re... |
> Given a tree T = (V , F), find an algorithm which finds u in V, so in the graph T = (V \ {u} , F) the size of each connected component is |V| / 2 at most. What is the complexity?
Can I please have a hint? |
Connected Components in Graph Theory |
|graphs| |
I need to disprove that a `PARITY` gate can be simulated using a __single__ `MAJORITY` gate, or even a `THRESHOLD` gate. How do I go about doing this? Some ideas as to how to go about contradiction or otherwise would be helpful.
One possible argument would be monotonicity of `MAJORITY` and `THRESHOLD` while `PARITY`... |
null |
Lets say I have a global dataset and I run queries over those data set.
For example my dataset would be
* #id, #Name, #Employee, #Birthdate, #number_of_children
* 1, Nick, Nasa, 1982, 1
* 2, Jack, Exon, 1985, 5
* 3, Tom, ABCD, 1978, 0
And I can run queryies on those dataset.
sample queries would be
* #Query... |
Algorithm for query comparison |
|data-structures|data-sets| |
null |
If $L$ is a binary language ($\Sigma = (0, 1)^*$) and $\overline{L}$ is the complement of $L$, the set of binary strings not in $L$.
How can I show that, if $L$ is in the complexity class $P$, then so is $\overline{L}$? |
Show complement of language in same complexity class? |
|complexity-classes|formal-languages| |
Hint: Given a polynomial time algorithm for $L$, come up with a polynomial time algorithm for $\overline{L}$. |
A solution to this problem is the two subsets $U$ and $V$ from $\mathcal{X}$. If we know $U$ upfront, we can answer this question in $O(n*m)$.
So let us examine the case where we would have a unique $U$, this happens when there is an element $a \in S$ is covered only by $U$. We can check this possibility in $O(n*m)... |
null |
Deciding $L$ means you have a way to answer "YES" or "NO" on each input.
$\bar L$ is the complement language of $L$: if some input is in $L$, then it is not in $\bar L$ (and vice versa)..
Thus, deciding $L$ and deciding $\bar L$ are equivalent up to the final answer. If an algorithm to decide one of them takes $x... |
You might want to first compute the number of vertices in each sub-tree. Now you start at the root: if the number of vertices in both sub-trees is at most $|V|/2$ you remove the root and you are done. Otherwise, you choose the root of the sub-tree whose number of elements is $\gt |V|/2$ and try again. this has complexi... |
Are these two languages regular? |
null |
This is a problem from the practice session of the [Polish Collegiate Programming Contest 2012](http://main.edu.pl/en/archive/amppz/2012/dzi). Although I could find the solutions for the main contest, I can't seem to find the solution for this problem anywhere.
The problem is: Given a set of $N$ distinct positive in... |
Finding the size of the smallest subset with GCD = 1 |
You might want to first compute the number of vertices in each sub-tree. Now you start at the root: if the number of vertices in both sub-trees is at most $|V|/2$ you remove the root and you are done. Otherwise, you choose the root of the sub-tree whose number of elements is $\gt |V|/2$ and try again. this has complexi... |
{"OriginalQuestionIds":[1494],"Voters":[{"Id":169,"DisplayName":"uli"},{"Id":19,"DisplayName":"Nicholas Mancuso"},{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":4249,"DisplayName":"Pål GD"},{"Id":472,"DisplayName":"Juho"}]} |
You might want to first compute the number of vertices in each sub-tree. Now you start at the root: if the number of vertices in both sub-trees is at most $|V|/2$ you remove the root and you are done. Otherwise, you choose the root of the sub-tree whose number of elements is $\gt |V|/2$ and try again. this has complexi... |
Suppose you have an algorithm that decides membership in $L$ in polynomial time (by assumption since it's in $P$). You can easily write an algorithm that uses the previous one for deciding membership in $\bar L$ and prove that it takes polynomial time. |
I do not believe one can obtain directly a minimum $k$ such that $G$ is a strong $LL(k)$ grammar. However, as it is possible to (dis)prove that a grammar is strong $LL(k)$, one can iterate the proof over $k$.
A grammar $G$ is strong $LL(k)$ *iff* for every pair of distinct production rules $A \to \alpha$ and $A \to ... |
null |
{"OriginalQuestionIds":[10265],"Voters":[{"Id":157,"DisplayName":"Ran G."},{"Id":4287,"DisplayName":"Hendrik Jan"},{"Id":667,"DisplayName":"sdcvvc"},{"Id":6447,"DisplayName":"vonbrand"},{"Id":683,"DisplayName":"Yuval Filmus"}]} |
There is an $O(n2^n)$ algorithm which is better than the trivial $O(nm^2)$ algorithm when $m$ is really big. Let $f$ be the characteristic vector of $\mathcal{X}$, of length $2^n$; $f$ can be calculated in time $O(n2^n)$. The number of solutions $U,V$ is exactly equal to
$$ f' \begin{pmatrix} 0 & 1 \\ 1 & 1 \end{pmatr... |
How do we determine minimum $k$ such that $G$ is a strong $LL(k)$ Grammar
Like for grammar $G$ with the following rules
$S\rightarrow aAcaa \mid bAbcc,A\rightarrow a \mid bb \mid \epsilon$
ever single distinct rule leads to distinct output (after $S \rightarrow ..$, and $A \rightarrow ..$): $aacaa\mid abbcaa \mi... |
question is:
for an open-adressing has table using linear probing for collision resolution, what is the average time complexity to find an item with a given key?
for an open-adressing has table using double probing for collision resolution, what is the average time complexity to find an item with a given key?
... |
hash table complexities |
|time-complexity|hash-tables| |
How do we determine minimum $k$ such that $G$ is a strong $LL(k)$ Grammar
Like for grammar $G$ with the following rules
$S\rightarrow aAcaa \mid bAbcc,A\rightarrow a \mid bb \mid \epsilon$
every single distinct rule leads to distinct output (after $S \rightarrow ..$, and $A \rightarrow ..$): $aacaa\mid abbcaa \m... |
I'm trying to solve [this problem][1] .
Problem statement : Given n positive integers. Your task is to select a maximum number of integers so that there are no two numbers a, b in which a is divisible by b.
I have to find the Maximum independent set and the size of this set .
The size can be found by [König's ... |
How to find the Maximum Independent Set of a directed graph? |
|algorithms|graphs|bipartite-matching| |
I need a hint for writing a context-free grammar for the language $L=\{1^k0^{2k}:k\in \mathbb N\}$. I'm starting to doubt that it can be done for general $k$. |
Context free grammar for $1^k0^{2k}$ |
|formal-languages|context-free| |
For an open-addressing hash table, what is the average time complexity to find an item with a given key:
1. if the hash table uses linear probing for collision resolution?
2. if the hash table uses double probing for collision resolution?
From my understanding my answer to the first question would be $O(n)$
b... |
hash table collision probability |
Based on the comments:
$$S\rightarrow1S00|100$$ |
null |
I am reading through PCA and it says that the maximum variance principal component has most of the information. Can we apply that to any data set? If a data set has n attributes and most of the attributes show high variance then can we infer that the dataset has captured lot of useful information?
I am trying to un... |
Maximum vairance and useful information of dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.