instruction stringlengths 0 29.8k ⌀ |
|---|
This is related to the well-known [change-making problem](https://en.wikipedia.org/wiki/Change-making_problem). So well-studied, in fact, that this question has been investigated for $m \leq 7$ [1] using brute force. As of 2003, the hardness of finding optimal denominations appears to be an open problem.
If you chec... |
|computability|terminology|decision-problem|kolmogorov-complexity|3-sat| |
|algorithms|optimization|mathematical-analysis|mathematical-software| |
null |
The only paper I can find about an implementation of a lossless video codec is an [article by Michael Niedermayer](http://www.ffmpeg.org/~michael/ffv1.html) which explains the FF1V compression pipeline.
I'm wondering if anyone else has found any articles similar to this. I've looked on IEEE and ACM and their article... |
|reference-request|data-compression|video| |
Let $\sf{Bubble Sort}$ be defined as the following:
for (j = A.length; j > 1; j--)
for (i = 0; i < j - 1; i++)
if (A[i] > A[i + 1])
swap(i, i + 1, A)
Given some permutation $x_1, \cdots, x_n$, an *inversion* is said to have occurred if $x_j < x_i$ for some $i < j.$ We se... |
This is an [assignment problem](https://en.wikipedia.org/wiki/Assignment_problem) which can, for example, be solved by the [Hungarian algorithm](https://en.wikipedia.org/wiki/Hungarian_algorithm) or by expressing it as [linear program](https://en.wikipedia.org/wiki/Linear_program). Note that you can adapt your problem ... |
|formal-languages|formal-grammars|context-free| |
null |
To generate a graph from a prescribed degree sequence (regardless of the degree sequence), one can use an algorithm by Blitzstein and Diaconis:
- ["A sequential importance sampling algorithm for generating random graphs with prescribed degrees" by J. Blitzstein and P. Diaconis](http://www.people.fas.harvard.edu/~bl... |
I've been reading a bit of the literature lately, and have found some rather interesting data-structures.
I have researched various different methods of getting update times down to $\mathcal{O}(1)$ worst-case update time [1-7].
Recently I begun looking into lock-free data-structures, to support efficient concurr... |
Let $p$ be the pumping length guaranteed by the pumping lemma (for context free languages). Then we choose $m \neq n$ such that $m,n \geq p$ and are both prime. Then clearly $s = a^{n}b^{n} \in L$.
By the pumping lemma we can divide $s$ such that $s=uvxyz$ and
1. $|vxy| \leq p$
2. $|vy| \geq 0$
3. $s' = uv^{... |
The problem is as follows:
Given a finite set of rectangles ($S\subset\mathbb{R}\times\mathbb{R}$), build a data structure that will support the following operations:
- Check, receives a rectangle $r\in\mathbb{R}\times\mathbb{R}$, and returns true iff there is a rectangle $c\in S$ so that $r_x \leq c_x$ and $r_y... |
Finding a minimal containing rectangle from a given set of rectangles |
|algorithms|data-structures| |
There is the
>Flanagan's Java Scientific Library
which can be found here:
[LINK][1]
Basically you have to extend `MaximizationFunction` and implement the function
public double function(double[] param)
which contains your function above. This method evaluates your function given the parameters `par... |
__Summary:__ According to Rice's theorem, everything is impossible. And yet, I _do_ this supposedly impossible stuff _all the time!_
---
Of course, Rice's theorem doesn't simply say "everything is impossible". It says something rather more specific: "Every property of a computer program is non-computable."
(If... |
Perplexed by Rice's theorem |
|computability| |
You write in the [comments](http://cs.stackexchange.com/questions/2666/prove-that-a-boolean-function-computable-in-tn-by-a-ram-machine-is-in-dtimet#comment7242_2666):
> Since the address should be written in the tape by a $T(n)$-time Turing Machine, the size (i.e. string length) of the address can not exceed $O(T(n)... |
The most basic algorithm is probably [gradient gescent][2] which can also be used for maximization. It uses the gradient of the function to optimize and (starting from an initial point) "goes" into the most promising direction. For maximization this is the direction of the gradient. Look at the examples on Wikipedia. T... |
I am interested in exploring the world of [BDI agents](http://en.wikipedia.org/wiki/BDI_software_agent) (software agents that possess "beliefs, desires, intentions", essentially the agent has knowledge of the world, a set of motivations, and carries out certain plans).
I recently read A Canonical Agent Model for Hea... |
|reference-request|human-computing|agent-based-computing| |
|computability|turing-machines|halting-problem| |
Let $p$ be the pumping length guaranteed by the pumping lemma (for context free languages). Then we choose $m \neq n$ such that $m,n \geq p$ and are both prime. Then clearly $s = a^{n}b^{m} \in L$.
By the pumping lemma we can divide $s$ such that $s=uvxyz$ and
1. $|vxy| \leq p$
2. $|vy| \geq 0$
3. $s' = uv^{... |
|algorithms|data-structures|computational-geometry| |
Fundamental misunderstanding:
> Every property of a computer program is non-computable
That is not what Rice's theorem talks about. It talks about properties of *functions* and that the set of *programs computing this function* is not decidable. Formally, given $\emptyset \subset P \subset \mathsf{RE}$ the set
... |
null |
Given a set of segments, I would like to compute the set of closed polygons inside the convex hull of the set of the end of those segments. The vertices of the polygons are the intersections of the segments. For example, if you draw these 6 lines restricted to $[-1;1]$ which equations are: $x=-1$, $x=0$, $x=1$, $y=-1$,... |
Given a set of segments, I would like to compute the set of closed polygons inside the convex hull of the set of the end of those segments. The vertices of the polygons are the intersections of the segments. For example, if you draw the 6 lines restricted which equations are: $x=-1$, $x=0$, $x=1$, $y=-1$, $y=0$, $y=1$,... |
Check, insert, and remove can be accomplished by a data structure for dynamically maintaining 2D maxima ([this 2011 paper by Brodal and Tsakalidis](http://www.cs.au.dk/~gerth/papers/icalp11.pdf) presents a history of the problem including their new algorithm). I have no idea how to do get. |
null |
I asked a (seed) question about sums of Landau terms [before](http://cs.stackexchange.com/questions/366/what-goes-wrong-with-sums-of-landau-terms), trying to gauge the dangers of abusing asymptotics notation in arithmetics, with mixed success.
Now, [over here](http://cs.stackexchange.com/a/2803/98) our recurrence gu... |
Sums of Landau terms revisited |
|terminology|asymptotics|landau-notation| |
If each $c_i$ is a constant, then there is some $c_{max}$ such that $\forall c_i: c_i\leq c_{max}$. So clearly $$\sum c_i f(i) \leq \sum c_{max} f(i) = c_{max} \sum f(i) = O\left(\sum f(i)\right)$$ Same idea for little o.
I don't think $H_n=o(n)$. Supppose it did. Then $\lim_{n\to\infty} \frac{H_n}{n} = 0$. But
... |
If each $c_i$ is a constant, then there is some $c_{max}$ such that $\forall c_i: c_i\leq c_{max}$. So clearly $$\sum c_i f(i) \leq \sum c_{max} f(i) = c_{max} \sum f(i) = O\left(\sum f(i)\right)$$ Same idea for little o.
I don't think $H_n=o(n)$. Supppose it did. Then $\lim_{n\to\infty} \frac{H_n}{n} = 0$. But
... |
[Borůvka's algorithm][1] is one of the standard algorithms for calculating the minimum spanning tree for a graph $G = (V,E)$, with $|V| = n, |E| = m$.
The pseudo-code is:
MST T = empty tree
Begin with each vertex as a component
While number of components > 1
For each component c
... |
Tighter analysis of modified Borůvka's algorithm |
|algorithms|algorithm-analysis|spanning-trees| |
I asked a (seed) question about sums of Landau terms [before](http://cs.stackexchange.com/questions/366/what-goes-wrong-with-sums-of-landau-terms), trying to gauge the dangers of abusing asymptotics notation in arithmetics, with mixed success.
Now, [over here](http://cs.stackexchange.com/a/2803/98) our recurrence gu... |
If each $c_i$ is a constant, then there is some $c_{max}$ such that $\forall c_i: c_i\leq c_{max}$. So clearly $$\sum c_i f(i) \leq \sum c_{max} f(i) = c_{max} \sum f(i) = O\left(\sum f(i)\right)$$ Same idea for little o.
I think the problem here is that $1/i\not=\Theta(1)$. It's $o(1/n)$ (since there is no $\epsilo... |
null |
*I would have liked to post an image here, but I dont have enough reputation.*
4 2
/ \ / \
2 5 1 4
/ \ / \
1 3 3 5
The in-order traversal is not unique. The above trees have the same sequence 1,2,3,4,5. (They a... |
is there a way to reconstruct a binary tree just from its inorder-representation?
I've searched the internet, but I could only find solutions for reconstructing a binary tree from inorder and preorder representations, but none for only inorder.
Thank you very much! |
From inorder Representation to binary tree |
|algorithms|graph-theory|data-structures| |
I know why and how push relabel technique works for solving max flow problem but Why global update step is required in push relabel flow solution for max flow? |
Push Relabel Max flow problem |
|algorithms|graphs| |
null |
Looks right to me in the following convention:
$S_n = \sum_{k=1}^{n} \Theta(1/k)$ is convenient notation for
> There is an $f(x) \in \Theta(1/x)$ (as $x \to \infty$) such that
> $S_n = \sum_{k=1}^{n} f(k)$.
Thus the $c_i$ (or with the notation in this answer $c_k$) you get, are not really dependent on $k$.
... |
null |
|algorithms|graphs|binary-trees| |
Is there a way to reconstruct a binary tree just from its in-order representation?
I've searched the internet, but I could only find solutions for reconstructing a binary tree from inorder and preorder representations, but none for only inorder.
|
From in-order representation to binary tree |
I think I nailed the problem down. In essence: using Landau terms decouples the variable of the summand function from the sum's running variable. We still (want to) read them as identical, though, therefore the confusion.
To develop it formally, what does
$\qquad \displaystyle S_n \in \sum_{i=1}^n \Theta(f(i)) \... |
null |
## Master Theorem
The [Master theorem](https://en.wikipedia.org/wiki/Master_theorem) gives asymptotics for the solutions of so-called [divide & conquer](https://en.wikipedia.org/wiki/Divide_and_conquer_algorithm) recurrences, that is such that divide their parameter into proportionate chunks (instead of cutting away... |
## Master Theorem
The [Master theorem](https://en.wikipedia.org/wiki/Master_theorem) gives asymptotics for the solutions of so-called [divide & conquer](https://en.wikipedia.org/wiki/Divide_and_conquer_algorithm) recurrences, that is such that divide their parameter into proportionate chunks (instead of cutting away... |
**Edit:** Now that I have enough reps, I can add the figure.
![**Example Trees**][1]
The in-order traversal is not unique. The above trees have the same sequence 1,2,3,4,5. (They are isomorphic, but I assumed you consider ordered binary trees.)
[1]: https://i.stack.imgur.com/L5M0v.png |
**In terms of space and time complexity, what is the most efficient priority-queue?**
FYI: If you're looking for a survey of priority-queues which maximises complexity of deletes over inserts, see: http://cs.stackexchange.com/q/524. |
What is the most efficient priority-queue? |
|data-structures|time-complexity|priority-queues| |
###Worst-case Complexity
**Insert**: $\mathcal{O}(1)$
**Find-min**: $\mathcal{O}(1)$
**Decrease-key**: $\mathcal{O}(1)$
**Delete**: $\mathcal{O}(log\ log\ n)$
**Space**: $\mathcal{O}(n)$
###Proof
> THEOREM 1. *We can implement a priority queue that with n integer keys in the range $[0 , N )$ in linea... |
null |
If each $c_i$ is a constant, then there is some $c_{max}$ such that $\forall c_i: c_i\leq c_{max}$. So clearly $$\sum c_i f(i) \leq \sum c_{max} f(i) = c_{max} \sum f(i) = O\left(\sum f(i)\right)$$ Same idea for little o.
I think the problem here is that $1/i\not=\Theta(1)$. It's $o(1/n)$ (since there is no $\epsilo... |
![**Example Trees**][1]
The in-order traversal is not unique. The above trees have the same sequence 1,2,3,4,5. (They are isomorphic, but I assumed you consider ordered binary trees.)
[1]: https://i.stack.imgur.com/L5M0v.png |
Is there a way to create a single edge on a graph that connects 3 or more nodes? For example, let's say that the probability of Y occurring after X is 0.1, and the probability of Z occurring after Y is 0.001, but the probability of Z occurring after *both* X and Y occur is 0.95. If the probabilities are assigned to eac... |
An edge that connects more than two nodes in a graph? |
|algorithms|graphs|probabilistic-algorithms|weighted-graphs| |
Is there a way to create a single edge on a graph that connects 3 or more nodes? For example, let's say that the probability of Y occurring after X is 0.1, and the probability of Z occurring after Y is 0.001, but the probability of Z occurring after *both* X and Y occur is 0.95. If the probabilities are assigned to eac... |
Global relabeling is not required; it's an optimization. In the push-relabel paper, Goldberg and Tarjan describe a parallel version not amenable to such an update. The kind of performance problem global relabeling addresses is when two nodes u and v with surplus and residual arcs to one another become disconnected from... |
When edges connect more than two nodes, you don't have a graph, you have a [hypergraph](http://en.wikipedia.org/wiki/Hypergraph). More precisely, since transitions are oriented (you're starting from a digraph) and there are probability on each transition, you have a weighted hyperdigraph. I'm not sure having this term ... |
null |
It is possible to craft test cases for general graphs where you Boruvkas step wouldn't
halve the number of edges in each step, even though it halves the number of vertices.
An interesting note is that the optimization that you suggest works for Planar graphs. Because
for planar graphs $|E| \leq 3*|V|-6 $ i,e $|E| = ... |
null |
Based on your above comments with @Gilles, what you describe is just a higher order markov model. For example an $n$th order markov model, is a model which assumes
$$ P(x_t | x_{t-1}, x_{t-2}, \ldots x_1) = P(x_t | x_{t-1}, x_{t-2}, \ldots x_{t-n}).$$
If $n$ is not fixed you have a [variable order markv model](h... |
null |
It is possible to craft test cases for general graphs where you Boruvkas step wouldn't
halve the number of edges in each step, even though it halves the number of vertices.
An interesting note is that the optimization that you suggest works for Planar graphs. Because
for planar graphs $|E| \leq 3*|V|-6 $ i,e $|E| = ... |
The MATLAB files for the book are accessible [here](http://www.pearsonhighered.com/haykin/).
I'm not familiar with the text, but there are `.mat` files in the zip named
>c.mat
>sig_lorenz_full.mat
which probably contain the data. There are also a handful of TIFF files (images) from which he draws the other d... |
The book ["Neural Networks and Learning Machines"](http://www.amazon.com/Neural-Networks-Learning-Machines-3rd/dp/0131471392/ref=sr_1_1?s=books&ie=UTF8&qid=1342760709&sr=1-1&keywords=neural+networks+and+learning+machines) by Simon Haykin has many computer experiments to which many exercises are related. But there seems... |
null |
Two bits to this answer;
Firstly, the class of languages recognised by Turing Machines is not <b>context sensitive</b>, it's <b>recursively enumerable</b> (context sensitive is the class of languages you get from <a href="http://en.wikipedia.org/wiki/Linear_bounded_automaton">linear bound automata</a>).
The secon... |
In [this answer][1] it is mentioned
> A regular language can be recognized by a finite automaton. A context-free language requires a stack, **and a context sensitive language requires two stacks (which is equivalent to saying it requires a full Turing machine.)**
I wanted to know regarding the truth of the bold p... |
Is a push-down automata with two stacks equivalent to a turing machine? |
|computability|turing-machines| |
So, [TSP (Travelling salesman problem) decision problem is **NP complete**][1].
But I do not understand how I can verify that a given solution to TSP is in fact optimal in polynomial time, given that there is no way to find the optimal solution in polynomial time (which is because the problem is not in P)?
Anythi... |
How can I verify a solution to Travelling Salesman Problem in polynomial time? |
|np-complete| |
null |
To be more precise, we do not *not* know if TSP is in $\mathsf{P}$. It is possible that it can be solved in polynomial time, even though perhaps the common belief is that $\mathsf{P} \neq \mathsf{NP}$. Now, recall what it means for a problem to be $\mathsf{NP}$-hard and $\mathsf{NP}$-complete, see for example my [answe... |
The crux is that you have to consider the *decision* problem:
> **Travelling Salesman Problem (Decision Version).** Given a weighted graph *G* and a target cost *C*, is there a Hamiltonian cycle in *G* whose weight *is at most C*?
For a 'yes' instance, the certificate is just some Hamiltonian cycle whose weight i... |
It is possible to craft test cases for general graphs where your Borůvka's step wouldn't
halve the number of edges in each step, even though it halves the number of vertices.
An interesting note is that the optimization that you suggest works for planar graphs. This is because
for planar graphs $|E| \leq 3*|V|-6 $ i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.