instruction
stringlengths
0
29.8k
⌀
You need to have a non-negative sufficiently large input size $n$ from which point on the bound holds. Because we want to be precise, don't look at the *informal* but rather at the *formal* definition on Wikipedia. That and the definition of CLRS are not conflicting. This also supports our intuition. For example, we ar...
I want to show that reasonable advice can really speed up computation. Show, that every time-constructible function $t$, there exists a set $S$ in time $DTIME(t^2) \setminus DTIME(t)$ that can be decided in linear time using an advice of linear length, $S \in DTIME(l) \setminus l$ (definition in analogue to $P \set...
advice speeds up computations
|complexity-theory|
I want to show that reasonable advice can really speed up computation. Show, that every time-constructible function $t$, there exists a set $S$ in time $\text{DTIME}(t^2) \setminus \text{DTIME}(t)$ that can be decided in linear time using an advice of linear length, $S \in \text{DTIME}(l) \setminus l$ (definition i...
Advice speeds up computations
|complexity-theory|time-complexity|
You need to have a non-negative sufficiently large input size $n$ from which point on the bound holds. Have a look the Figure 3.1 in CLRS, which shows graphically examples of the $O, \Theta$ and $\Omega$ notation. You can also see why this makes sense. For example, we are interested in knowing how an algorithm's runtim...
I am trying to get better in proofs and deep understanding of concept of **computational complexity**. Unfortunately, so far, with no success. In order to get more intuition, I decided to do more exercises, but most of them are still difficult for me. I am looking for exercises with solutions in field of computat...
execises in computational complexity
|complexity-theory|
I want to show that reasonable advice can really speed up computation. Show, that every time-constructible function $t$, there exists a set $S$ in time $\text{DTIME}(t^2) \setminus \text{DTIME}(t)$ that can be decided in linear time using an advice of linear length, $S \in \text{DTIME}(l) / l$ (definition in analog...
Hint: Start with a problem in $\mathrm{DTIME}(e^{2t}) \setminus \mathrm{DTIME}(e^t)$.
null
I had a course held by Jiri Srba a few years ago on basic complexity and computability theory is good, I would say. The second part (Lecture 9 to 15) goes through time and space complexity, shows some important results on the field and has pdf's of both exercises and solutions for each lecture. It is based on the book...
If we restrict consideration to $\mathbb{N}$ and both functions are strictly positive on every $n \in \mathbb{N}$, then it is true that, if $f(n) \in \Theta(g(n))$, then there exists a $c$ such that $f(n) \leq cg(n)$ for all $n$, and vice versa. (As pointed out in the comments, if the functions can be negative, then...
Current chess algorithms go about 1 or maybe 2 levels down a tree of possible paths depending on the player's move's and the opponent's moves. Let's say that we have the computing power to develop an algorithm that predicts all possible movements of the opponent in a chess game. An algorithm that has all the possible p...
Can there be a perfect chess algorithm?
|algorithms|turing-machines|
First of all, I believe that chess algorithms look more than 2 plies down, although they don't consider all different possibilities; pruning the search tree is very important to avoid the combinatorial explosion in the number of possible moves. For a game like chess, there are three possibilities as to the identity ...
This is what I had mind to prove it's undecidable. Let $ A = \{\langle M, w \rangle \mid M \text { is a TM, } M \text { accepts } w \text { and on input } w^R \text { halts and rejects} \} $ Assume $A$ is decidable. Let $H$ be a $TM$ deciding it. Construct $TM$ $K$ deciding $A_{TM}$ as follows $K$: ''On i...
First of all, good chess algorithms look further than 1 or 2 levels. Rather than using naive tree search, they perform [alpha-beta pruning](http://en.wikipedia.org/wiki/Alpha-beta_pruning) to narrow down the number of options to consider. Note that for openings and end games, a large database of moves is used as it h...
null
This is a homework question. I do not want the solution - I'm offering the solution I've been thinking of and wish to know whether is it good or why is it flawed. My motivation is to find what edges of an unweighted, undirected graph are not a part of any MST. This problem only makes sense when several edges have ...
What edges are not in any MST
|graphs|spanning-trees|
Determining whether a CFG is $LL(k)$ for any $k$?
|algorithms|arrays|
|formal-languages|formal-grammars|semantics|
The running time of the function on an input $n$ can be expressed as: $$T(n) = T(\sqrt n) + \mathcal{O}(1)$$ which implies the running time of the function and the number of recursions differ only by a constant. The recursive chain ends when $n$ has been reduced to some value $k$, where $k \le 2$. The number of r...
*Since you asked on a computer science site, I'll give you a computer science answer. This might not be the most directly helpful from a programmer's point of view, though understanding this will definitely make you a better programmer.* The first argument to the `printf` function is a `char *`, i.e. a pointer to a ...
You can construct a recognizer that simply simulates M on w and then simulates M on $w^R$. This will halt in finite time for all <M, w> that are in A (by definition), and then you can accept if the first simulation accepted and the second rejected. That suffices for the language being recognisable (recursively enumerab...
null
The different dimensions are **independent**. What you can do is compute, for each dimension *j*, how many different walks there are in just that dimension which take $t$ steps. Let us call that number $W(j,t)$. From your question, you already know how to compute these numbers with dynamic programming. Now, it's e...
null
You can construct a recognizer that simply simulates M on w and then simulates M on $w^R$. This will halt in finite time for all <M, w> that are in A (by definition), and then you can accept if the first simulation accepted and the second rejected. That suffices for the language being recognisable (recursively enumerab...
Undecidability of the following language
I have recently become extremely interested in understanding and proving aspects of (functional) programming languages. However as I dive deeper in, things like lambda calculus, category theory, and denotational syntax are a little difficult to grok without proper explanation. I read SICP (quite an enlightening b...
Studying Programming Language Theory
|lambda-calculus|functional-programming|books|
null
|reference-request|lambda-calculus|functional-programming|books|
It is not easy to come by books that consider the denotational semantics of $\lambda$-calculus. One possibility is: 1. Roberto M. Amadio and Pierre-Louis Curien: [Domains and Lambda-Calculi][1] Type-theoretic accounts are easier to get hold of: 1. Bob Harper, [Practical Foundations of Programming Languages][2]...
I have recently become extremely interested in understanding and proving aspects of (functional) programming languages. However as I dive deeper in, things like $\lambda$ calculus, category theory, and denotational syntax are a little difficult to grok without proper explanation. I read SICP (quite an enlightenin...
This is a homework question. I do not want the solution - I'm offering the solution I've been thinking of and wish to know whether is it good or why is it flawed. My motivation is to find what edges of an weighted, undirected graph are not a part of any MST. This problem only makes sense when several edges have the ...
This is a homework question. I do not want the solution - I'm offering the solution I've been thinking of and wish to know whether is it good or why is it flawed. My motivation is to find what edges of an weighted, undirected graph are not a part of any MST. This problem only makes sense when several edges have the ...
*Edit: removed hints, posted my solution.* Here is my solution. We're going to pick a reference point $x$ where $f(x) \in L$ and consider the universe from $x$ and $f(x)$'s points of view. It turns out that every "neighborhood" of a point corresponds to a recursive language. So $L$ is a neighborhood around $f(x)$, a...
*Edit: removed hints, posted my solution.* Here is my solution. We're going to pick a reference point $x$ where $f(x) \in L$ and consider the universe from $x$ and $f(x)$'s points of view. It turns out that every "neighborhood" of a point corresponds to a recursive language. So $L$ is a neighborhood around $f(x)$, a...
null
Let $ A = \{\langle M, w \rangle \mid M \text { is a TM, } M \text { accepts } w \text { and on input } w^R \text { halts and rejects} \} $. We prove that $A$ is not decidable by showing $\text{HALT}\le_m A$. The reduction works as follows. Let $\langle M, w \rangle $ be an instance of $\text{HALT}$, then we const...
You are right: the language $L$ from your question is accepted by a (nondeterministic) one-counter automaton. Now for the deterministic case. Counter automata are a special case of push-down automata, where one only uses a single stack symbol (apart from a bottom-of-stack). Every (deterministic) one-counter language...
Let $ A = \{\langle M, w \rangle \mid M \text { is a TM, } M \text { accepts } w \text { and on input } w^R \text { halts and rejects} \} $. We prove that $A$ is not decidable by showing $\text{HALT}\le_m A$. The reduction works as follows. Let $\langle M, w \rangle $ be an instance of $\text{HALT}$, then we const...
I can understand that they are not closed under concatenation because without non determinism, PDA cannot decide whether to loop in the first PDA or jump to the next one. But can someone prove this with an example. Also prove that the resulting language cannot be accepted by DPDA
why are deterministic PDAs not closed under concatenation?
|automata|pushdown-automata|
null
Pick the languages: $L_1 = \{a^ib^jc^k | i \neq j \}$ and $L_2 = \{a^ib^jc^k | j \neq k\}$; both are DCFL and $L_3 = 0L_1 \cup L_2$ is DCFL, too. $L_0 = 0^*$ is DCFL (regular) But $L_{conc} = L_0 \cdot L_3 = 0^* L_3$ is not DCFL. **Proof:** Suppose that $L_{conc}$ (which is the concatenation of two DCFLs) i...
Pick the languages: $L_1 = \{a^ib^jc^k | i \neq j \}$ and $L_2 = \{a^ib^jc^k | j \neq k\}$; both are DCFL and $L_3 = 0L_1 \cup L_2$ is DCFL, too. $L_0 = 0^*$ is DCFL (regular) But $L_{conc} = L_0 \cdot L_3 = 0^* L_3$ is not DCFL. **Proof:** Suppose that $L_{conc}$ (which is the concatenation of two DCFLs) i...
Some background info: You may want to start by learning about learning with perceptrons. It may also be useful to read up a bit on kernel methods in machine learning and Lagrange multipliers and how to apply them in different optimization tasks. For understanding the theory: There is a really good [tutorial on S...
null
In principle, chess is solvable like any other game. As the other answers have pointed out, however, this is not expected to happen anytime soon. That said, there has been some recent developments in this direction. [1] claims to have shown that the chess opening called **King's Gambit is solved**: there's only on...
The obvious answer is of course to keep a hash map and store a counter of the occurrence of elements as you move through the file as Nejc already suggested. This is (in terms of time complexity) the optimal solution. If however, your space requirements are tight you can perform an [external sort][1] on the file and ...
Current chess algorithms go about 1 or maybe 2 levels down a tree of possible paths depending on the player's move's and the opponent's moves. Let's say that we have the computing power to develop an algorithm that predicts all possible movements of the opponent in a chess game. An algorithm that has all the possible p...
When you have a *really* large file and *many* elements in it, but the most common element is very common -- occurs $> 1/k$ fraction of the time -- you can find it in linear time with space $O(k)$ words ( the constant in the $O()$ notation is very small, basically 2 if you don't count the storage for auxiliary things l...
Below is the general code for DFS with logic for marking back edges and tree edges.My doubt is that back edges from a vertex go back and point to an ancestor and those which point to the parent are not back edges(Lets assume undirected graph).In an undirected graph we have an edge back and forth between 2 vertices x an...
Does the DFS algorithm doesnt differentiate between an ancestor and a parent while computing back edges?
|algorithms|graphs|
I'd really like your help with this question from past midterm that I'm solving now in order to prepare myself for my own midterm in "Computational Complexity Theory" course. The question is: For which values $A,B$ the problem $Gap-VC-[A,B]$ is $Np-Hard$? where $"VC"$ is the vertex-cover problem. there are three opt...
For what values this $Gap-VC-[A,B]$ is $NP-HARD$?
|complexity-theory|approximation|
null
**Facts:** n points in the plane, each has one of k colors, all k colors are represented. **Problem:** You wish to select k points, one of each color, such that the perimeter of the convex hull is as small as possible. **Greedy algorithm:** For each point p, for each color c not equal to p, select the point of co...
Show that approximation ratio for a convex hull problem is $\pi/2$
|algorithms|approximation|greedy-algorithms|
I am a non-CS grad and my field of study is unrelated to CS. However, as part of a larger plan to become a computer scientist, I want to obtain a solid background in theoretical computer science and math as it relates to CS. I did a plenty of research and selected the following best/really good books on the topic of CS...
Theoretical CS and Math - self-study recommendations
|books|
Your question is akin to the old chestnut "What happens when an irresistible force meets an immovable object?" The problem is in the question itself: the two entities as described cannot exist in the same logically consistent universe. Your optimal algorithm, an algorith that always wins, cannot be played by both sid...
Show that approximation ratio for a convex hull algorithm is $\pi/2$
Here is a suggestion as to where to start. Suppose that the optimal solution has diameter $D$. Its optimal value is at least $2D$. If you could somehow show that the set selected by the greedy algorithm has diameter $d \leq D$, then it would follow that its value is at most $\pi d \leq \pi D$.
Your list is extremely problematic. To start with, I would flatly skip books 6,11,12,14,15,16,17: Books 6, 11 and 15 are general mathematics which is not really needed unless you become a _theoretical_ researcher. Books 12 and 14 cover recursion theory which is not computer science (even though it deals with computa...
You might also consider taking advantage of some of the many online courses available. For example, both [Stanford][1] and [MIT][2] offer (free) online courses in computer science, and I think there are many others available as well. As far as books go, I second most of Yuval's recommendations, except that CLRS i...
For which values $A,B$ is the problem $\mathsf{gap\mathord-VC}\mathord-[A,B]$ NP-hard? VC is the [vertex cover](http://en.wikipedia.org/wiki/Vertex_cover) problem. I am given three options: $B=\frac{3}{4},A=\frac{1}{2}$ or $B=\frac{3}{4},A=\frac{1}{4}$ or none. I would to review what I think that I need to do, I'm ...
For what values of A and B is the gap-VC-[A,B] problem NP-HARD?
|complexity-theory|graphs|approximation|
You are right: the language $L$ from your question is accepted by a (nondeterministic) one-counter automaton. Now for the deterministic case. Counter automata are a special case of push-down automata, where one only uses a single stack symbol (apart from a bottom-of-stack). Every (deterministic) one-counter language...
The following is an excerpt from [CLRS][1]: >The definition of $g(n)$ requires that every member $f(n) \in \Theta(g(n))$ be asymptotically nonnegative, that is, that $f(n)$ be nonnegative whenever n is sufficiently large. (An asymptotically positive function is one that is positive for all sufficiently large $n$). Con...
Why does every member $f(n) \in \Theta(g(n))$, and $g(n)$ have to be asymptotically non-negative?
|complexity-theory|asymptotics|
I have been attempting to get my mind around the [Kuhn-Munkres/Hungarian Algorithm](http://en.wikipedia.org/wiki/Hungarian_algorithm). I have been using the following statement of the algorithm which I found [here](http://www.math.uwo.ca/~mdawes/courses/344/kuhn-munkres.pdf). ![Kuhn-Munkres Algorithm][1] Based on...
Clarification with Kuhn-Munkres/Hungarian Algorithm
|bipartite-matching|
Mostly for convenience's sake. Since big-theta notation specifically tends to be used mostly for algorithmics (as opposed to $O()$ and especially $o()$, which make occasional appearances in more 'traditional' mathematics for talking about goodness of estimates) and is generally used to measure 'usage' quantities of so...
null
I'm familiar with the classical convex hull calculation algorithms. The lower bound for computing the CH of a set of points $P$ is $n\log(n)$. However, what if I'm given a sequence of points and told they form a CH? One check is to "walk the points" in order and check for "left turns" (CCW). However, this doesn't h...
Validating a sequence of points as a convex hull
|untagged|
I came across a couple of solutions to one of the problems that is in the CLRS textbook (pg. 637 23.2-5 edition 3). I am wondering if anyone can make a clarification as to the stated running time of the solution. Q: given that we know the edge weights on a graph are between 1 and some constant W how fast can we ma...