instruction
stringlengths
0
29.8k
⌀
Notations around the polynomial hierarchy
|complexity-theory|terminology|time-complexity|
Amortised analysis is a tool to get more useful results than "naive" worst-case analysis. Especially in the realm of advanced data structures, operations can be cheap most of the time but expensive in rare cases; worst-cases analysis yields only the latter case as characteristic of the data structure. [Dynamic arrays](...
I think the following exercise is to "warm up", but nevertheless it's quite difficult for me: > Let $k \in \mathbb{N}$ and let $L \in \Sigma_k$. Show that also $L^{*} \in \Sigma_k$. The following details from my lecture notes seem to be useful: Notation. Let $n \in \mathbb{N}$. We write $\exists_n y. \varph...
Show that a language belongs to the polynomial hierarchy
|complexity-theory|time-complexity|
Let me assume your are familiar with the oracle-version of the polynomial hierarchy. Thus, if $L\in \Sigma_k$, then there exists a (non-deterministic polytime) Turing machine $M$ with oracle $\Sigma_{k-1}$. To show that $L^*$ is also in $\Sigma_k$ we explain how one could build a new non-deterministic polytime Turin...
Let me assume your are familiar with the oracle-version of the polynomial hierarchy. Thus, if $L\in \Sigma_k$, then there exists a (non-deterministic polytime) Turing machine $M$ with oracle $\Sigma_{k-1}$. To show that $L^*$ is also in $\Sigma_k$ we explain how one could build a new non-deterministic polytime Turin...
I am new to "Computational Complexity" and therefore I have enough problems with some exercises like the following one: > Remember: $\text{PH} := \bigcup_{i} \Sigma_i$ > > Show: > > $\bullet \bigcup_{i}(\Sigma_i \cup \Pi_i \cup \Delta_i) = \bigcup_{i}\Sigma_i = \bigcup_{i}\Pi_i = \bigcup_{i}\Delta_i$ > > $\...
$\newcommand{\P}{\mathsf{P}}\newcommand{\PH}{\mathsf{PH}}$ $\newcommand{\SUM}[1]{\sum_{#1}^{\P}}\newcommand{\PROD}[1]{\prod_{#1}^{\P}}$ $\newcommand{\NP}{\mathsf{NP}}\newcommand{\coNP}{\mathsf{coNP}}$ From the comments: >Why is $\SUM{1} = \NP$? Recall the definition of $\NP$ using certificates/proofs: >A langua...
null
Subset-sum : given a list of numbers, find if a non-empty sublist has sum 0 (there's a variation where we want sum=k instead of 0, but 0 is easier for analysis) Partition : given a list, can it be partitioned into two non-empty sublists with equal sum. I want to reduce subset-sum to partition. The reductions I fo...
reducing subset-sum to partition
|np-complete|reductions|partitions|
|complexity-theory|np-complete|reductions|partitions|
> **Subset-sum:** Given a list of numbers, find if a non-empty sublist has sum 0 (there's a variation where we want sum=k instead of 0, but 0 is easier for analysis) > **Partition:** Given a list, can it be partitioned into two non-empty sublists with equal sum? I want to reduce subset-sum to partition. The reduc...
> **Subset-sum:** Given a list of numbers, find if a non-empty sublist has sum 0 (there's a variation where we want sum=k instead of 0, but 0 is easier for analysis) > **Partition:** Given a list, can it be partitioned into two non-empty sublists with equal sum? I want to reduce subset-sum to partition. The reduc...
Could you express this in the fixpoint characterization for CTL formulas? That might help you prove their equivalence. http://www-2.cs.cmu.edu/~modelcheck/ed-papers/VTfFSCS.pdf
$\newcommand{\P}{\mathsf{P}}\newcommand{\PH}{\mathsf{PH}}$ $\newcommand{\SUM}[1]{\Sigma_{#1}^{\P}}\newcommand{\PROD}[1]{\Pi_{#1}^{\P}}$ $\newcommand{\NP}{\mathsf{NP}}\newcommand{\coNP}{\mathsf{coNP}}$ From the comments: >Why is $\SUM{1} = \NP$? Recall the definition of $\NP$ using certificates/proofs: >A langua...
Here's a lab from a first-year computer science course, taught in Scheme: https://www.student.cs.uwaterloo.ca/~cs135/assns/a07/a07.pdf At the end of the lab, it basically presents the halting problem, and shows that it is impossible to solve by introducing the function `diagonal`, which is defined as: (define ...
Showing the function=? is impossible
|undecidability|lambda-calculus|halting-problem|
null
Here's a lab from a first-year computer science course, taught in Scheme: https://www.student.cs.uwaterloo.ca/~cs135/assns/a07/a07.pdf At the end of the lab, it basically presents the halting problem, and shows that it is impossible to solve by introducing the function `diagonal`, which is defined as: (define ...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
null
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
This is precisely Moore's 1957 formulation of what is now more commonly known as the Bellman-Ford algorithm. **Why does it work?** -- Moore's algorithm is a special case of Ford's more general relaxation strategy for computing single-source shortest paths: while any edge is tense relax any tense ed...
1. You're absolutely right that this partition always occurs. If you consider what this means in terms of the corresponding subset, you'll find that this indicates that the empty set (which is always a subset) has sum 0. In fact, this indicates the there is always a solution to subset sum when the target is 0, which is...
Was looking at Godelization in Theory of Computation course. I could understand the Godel numbering concepts. But couldn't understand its importance in Theory of Computation. Anyone please point to some good materials or point out its importance
Godelization in Turing Machine
|turing-machines|church-turing-thesis|
|time-complexity|algorithm-analysis|amortized-analysis|
I was looking at Gödelization in Theory of Computation course. I could understand the Gödel numbering concepts, but couldn't understand its importance in Theory of Computation. Could anyone please point to some good materials or point out its importance.
Gödelization in Turing Machine
|formal-languages|turing-machines|
null
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
An option would be to use the Signature Scheme of [1], **size-based filtering**: a scheme which uses size information to reduce the number of set pairs that need to be considered. They also experiment with a weighted form; where weights are IDF-based. [1] [Arasu, Arvind, Venkatesh Ganti, and Raghav Kaushik. “Effi...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
My current research: ##Initial attempt at some general rules One can try to make some general rules for solving the rational comparison: Assuming all positive $a,b,c,d$: $$ a < b \wedge c \ge d \Longrightarrow \frac a b < \frac c d\\ $$ This basically means, if the left side is less than one, and the...
The following exercise gives me headaches: >Show: If the polynomial hierarchy is strict (i.e. $\forall k \in \mathbb{N}. \Sigma_k \neq \Sigma_{k+1}$), then there is no $\text{PH}$-complete problem for polynomial-time reductions (i.e. there is no problem $\text{P} \in \text{PH}$ such that each problem in $\text{PH}$ ...
Strict polynomial hierarchy and reduction
|complexity-theory|time-complexity|
null
Good question. Would you accept level of confidence? Perhaps do approximate division. I.e. To compute the bounding approximate quotients of a/b, right shift a by ceil(log_2(b)) and also by floor(log_2(b)). Then we know the accurate quotient is between these two values. Then, depending on the relative sizes of...
Given the discrete intervals $[a,b]\subset\mathbb{N}$ and $[c,d]\subset\mathbb{N}$, we might be able to do slightly better than binary search using the midpoint without utilizing gradient descent. Instead, we could use binary search with $x=\lfloor\frac{y-c}{d-c}(b-a)\rfloor$, which corresponds to the below intersec...
Gödel numbering in computer science means more or less "source code" and "data in binary format", so I hope the significance of this should be obvious if I can convince you that this really is so. Before modern computers came into existence, people made single-purpose computing devices (I am telling you a story, not...
null
Just an extended comment on the second part of the question (if I understood it correctly). The problem is a special case of the general version; so if you allow $0$ "fixed" points (a *fixed point* is a point that must be in a particular position in the Hamiltonian paths), then there is an immediate reduction from ...
We know that counting the number of Hamiltonian paths is in $\#\mathsf{P}$. So, what complexity (counting version) class would the counting the number of Hamiltonian paths that have two or three particular vertexes in a graph be in? Also, what would be like if counting the number of hampaths that have two or thre...
#P complexity reduction
|complexity-theory|
The problem for me is to construct DFA for a language of all strings defined over {o,1} whose length is even and number of 1s is odd. I am unable to construct DFA from given information. As two FAs can be combined by union of both FAs so i have constructed one FA for even length and other for odd number of 1s. And then...
Alternative to construct direct DFA
|regular-languages|finite-automata|
The problem for me is to construct DFA for a language of all strings defined over $\{0,1\}$ whose length is even and number of 1s is odd. I am unable to construct such a DFA from the given information. As two DFAs can be combined by union of both DFAs so I have constructed one DFA for even length and the other for odd ...
In Bellman ford algorithm , one has to find the shortest part from all vertex to a source vertex s. Initially all vertices beside s is made to infinity. Then each node from s is calculated and least distance is computed, this goes on for upto V-1 times. My question is first why is it upto V-1 times and my second q...
Bellman ford algorithm, does it matter if I take different series of edges when updating the cost of the vertex
|algorithms|shortest-path|
I posted [the same Q at programmers.SE][1], but nobody really helps. In the paper “An Extended Comparative Study of Language Support for Generic Programming” by Garcia et al. an interesting comparison of programming languages features for generic programming is given: ![table with comparison of GP-features][2] ...
Scala as a language for Generic Programming
|typing|
|programming-languages|typing|
I posted [the same Q at programmers.SE][1], but nobody really helps. In the paper “[An Extended Comparative Study of Language Support for Generic Programming][2]” by Garcia et al. an interesting comparison of programming languages features for generic programming is given: ![table with comparison of GP-features][...
From what I understand, your first algorithm intends to process the $a$ and $b$ inputs separately, which doesn't seem necessary. Your difficulty seems to come from formalizing a TM, which you can do in a couple ways. **Multitape Approach** - Suppose we know that a multitape TM is equivalent to a TM, so we can have ...
Optimization factoring: Input: $N\in \mathbb{N}$ Output: All prime factors of $N$ Decision factoring: Input: $N, x\in \mathbb{N}$ Output: True iff $N$ has factor of at most $k$ How can I solve the optimization problem in polynomial time if the decision problem is polynomially solvable?
Optimization-factoring $\le_p$ Decision-factoring
|reductions|
Optimization factoring: Input: $N\in \mathbb{N}$ Output: All prime factors of $N$ Decision factoring: Input: $N, k\in \mathbb{N}$ Output: True iff $N$ has a prime factor of at most $k$ How can I solve the optimization problem in polynomial time if the decision problem is polynomially solvable?
|optimization|reductions|factoring|
The [Bellman-Ford algorithm][1] determines the shortest path from a source $s$ to all other vertices. Initially the distance between $s$ and all other vertices is set to $\infty$. Then the shortest path from $s$ to each vertex is computed; this goes on for $|V|-1$ iterations. My questions are: - Why does there nee...
null
Bellman-Ford algorithm - Why can edges be updated out of order?
null
Running time of CDCL compared to DPLL
I am stuck in this problem. Can anyone help me. Thanks. Consider an array 'A' of 1st n natural numbers randomly permuted. Consider an array B formed from array A as given below B(k) = number of elements from A(1) to A(k-1) which are smaller than A(k) Obviously B(1) = 0; i) Given A can you find B in O(n) ...
Finding number of smaller elements for each element in an array efficiently
|algorithms|
You can use the decision version to search for the factors of $N$ by manipulating $k$. Given the input to the optimization version, you can ask if it has a prime factor less than or equal to $2$, $3$, ..., $\sim\sqrt{N}$ . Say you get your first answer at $k_{1}$, then because it didn't say yes before, $k_{1}$ must be ...
I am stuck on this problem: > Given an array $A$ of the first $n$ natural numbers randomly permuted, an array $B$ is > constructed, such that > $B(k)$ is the number of elements from $A(1)$ to $A(k-1)$ which are smaller than $A(k)$. > > i) Given $A$ can you find $B$ in $O(n)$ time? > ii) Given $B$ can you f...
null
I'm constructing a [deterministic finite automata][1] (DFA) for a language of all strings defined over $\{0,1\}$ whose length is even and number of $1$s is odd. I constructed each DFA separately and then combined: ![dfas and their union][2] - Is the given procedure for combining DFAs correct? **EDIT:** Orig...
Intersection of DFAs
null
You need to get an algorithm polynomial in $n$ where $n = \log N$ is the size of your input, i.e. the binary representation of $N$ (naive factorization algorithms are $O(N^2)$ which is of course exponential). Given `dec(k, x)` solving the decision factoring problem, let's write a procedure to find the smallest prime...
|automata|regular-languages|finite-automata|
You need to get an algorithm polynomial in $n$ where $n = \log N$ is the size of your input, i.e. the binary representation of $N$ (naive factorization algorithms are $O(N^2)$ which is of course exponential). Given `dec(k, x)` solving the decision factoring problem, let's write a procedure to find the smallest prime...
null
Please help me calculate the time complexity of the following program. int fun (int n) <br> {<br> if (n <= 2)<br> return 1;<br> else<br> return fun(sqrt(n)) + n;<br> }<br> Please explain.<br> There were four choices given.<br> (a) theta(n^2)<br> (b) theta(n log n)<br> (c) theta(log n)<br> (d)...
What is the time complexity of the following program?
|time-complexity|
The time complexity here is proportional to the depth of the recursion tree. At each level, the square root of `n` is taken. So how many times can the square root be taken before we get 2? This can be calculated in the same way shown at http://stackoverflow.com/questions/7280224/tn-sqrtn-tsqrtn-n. > n = 2<sup>lg ...
From my comment: [This](http://stats.stackexchange.com/questions/581/differences-between-baum-welch-and-viterbi-training) answer on crossvalidate.SE may be of use. I wasn't aware of viterbi-training. I have only used BW or other EM-based methods in the past. Based on the answer in the link, I think BW would be the m...