instruction stringlengths 0 29.8k ⌀ |
|---|
null |
Finally a simplification of the Brodal queue[1] has been released[2], which unlike[3]; are worst-case values (rather than amortised).
**Insert**: $\mathcal{O}(1)$
**Find-min**: $\mathcal{O}(1)$
**Decrease**: $\mathcal{O}(1)$
**Meld**: $\mathcal{O}(1)$
**Delete-min**: $\mathcal{O}(log\ n)$, that's equival... |
Okay, finally got you the complexity you were looking for, and what's best, I found it in the literature:
##Worst-Case Complexity
**Delete**: $\bf\mathcal{O}(1)$
**Delete-min**: $\bf\mathcal{O}(1)$
**Find-min**: $\bf\mathcal{O}(1)$
**Insert**: $\bf\mathcal{O}(log\ n)$
##Reference
> **IF MELD** is allow... |
null |
Like with anything in CS, there is no "best something". There are always trade offs. But, perhaps this section of [Wikipedia's article on Fibonacci heap](http://en.wikipedia.org/wiki/Fibonacci_heap#Summary_of_running_times) could help you:
[Fibonacci heap](http://en.wikipedia.org/wiki/Fibonacci_heap): Amortized $\ma... |
null |
null |
Suppose we have a list of unbounded integers, written in binary, and we want to write a (formal) proof that the list is sorted in ascending order.
Such a proof might look (informally) like: "2 < 3, and 3 < 5, and ... and 71 < 79, so the list is sorted."
It would seem such a proof must have length $\Omega(n)$ wher... |
As pointed out in the previous answer, you cannot do very well if you simply assume that your input is a connected graph. However, you can do better if you make certain assumptions on your graph's structure. That is, one can ask: given a class of graphs $\mathcal G$, will the clique problem be solvable in polynomial ti... |
Let $M_U$ an universal Turing machine which suffices the following conditions:
> If $M$ running $x$ in $f(x)$ space, so $M_U(x)$ running on $<<M>,x>$ in $(f(|X|))^3+2|x|+|<M>|$ space.
why can we conclude from the above that $SPACE(n^2) \neq SPACE(n^7)$? |
Concluding $SPACE(n^2) \neq SPACE(n^7)$ from universal turing machine running time |
|complexity-theory|time-complexity| |
I am solving one of the past exams and I am not certain with my solution to one of the excersices. The excersise is asking to give intuitive meaning to modal $\mu$-calculus formula:
$$ \phi = \mu Z. \langle - \rangle tt \wedge [-a]Z $$
According to an article *Modal logics and mu-calculi: an introduction* from Br... |
Intuitive meaning of modal $\mu$-calculus formula |
|modal-logic|mu-calculus| |
I am solving one of the past exams and I am not certain with my solution to one of the excersices. The excersise is asking to give intuitive meaning to modal $\mu$-calculus formula:
$$ \phi = \mu Z. \langle - \rangle tt \wedge [-a]Z $$
According to an article *Modal logics and mu-calculi: an introduction* from Br... |
I am solving one of the past exams and I am not certain with my solution to one of the excersices. The excersise is asking to give intuitive meaning to modal $\mu$-calculus formula:
$$ \phi = \mu Z. \langle - \rangle tt \wedge [-a]Z $$
According to an article *Modal logics and mu-calculi: an introduction* from Br... |
Let $M_U$ be an universal Turing machine which fulfils the following condition:
> If $M$ running $x$ takes $f(x)$ space, then $M_U$ running on $\langle \langle M\rangle,x\rangle$ takes $(f(|x|))^3+2\cdot|x|+|\langle M\rangle|$ space.
Why can we conclude from the above that $SPACE(n^2) \neq SPACE(n^7)$? |
null |
I assume with ${\sf SPACE}$ you mean ${\sf DSpace}$. As usual for these types of hierarchy question you can use a *diagonalization* argument.
So build a machine $D$ that takes its input $w$ and then executes $M_u(\langle w ,w \rangle)$. While executing $M_u$ it checks also how much space is used and how many steps ... |
Let $M_U$ be an universal Turing machine which fulfills the following condition:
> If $M$ running $x$ takes $f(x)$ space, then $M_U$ running on $\langle \langle M\rangle,x\rangle$ takes $(f(|x|))^3+2\cdot|x|+|\langle M\rangle|$ space.
Why can we conclude from the above that ${\sf Space}(n^2) \neq {\sf Space}(... |
|complexity-theory|space-complexity| |
union-find is usually associated with the _disjoint subsets_ data structure (partitioning elements one-by-one into equivalence classes), and the fact that it operates on directed acyclic graphs is essentially an implementation detail, from the viewpoint of the user of the data structure. I think I'd need to understand... |
**Problem**: Given an array of $n$ integers, $A[1 \dots n]$, such that any integer occurs *at most* 2 times in the array, we have to find the number of *unique* increasing subsequences. In other words, we have to count the number of unique integers $A[i], A[j], A[k]$ such that $A[i] < A[j] < A[k]$ with $i < j < k$.
... |
Count unique increasing subsequences of length 3 in $O(n\log n)$ |
|algorithms|arrays|subsequences| |
Consider a directed graph $G$ on which one can dynamically add edges and make some specific queries.
### Example: disjoint-set forest
Consider the following set of queries:
arrow(u, v)
equiv(u, v)
find(u)
the first one adds an arrow $u→v$ to the graph, the second one decides if $u↔^*v$, the la... |
Dodging any questions about whether this is "interesting" or "artificial" (or whether Computer Science really needs any more NP-complete problems than it already has), the answer is "yes". Pick a structure-preserving mapping between some set of strings and problem instances of 3SAT. Show that the mapping can be compu... |
I am seeking for some popular science videos on computer algorithms for my last lecture delivered in this term. The topic of the videos includes but are limited to algorithm design, algorithm analysis, computational complexity, the application of algorithms, the history of algorithms (even computer science), the story ... |
Are there some popular science videos on computer algorithms to recommend? |
|algorithms|history| |
(**Edit**: completely rewrote my answer now that my understanding of the problem is (I hope) clearer.)
It sounds like this problem can be reduced to incrementally constructing and improving an approximation of the transitive closure of graph, as the graph is built and searched.
$r(u)$ is, abstractly, the set of a... |
(**Edit**: completely rewrote my answer now that my understanding of the problem is (I hope) clearer.)
It sounds like this problem can be reduced to incrementally constructing and improving an approximation of the transitive closure of the graph, as the graph is built and searched.
$r(u)$ is, abstractly, the set ... |
(**Edit**: completely rewrote my answer now that my understanding of the problem is (I hope) clearer.)
It sounds like this problem can be reduced to incrementally constructing and improving an approximation of the transitive closure of the graph, as the graph is built and searched.
$r(u)$ is, abstractly, the set ... |
**Problem**: Given an array of $n$ integers, $A[1 \dots n]$, such that any integer occurs *at most* 2 times in the array, we have to find the number of *unique* increasing subsequences of length 3 (duplicate subsequences must be counted only once). In other words, we have to count the number of unique integers $A[i], A... |
I find http://theory.stanford.edu/~trevisan/cs172/ps04.pdf,
but I can't complete it, is there any other solution for it? |
how can I prove that the language of a read-only turing machines is regular? |
|regular-languages|turing-machines| |
null |
Trying to take "high priority" i.e. high degree vertices over their neighbors will not work in all cases. This algorithm chooses $n-1$ for $C_n$ ([Cycle Graph](http://en.wikipedia.org/wiki/Cycle_graph) on $n$ vertices). It should choose either $n-1/2$ or $n/2$ if its odd or even. It also fails for [Perfect Graphs](http... |
Given an undirected weighted graph $G$ with two edges of minimum weight and all other edges are distinct. Does G have a unique minimum spanning tree?
I know the proof for if all edge weights are distinct (it does give a unique MST) and I am thinking that if two edges of minimum weight are in $G$ then I should be abl... |
Minimum spanning tree with two minimum edge weights |
|graphs|spanning-trees| |
Let $A$ and $B$ be two deterministic finite automata. How do we prove that $L_E = \{ \langle A, B \rangle : L(A) = L(B) \}$ is neither regular nor context-free?
Intuitively, I feel that $L_E$ should not be context-free because we must try each string $\in \Sigma^*$ (where $\Sigma$ is the alphabet) and check if the s... |
How do we prove that $L_E = \{ \langle A, B \rangle : L(A) = L(B) \}$ is neither regular nor context-free? |
|formal-languages|context-free| |
**Problem**: Given an array of $n$ integers, $A[1 \dots n]$, such that any integer occurs *at most* 2 times in the array, we have to find the number of *unique* increasing subsequences of length 3 (duplicate subsequences must be counted only once). In other words, we have to count the number of unique integers $A[i], A... |
One possible way, is to use the pumping lemma, but one needs to be careful about the details. For simplicity let's discuss only the pumping lemma for regular languages (but I believe a similar method can be used when considering the CFL-pumping lemma).
Let's assume that $\langle A \rangle$ is a well-defined way to e... |
I have tried to go about this problem in several ways, and looked in several places with no answer. the question is as follow:
**[Question]**
Given two regular languages (may be referred to as finitely described languages ,idk) L1 and L2, we define a new language as such:
L = {w1w2| there exist two words, x,y... |
proving regularity via Equivalence classes |
|automata|logic| |
Given two regular languages $L_1$ and $L_2$, we define a new language
$$L=\{w_1w_2\mid \text{ there exist two words } x,y \text{ such that } xw_1\in L_1, w_2y\in L2\}$$
How do I show that $L$ is regular with equivalence classes?
My assignment allows the use of closure properties that all regular languages hol... |
Proving regularity via equivalence classes |
null |
|automata|regular-languages|finite-automata|proof-techniques| |
I've been lately reading about the [clique problem][1], specifically, the variety of the clique problem of deciding whether a given graph $G$ with $n$ nodes has a clique of at least size $k$.
Why is this problem $NP$-complete? Could one solve this problem in polynomial time by trying out each possible group of $k$ n... |
Why is the clique problem NP-complete? |
|np-complete| |
Yes $G$ has a unique MST (assuming it is not a multigraph). Take a look at Kruskal's algorithm: the edges are ordered ascending by weight and then added to the MST unless there is a cycle. After adding the two minimum edges, you can't have a cycle, therefore both are in the MST. |
null |
{"Voters":[{"Id":4832,"DisplayName":"Simon S"}]} |
If you are allowed to use closure properties (as the formulation in the question suggests) then $xw_1\in L_1$ so $w_1$ is a suffix of $L_1$, similarly $w_2$ is a prefix of $L_2$. Taking suffixes and prefixes is a closure property of regular languages, and so is concatenation. That solves the regularity.
At what leve... |
Consider the family of grammars $G_n,~n\geq2$.
$$S \rightarrow A_ib_i~,~for~~1\leq i \leq n$$
$$A_i \rightarrow a_jA_i~|~a_j~,~for~~1 \leq i,j \leq n~~and~~i \neq j$$
where multiple alternative right sides result from different values of $i,j$
while the terminal symbols $a_i$ and $b_i$ are not necessarily diffe... |
Yes.
To build a minimum spanning tree you will order edges by weights from smallest to largest. An edge is included as long as it does not make a cycle. If there are two minimum weight edges, then these edges are first and second. The first two edges do not make a cycle. Therefore, since all other edges are distinc... |
According to wikipedia, a read-only Turing (rTM) machine is a two-way finite automaton (2FSA). Two-way finite automata accept regular languages, and we are done.
Unfortunately, it is not *that* simple.
A Turing machine is allowed to wander into the area of the tape that consists of blank cells. This a 2FSA canno... |
**Nonregularity - trivial way:**
Assuming you encode the pairs as $a \sharp b$ where $a,b$ encode automatas, there are infinitely many Myhill-Nerode classes corresponding to prefixes $a \sharp$. In other words, after reading the $\sharp$ symbol there is an unbounded number of possibilities to remember.
**Nonregu... |
Both of these books are good, however I like:
- Design and Analysis of Distributed Algorithms, Nicola Santoro.
- Introduction to Distributed Algorithms, Gerard Tel.
Lynch and Wattenhofer, two big names in Distributed systems theory, focus "a lot" on synchronous systems. On the other hand, Santoro and Tel focu... |
Yes.
To build a minimum spanning tree you will order edges by weights from smallest to largest. An edge is included as long as it does not make a cycle. If there are two minimum weight edges, then these edges are first and second. The first two edges do not make a cycle. Therefore, since all other edges are distinc... |
null |
Both of the books mentioned in the other posts are good, however I like:
- Design and Analysis of Distributed Algorithms, Nicola Santoro.
- Introduction to Distributed Algorithms, Gerard Tel.
Lynch and Wattenhofer, two big names in Distributed systems theory, focus "a lot" on synchronous systems. On the other... |
To elaborate on the comments, there are different problems being considered here.
The 3-clique problem is, given a graph, does it have a clique of size 3? This is solvable in polynomial time. Likewise, for any fixed $k$, the $k$-clique problem (given a graph, is there a clique of size $k$) is solvable in polynomial ... |
A BTree has a k value that determines that every node has k to 2k childern. When a node has 2k keys it needs to be split into two nodes.
Lets say I want to create a k/2k-x tree. (like a 2-3 tree that follows the BTree rules, but isnt k/2k)
What is the possible range of x? The tree must follows the behavior of a B... |
B Trees modification |
|data-structures|search-trees| |
I trying to create a DFA that can recognize strings with alphabet {a,b,c} where a and c appear a even number of times and where b appears an uneven number of times.
I am wondering that this may only be expressed with other mathods such as turing machine or context-free languages.
You might find it fun to think of... |
Does this DFA have a solution? |
|formal-languages| |
This is doable with a DFA. Hint: We need to keep track of three things simulataneously:
1. The parity of a's (have we seen an odd or even number of a's so far?)
2. The parity of b's
3. The parity of c's
So there are 8 possibilities for what we've seen so far:
1. Even number of a's, even number of b's, ev... |
null |
To elaborate on the comments, there are different problems being considered here.
The 3-clique problem is, given a graph, does it have a clique of size 3? This is solvable in polynomial time. Likewise, for any fixed $k$, the $k$-clique problem (given a graph, is there a clique of size $k$) is solvable in polynomial ... |
null |
> **Possible Duplicate:**
> [Is the k-clique problem NP-complete?](http://cs.stackexchange.com/questions/6847/is-the-k-clique-problem-np-complete)
<!-- End of automatically inserted text -->
I've been lately reading about the [clique problem][1], specifically, the variety of the clique problem of deciding whether... |
{"OriginalQuestionIds":[6847],"Voters":[{"Id":472,"DisplayName":"Juho"},{"Id":867,"DisplayName":"AJed"},{"Id":2755,"DisplayName":"Realz Slaw"},{"Id":4304,"DisplayName":"Merbs"},{"Id":2205,"DisplayName":"A.Schulz"}]} |
I am trying to create a DFA that can recognize strings with alphabet $\{a,b,c\}$ where $a$ and $c$ appear even number of times and where $b$ appears odd number of times.
I am wondering that this may only be expressed with other methods such as Turing machine or context-free languages.
You might find it fun to thi... |
null |
For a random undirected graph with `n` nodes, where each node has `k` incident edges (`nk/2` edges in total), each node is partitioned in one of two partitions each having `n/2` nodes.
What is the order of the number of edges that start in one partition and end in the other?
My back of the napkin calculation is h... |
mean number of edges between two equal partitions |
|graphs| |
Here is an algorithm to count distinct subsequences of length $3$ in time $O(n \log n)$, regardless of how many times any value $a$ occurs in $A[j]$.
First, create a binary tree $T$ containing all possible values $a = A[j]$, storing at each node how many times it occurs in $A$, and how many nodes there are which fol... |
Your thinking is correct. To verify your claim you can check [this][1] lecture notes on the probabilistic method by Matousek and Vondrak. More specifically check the proof of **Theorem 3.3.1** stating that any graph with $m$ edges contains a bipartite subgraph with $\frac{m}{2}$ edges.
[1]: http://www.google.com... |
null |
More exactly, a B tree has an $m$ value such that the number of children is between $\lceil\frac m2\rceil$ and $m$ children. That differs from your numbers for odd $m$. For $m=3$ the bounds are $2$ and $3$, which is the 2-3-tree you refer to.
As far as I know (I tried this several years ago) these numbers are the sm... |
(**Edit**: completely rewrote my answer now that my understanding of the problem is (I hope) clearer.)
It sounds like this problem can be reduced to incrementally constructing and improving an approximation of the transitive closure of the graph, as the graph is built and searched.
$r(u)$ is, abstractly, the set ... |
Yes $G$ has a unique MST (assuming it is not a multigraph). Take a look at Kruskal's algorithm: the edges are ordered ascending by weight and then added to the MST unless there is a cycle. After adding the two minimum edges, you can't have a cycle, therefore both are in the MST.
Edit: As Paresh pointed out, this is ... |
{"Voters":[{"Id":4832,"DisplayName":"Simon S"}]} |
null |
Allright, I'm reviewing for finals and have a sample problem that I **think** I understand, but would like someone to bless my understanding or smack me and tell me why I'm wrong.
I'm presented with a problem $\Pi$ of unknown complexity class. If I can transform $\Pi$ to some problem $x, x \in P$ in polynomial ti... |
Implications of polynomial time Reductions |
|complexity-theory|complexity-classes|p-vs-np| |
In essence, you are right. Given a problem $\Pi$, if you can find a poly-time reduction from $\Pi$ to any problem $x\in P$, then you have proof that $\Pi\in P$ as well.
A reduction from problem $A$ to $B$ is basically a function that transforms any input of $A$ into an input of $B$, such that the solutions agree. Th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.