instruction
stringlengths
0
29.8k
⌀
Could anyone please explain cantors diagonalization principle in simple terms
Cantors diagonal method in simple terms
|complexity-theory|sets|uncountability|
null
I want to draw a Voronoi diagram with 9 sites and with 1. no vertex 2. 1 vertices 3. 4 vertices 4. 7 vertices. How do I approach this question. The one with no vertex is easy, it can be done by collinear points. What about the others. A figure for each would be appreciated.
Voronoi diagram with given number of vertices and sites
|algorithms|
I recently came across the following interesting problem - one is given a sequence of `X`s and `Y`s such as `XXYXYXYYXYXXXYX`, and consider a sequence to be good if, as you start at the left and move right, the number of `X`s is greater than or equal to the number of `Y`s at any point except at the very end, at which t...
Improving Time Bound of this Algorithm past $O(n^2)$
|algorithms|subsequences|
I want to draw a Voronoi diagram with 9 sites and with 1. no vertex, 2. 1 vertex, 3. 4 vertices, and 4. 7 vertices. How do I approach this question. The one with no vertex is easy, it can be done by collinear points. What about the others. A figure for each would be appreciated.
|algorithms|computational-geometry|
Given a set A={a1,a2,a3.....an}, then construct a set P={p1,p2,p3,...pn} such that 1.|pi|=ai 2.The sum of the elements of P is 0. This problem is NP complete, which I have to prove. How do I do it? I am thinking on the grounds of reduction from a subset sum problem. But the problem is that because of the mo...
NP completeness - Reduction
|algorithms|algorithm-analysis|np-complete|reductions|
Assume that we are given a real life graph- DBLP network in my case- where degree distribution of nodes follows a power law (many nodes have 1, 2 neighbors, and only a few nodes have hundreds of neighbors). A random walk ends when it returns to the initial node or when the walk takes 3 steps. If we start random wal...
Random walks- How many to start from each node?
|graphs|random-walks|
Here's the standard application explained in the simplest terms I can: *Theorem:* There are more real numbers than there are integers. *Lemma:* A real number has a decimal representation (that might not terminate), and all decimal representations create real numbers. *Proof of Theorem:* Suppose there are as ma...
Conceptually, it is maybe easier to construct a [Delaunay <strike>triangulation</strike> tessalation](http://en.wikipedia.org/wiki/Delaunay_triangulation). The DT is the dual to the Voronoi diagramm, so you want to limit the number of faces to $0,1,4,7$. This can be achieved to place some of the vertices of the DT on a...
Given a set A={a1,a2,a3.....an}, then construct a set P={p1,p2,p3,...pn} such that 1.|pi|=ai 2.The sum of the elements of P is 0. This problem is NP complete, which I have to prove. How do I do it? I am thinking on the grounds of reduction from a subset sum problem. But the problem is that because of ...
Given a set $A=\{a_{1},a_{2},a_{3},\ldots,a_{n}\}$, then construct a set $P=\{p_{1}, p_{2}, p_{3}, \ldots , p_{n}\}$ such that 1. $|p_{i}|=a_{i}$ 2. $\sum_{i = 1,}^{n}p_{i} = 0$. This problem is NP-complete, which I have to prove. How do I do it? I am thinking on the grounds of reduction from a subset...
If you consider given graph as a Markov chain, you can compute the steady-state distribution. With it, you can compute the mean-reccurence time $M_j$ (expected time to return to the starting node). See [Mean recurrence time][1] $\pi_j=1/M_j$ If for some node $n_j$, the probability of going to each neighbour is eq...
I'm going to make a few guesses as to what you precisely mean, and if they're correct, we can edit the question so everything is clearer. First I'll define what I think you mean with your problem: >**Input**: A set of positive integers $A=\{a_{1}, \ldots, a_{n}\}$.<br/> **Question**: Is there a set of integers $P =...
I have a complex query Q used to search a dataset S to find H_exact = {s∈S where Q(s) is True}. Each query takes on average time t so the overall time in the linear search is |S|*t. I can break a query down into simpler sub-queries q_i and find H_approx = {s∈S where ∀q_j(s) is True} and where H_exact ⊆ H_approx. Each s...
Fixed-length decision-tree-like feature selection to minimize average search performance
|algorithms|optimization|machine-learning|greedy-algorithms|
I have a complex query $Q$ used to search a dataset $S$ to find $H_\text{exact} = \{s \in S \mid \text{where $Q(s)$ is True}\}$. Each query takes on average time $t$ so the overall time in the linear search is $t\cdot |S|$. I can break a query down into simpler sub-queries q_i and find $H_\text{approx} = \{s\in S \mid ...
|computational-geometry|
No you wont. Suppose you have as graph the complete graph $K_n$ with $n\ge 4$, for simplicity we pick the $K_4$, but this construction works for all larger $n$. Every DFS-tree of a complete graph is a **path**, no matter how you order the edges. But clearly you can define the weights such that a non-path is the MST...
|np-complete|reductions|partitions|
Conceptually, it is maybe easier to construct a [Delaunay <strike>triangulation</strike> tessalation](http://en.wikipedia.org/wiki/Delaunay_triangulation). The DT is the dual to the Voronoi diagramm, so you want to limit the number of faces to $0,1,4,7$. This can be achieved by placing some of the vertices of the DT on...
null
**Topic:**<br> The maximum feasible subsystem problem, which is generally NP-hard [1] **Question:**<br> Are there special algorithms in case of only 2 variables (2D linear constraints)? The problem seems to be a lot less complex in my humble opinion but is this true? Can you guys point me to any algorithms/papers ...
Maximum feasible subsystem problem (MaxFS) in 2 variables
|computational-geometry|linear-programming|
Having a unsupervised algorithm done on a dataset (e.g. K-means), how to determine which cluster is normal and which is anomalous (for 30 clusters, for example)? If the dataset contains normal traffic much more than anomalies (99%), then the radius of clusters associate to normal traffic is bigger. Is this true? Wh...
unsupervised anomaly detection: assigning the clusters to normal and anomaly
|untagged|
|pattern-recognition|
**Topic:**<br> The [maximum feasible subsystem problem](http://risorse.dei.polimi.it/maxfs/), which is generally NP-hard [1]. **Question:**<br> Are there special algorithms in case of only 2 variables (2D linear constraints)? The problem seems to be a lot less complex in my humble opinion but is this true? Can you...
|computational-geometry|linear-programming|linear-algebra|
Perhaps you will find my blog post "[On a proof of Cantor's theorem][1]" illuminating. In short, the right way to prove Cantor's theorem is to first prove Lawvere's fixed point theorem, which is more computer-sciency in nature than Cantor's theorem. Given two sets $A$ and $B$, let $B^A$ denote the set of all functio...
null
This is a question from Dragon Book exercise. Please tell me if it is inappropriate to ask such questions. This is the grammar- > S -> AaAb | BbBa > A -> &epsilon; > B -> &epsilon; Question says show that it is LL(1) but not SLR(1). To prove that it is LL(1), I tried constructing parse table, but I a...
How is this grammar LL(1)?
|compilers|
This is a question from Dragon Book exercise. Please tell me if it is inappropriate to ask such questions. This is the grammar: > $S \to AaAb \mid BbBa $ > $A \to \varepsilon$ > $B \to \varepsilon$ The question asks how to show that it is LL(1) but not SLR(1). To prove that it is LL(1), I tried co...
|formal-grammars|compilers|
No, they're not the same. And you're right (I'm assuming about the algorithm you're describing): it's recursive. The reason is the definition of both words, which you can read in a dictionary or Wikipedia. Induction (assuming 'mathematical induction') is specifically about proving that all cases of an argument ar...
Search for a sufficient condition which makes a grammar LL(1) (hint: look at the FIRST sets). Search for a needed condition which all SLR(1) grammars must meet (hint: look at the FOLLOW sets).
So I have a fun little problem. It will take a minute to explain, but the situation is conceptually very simple. Suppose you have a string of characters, which is interpreted as groups of one or more contiguous characters. This is for run length encoding or something. For example: zz22344a is two z's, two 2's, one 3...
Rechecking contiguous characters (as in run length encoding)
|strings|substrings|
So I have a fun little problem. It will take a minute to explain, but the situation is conceptually very simple. Suppose you have a string of characters, which is interpreted as groups of one or more contiguous characters. This is for run length encoding or something. For example: zz22344a is two z's, two 2's, one 3...
|terminology|binary-arithmetic|
I gotta make a CFG and PDA for the grammar that has perfectly nested parentheses and brackets. $\qquad\begin{align} S &\to [S] \\ S &\to (S) \\ S &\to SS \\ S &\to \varepsilon \end{align}$ Not sure if this is correct, or how to make the PDA from it?
|formal-languages|automata|formal-grammars|context-free|pushdown-automata|
|algorithms|education|dynamic-programming|
|terminology|hash|
From [Wikipedia][1] > A hash function is any algorithm or subroutine that maps **large data > sets of variable length**, called keys, to **smaller data sets of a > fixed length**. For example, a person's name, having a variable > length, could be hashed to a single **integer**. The values returned > by a hash fu...
|graphs|probability-theory|random-walks|
|machine-learning|pattern-recognition|
|formal-grammars|compilers|parsers|
This is a question from the Dragon Book. This is the grammar: > $S \to AaAb \mid BbBa $ > $A \to \varepsilon$ > $B \to \varepsilon$ The question asks how to show that it is LL(1) but not SLR(1). To prove that it is LL(1), I tried constructing its parsing table, but I am getting multiple productions i...
I am having diffuculties understanding the principle of lookahead in LR(1) - items. How do I compute the lookahead sets ? Say for an example that I have the following grammar: S -> AB A -> aAb | b B -> d Then the first state will look like this: S -> .AB , {look ahead} A -> .aAb, {look ahead} ...
LR(1) - Items, Look Ahead
|formal-languages|formal-grammars|context-free|parsing|
null
There are two ways that lookaheads 'come into being'. The first is that the start production $S' \rightarrow S$ has lookahead $\$$ in the initial state of the $LR(1)$ automaton. Hence, $S' \rightarrow \bullet S, \$$ is an item in the initial state. *Pendantry note: we therefore accept in the state containing the ite...
I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each round. To find a negative cycle I am using the bellman-ford algorithm. My Problem is: Bellman-ford only f...
Finding negative cycles for cycle-canceling algorithm
|algorithms|graphs|
First, let's give your productions a number. > 1 $S \to AaAb$ > 2 $S \to BbBa$ > 3 $A \to \varepsilon$ > 4 $B \to \varepsilon$ Let's compute the first and follow sets first. For small examples such as these, using intuition about these sets is enough. $$\mathsf{FIRST}(S) = \{a, b\}\\ \mathsf{FIRST}...
> **Possible Duplicate:** > [Prove that the complement of $\{0^n1^n \mid n \geq{} 0\}$ is not regular using closure properties](http://cs.stackexchange.com/questions/4752/prove-that-the-complement-of-0n1n-mid-n-geq-0-is-not-regular-using) <!-- End of automatically inserted text --> Is $L=\{ a^nb^m \mid n,m \ge 0...
{"OriginalQuestionIds":[4752],"Voters":[{"Id":157,"DisplayName":"Ran G."},{"Id":2205,"DisplayName":"A.Schulz"},{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":39,"DisplayName":"Gilles"}]}
I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each round. To find a negative cycle I am using the bellman-ford algorithm. My Problem is: Bellman-ford only f...
Some simple problems that have lower bounds greater than the size of their inputs, are algorithms that have output sizes greater than their input sizes. Some examples: * The problem of listing *all solutions* to 3-SAT, or similarly, the problem of listing all *Hamiltonian cycles*. These problems both have exponen...
null
0 down vote favorite There are N players and M objects, each of the objects has a value. Each player has a strategy in choosing an object. Each round a player will choose an object, many players can choose the same object. However the value of each object is divided evenly among every player that has chosen it. ...
Building probability distribution functions from observation
|machine-learning|probability-theory|modelling|
I'm looking for an efficient algorithm to find the longest repeated pattern in an string. For example consider the following string of numbers: `5431428571428571428571428571427623874534` as you can see, `142857142857` is the longest pattern which is repeated for a couple of times (at least twice) in this str...
Find the longest repeated pattern
|algorithms|
The problem is surprisingly non-trivial. First, two brute force algorithms. A square ("repeated pattern") is given by its *length* $\ell$ and position $p$, and takes time $O(\ell)$ to verify. If we go over all $\ell$ and $p$, we obtain an $O(n^3)$ algorithm. We can improve on that by first looping over $\ell$, and then...
A TM to accept EVEN-EVEN can be based on the algorithm: 1. Move up the string, changing a’s to A’s 2. Move down the string, changing b’s to B’s Modified algorithm: To avoid the problem of crashing on the way down the $Tape$, change the letter in the first cell to an $X$ (if it's an $a$) and to a $Y$ (if it's a $...
How to draw a Turing Machine for Even-Even
|turing-machines|
null
|algorithms|strings|subsequences|
A TM to accept EVEN-EVEN (a collection of all strings with an even number of a's and an even number of b's) can be based on the algorithm: 1. Move up the string, changing a’s to A’s 2. Move down the string, changing b’s to B’s Modified algorithm: To avoid the problem of crashing on the way down the $Tape$, chang...
null
|graph-theory|data-structures|combinatorics|binary-trees|heaps|
There are N players and M objects, each of the objects has a value. Each player has a strategy in choosing an object. Each round a player will choose an object, many players can choose the same object. However the value of each object is divided evenly among every player that has chosen it. There will be 9000 rounds(ch...
|algorithms|graphs|shortest-path|network-flow|
If you consider given graph as a Markov chain, you can compute the steady-state distribution. With it, you can compute the mean-reccurence time $M_j$ (expected time to return to the starting node). See [Mean recurrence time][1] $\pi_j=1/M_j$ If for some node $n_j$, the probability of going to each neighbour is eq...