instruction stringlengths 0 29.8k ⌀ |
|---|
null |
Im taking a course on Theoretical computer Science. and I use Sipser's `Introduction to Theory of Computation` as my reference manual. However, many times I find myself lost in the proofs. Ive tried following Shai Simpson's online lectures ,but would prefer something more watered down and easier to understand. Im open... |
Supporting material for theory of computation |
|automata| |
Suppose I am making a red-black search tree, and in my right subtree, I have a black node, then a red node, and it has two black children, the black children further black childrens. As such a lemma has been made that red-black trees with $n$ internal nodes have height at most $2\log(n+1)$, would this proof still hold ... |
Can you have three consecutive black nodes in red-black search tree? |
|data-structures|binary-trees|search-trees| |
|computer-architecture|parallel-computing|matrices| |
To prevent collisions, hash tables with open addressing use a methodology to chain the contents. Why can't we use another hash table allocated to each slot of the primary hash table? |
Why can't we use a hash tables for collision resolving in hash tables? |
|data-structures|hash-tables| |
I have the following pseudo code:
Multiply(y,z)
1. if (z==0) return 0
2. else if (z is odd)
3. then return (Multiply(2y, floor(z/2)) + y )
4. else return (Multiply(2y, floor(z/2)))
Towards analysing this procedure's runtime, this recurrence relation is given... |
How does this recurrence relation fit the algorithm? |
|time-complexity|algorithm-analysis|asymptotics|recurrence-relation| |
You should be careful about what is being counted. If you want to count "runtime" (as in, number of statements) the given recurrence is clearly wrong.
Reverse-engineering from the recurrence, it is probably supposed to count *additions*. In particular, note how the computation the parameters for recursive calls is i... |
How do you prove that the expected height of a randomly built [binary search tree][1] with $n$ nodes is $O(\log n)$? There is a proof in CLRS _Introduction to Algorithms_ (chapter 12.4), but I don't understand it.
[1]: http://en.wikipedia.org/wiki/Binary_search_tree |
Proof that a randomly built binary search tree has logarithmic height |
|data-structures|algorithm-analysis|binary-trees|search-trees| |
Here is my proof, but I am not sure whether it is correct.
We know:
$\qquad \begin{array}{l}
\forall {c_1},\exists {n_1},0 \le f\left( n \right) \le {c_1}g\left( n \right),\forall n \ge {n_1} \\
\forall {c_1},\exists {n_2},0 \le g\left( n \right) \le {c_1}h\left( n \right),\forall n \ge {n_2} \\
\end{arra... |
How to prove transitivity in small-o of asymptotic analysis? |
|asymptotics|check-my-proof| |
I am new to this topic, and in some scientific papers I've been reading about prediction in sports I encountered the term rule based reasoner. Is it this term the same as a semantic reasoner( where the two main directions are forward and backwards chaining?). If yes, can you point out the difference between a decision ... |
|terminology|artificial-intelligence|data-mining| |
|data-structures|algorithm-analysis|binary-trees|search-trees|average-case| |
What's the use of studying trigonometry in computer science? I mean, is it essential? Does it have a specific application in computer science? Because I can't seem to muster enough motivation for learning it. |
Trigonometry in computer science |
|education|mathematical-analysis|applied-theory| |
> **Possible Duplicate:**
> [List of intro TCS books for those who don’t know much about TCS](http://cs.stackexchange.com/questions/454/list-of-intro-tcs-books-for-those-who-dont-know-much-about-tcs)
<!-- End of automatically inserted text -->
Im taking a course on Theoretical computer Science. and I use Sipser'... |
{"OriginalQuestionIds":[454],"Voters":[{"Id":98,"DisplayName":"Raphael"}]} |
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... |
Let's first think about this intuitively. In the best-case scenario, the tree is perfectly balanced; in the worst-case scenario, the tree is entirely unbalanced:
![Height-balanced binary search tree][1]![Worst-case binary search tree][2]
Starting from the root node $p$, this left tree has twice as many nodes at... |
From what I've read, an example of infinite ambiguity is usually given in a form of a loop:
$S \rightarrow aA \\
A \rightarrow B \\
B \rightarrow A \\
B \rightarrow b$
But a grammar is called *ambiguous* if there's more than 1 way to derive the input string ω. What if I then take this well-known ambiguou... |
What precisely is infinite ambiguity in a grammar? |
|formal-grammars| |
Let's first think about this intuitively. In the best-case scenario, the tree is perfectly balanced; in the worst-case scenario, the tree is entirely unbalanced:
![Height-balanced binary search tree][1]![Worst-case binary search tree][2]
Starting from the root node $p$, this left tree has twice as many nodes at... |
|terminology|formal-grammars|ambiguity| |
|algorithms|algorithm-analysis|runtime-analysis|average-case| |
I know I'm pretty late, but oh well.
There's a class of grammars known as indexed grammars (describing indexed languages, which are a proper subset of CS languages and a superset of CF languages). The rules look very much like the ones in a CF grammar, but every LHS nonterminal has an associated stack of *index symb... |
Consider this graph with $2k$ nodes:
![enter image description here][1]
<sup>[[source](http://verrech.net/sefiles/cs_4898.tikz)]</sup>
From how you describe how you choose the edges to be removed, it is not clear what should happen. If for all pairs $(1,k), (2,k), \ldots, (k-1,k)$ the same node is chosen, you ... |
###Closure Properties###
Once you have a small collection of non-context-free languages you can often use [closure properties](https://en.wikipedia.org/wiki/Context-free_language#Closure_properties) of $\mathrm{CFL}$ like this:
> Assume $L \in \mathrm{CFL}$. Then, by closure property X (together with Y), $L' \in \... |
null |
One can compress data with straight-line grammars. An algorithm that employs this technique is called *Sequitur*. If I understood correctly, Sequitur basically does these three steps till the grammar does not change anymore:
1. For each rule, try to find any sequences of symbols in any other rule that match the rule... |
Will this algorithm terminate on any input? |
|formal-grammars|data-compression| |
This is my idea for a proof although I am not quite sure whether it works:
Consider $r$, the number of symbols on all right-hand sides and $n$, the number of nonterminals. Whenever step one fires, $r$ decreases. Whenever step two fires, $n$ increases by one and $r$ stays the same (in case only two pairs are found) o... |
|algorithms|algorithm-analysis|formal-grammars|data-compression|correctness-proof| |
I know I'm pretty late, but oh well.
There's a class of grammars known as indexed grammars (describing indexed languages, which are a proper subset of CS languages and a superset of CF languages). The rules look very much like the ones in a CF grammar, but every LHS nonterminal has an associated stack of *index symb... |
Can all [packing problems][1] be rephrased as [set packing problems][2]?
Can all [covering problems][3] be rephrased as [set covering problems][4]?
In other words, I was wondering if set packing/covering problems are the most general forms of packing/covering problems?
BTW, do these problems belong to combinat... |
Can all packing/covering problems be rephrased as set packing/covering problems? |
|optimization| |
![search tree][1]
[1]: https://i.stack.imgur.com/2hUx4.jpg
**Problem : Two players have in front of
them a single pile of objects, say a stack of 7 pennies. The first player divides the original
stack into two stacks that must be unequal. Each player alternatively thereafter does the
same to some single st... |
Nim game tree + minimax |
|artificial-intelligence|search-trees|game-theory| |
Because - according to the rules above - each player must divide a stack into two stacks that must be unequal. |
I have two vector points: `p1` and `p2`. Each point has a color value `c1` and `c2`.
Now using `linear interpolation`, I would like to get the color value at point `p3`.
Concrete example:
p_1 = (1, 3) with color value c1 = (2, 4, 1)
p_2 = (4, 4) with color value c2 = (3, 1, 2)
What color does `p_3` have with... |
Computergraphics: Linear Interpolation |
|graphics|mathematical-programming| |
I have two vector points: `p1` and `p2`. Each point has a color value `c1` and `c2`.
Now using `linear interpolation`, I would like to get the color value at point `p3`.
Concrete example:
p_1 = (1, 3) with color value c1 = (2, 4, 1)
p_2 = (4, 4) with color value c2 = (3, 1, 2)
What color does `p_3` h... |
null |
There's a bit of ambiguity in what you're looking for here. I am going to assume it's the running time of the function.
I agree that it should be 1 when $z=0$ because it generally is considered to take $O(1)$ operations to return a function value. However, this will only affect your final answer by an additive con... |
null |
n no. of strings are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix x and of which M no.of strings have the prefix x. I have devised the following algorithm, where i search till i find the first occurance of the prefix x in one of the nodes. And then i run an... |
Can you have a binary search tree with O(logn + M) property for the following case |
|binary-trees|search-trees| |
null |
One can compress data with straight-line grammars. An algorithm that employs this technique is called *Sequitur*. If I understood correctly, Sequitur basically starts with one rule representing the input and then does these three steps till the grammar does not change anymore:
1. For each rule, try to find any seque... |
By making use of the fact that sorting $n$ numbers requires
$(n log n)$ steps for any optimal algorithm (which uses 'comparison' for sorting), how can I prove that finding the [convex-hull][1] of $n$ points has the lower bound of $ (n log n)$ steps?
[1]:http://en.wikipedia.org/wiki/Convex_hull |
Lower bound for Convex hull |
|complexity-theory| |
If you could create the convex-hull in sub $O(n log n)$ time, this would imply, that you can sort $n$ numbers in sub $O(nlogn)$ time.
You do this with contradiction. You have $n$ numbers $(x_1, x_2, \ldots, x_n)$, which you would like to sort. From these numbers, you create points $P$ in 2D space in some fashion. F... |
Let $n$ be the number of strings which are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix $x$ of which $M$ strings have the prefix $x$. I have devised the following algorithm, where I search until I find the first occurence of the prefix $x$ in one of the nod... |
null |
Let $n$ be the number of strings which are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix $x$ of which $M$ strings have the prefix $x$. I have devised the following algorithm, where I search until I find the first occurence of the prefix $x$ in one of the nod... |
If you could create the convex-hull in sub $O(n log n)$ time, this would imply, that you can sort $n$ numbers in sub $O(nlogn)$ time.
You do this with contradiction. You have $n$ numbers $(x_1, x_2, \ldots, x_n)$, which you would like to sort. From these numbers, you create points $P$ in 2D space in some fashion. F... |
If you could create the convex-hull in sub $O(n log n)$ time, this would imply, that you can sort $n$ numbers in sub $O(nlogn)$ time.
You do this with contradiction. You have $n$ numbers $(x_1, x_2, \ldots, x_n)$, which you would like to sort. From these numbers, you create points $P$ in 2D space in some fashion. F... |
By making use of the fact that sorting $n$ numbers requires
$(n \log n)$ steps for any optimal algorithm (which uses 'comparison' for sorting), how can I prove that finding the [convex-hull][1] of $n$ points has the lower bound of $\Omega (n \log n)$ steps?
[1]:http://en.wikipedia.org/wiki/Convex_hull |
|complexity-theory|computational-geometry|lower-bounds| |
The well known $SAT$ problem is defined [here][1] for reference sake.
The $DOUBLE- SAT $ problem is defined as-
$DOUBLE-SAT$ = {< $f$ > | $f$ has at least two satisfying assignments}
How do we prove it to be $NP- complete$ ?
More than one way to prove will be appreciated.
[1]:http://en.wikipedia.org/... |
Proving $DOUBE-SAT$ as $NP-complete$ |
|np-complete|satisfiability| |
By making use of the fact that sorting $n$ numbers requires
$(n \log n)$ steps for any optimal algorithm (which uses 'comparison' for sorting), how can I prove that finding the [convex-hull][1] of $n$ points is bounded by $\Omega (n \log n)$ steps?
[1]:http://en.wikipedia.org/wiki/Convex_hull |
null |
The well known SAT problem is defined [here][1] for reference sake.
The DOUBLE-SAT problem is defined as
DOUBLE-SAT = {< $f$ > | $f$ has at least two satisfying assignments}
How do we prove it to be NP-complete?
More than one way to prove will be appreciated.
[1]:http://en.wikipedia.org/wiki/Boolean_... |
Proving DOUBLE-SAT is NP-complete |
The well known SAT problem is defined [here][1] for reference sake.
The DOUBLE-SAT problem is defined as
DOUBLE-SAT = {<$\phi$> | $\phi$ has at least two satisfying assignments}
How do we prove it to be NP-complete?
More than one way to prove will be appreciated.
[1]:http://en.wikipedia.org/wiki/Bool... |
I have two vector points $p_1$ and $p_2$. Each point has a color value $c_1$ and $c_2$.
Now using *linear interpolation*, I would like to get the color value at point $p_3$.
Concrete example:
$\qquad \displaystyle p_1 = (1, 3) \text{ with } c_1 = (2, 4, 1)$
$\qquad \displaystyle p_2 = (4, 4) \text{ with } c_2... |
Computer graphics: Linear Interpolation |
|graphics| |
The well known SAT problem is defined [here][1] for reference sake.
The DOUBLE-SAT problem is defined as
$\qquad \mathsf{DOUBLE\text{-}SAT} = \{\langle\phi\rangle \mid \phi \text{ has at least two satisfying assignments}\}$
How do we prove it to be NP-complete?
More than one way to prove will be appreciat... |
You know that $\mathsf{SAT}$ is NP-complete. Can you find a reduction from $\mathsf{SAT}$ to $\mathsf{DOUBLE\text{-}SAT}$? That is, can you manipulate a satisfiable formula so that the result has at least two satisfying assignments? Note that the same manipulation can not render unsatisiable formulae satisfiable.
>!... |
Here is one solution:
Clearly Double-SAT belongs to NP, since a NTM can decide Double-SAT as follows: On a Boolean input formula $\phi$ (x1, ... ,xn), nondeterministically guess 2 assignments and verfy whether both satisfy $\phi$.
To show that Double-SAT is NP-Complete, we give a reduction from SAT to Double-SAT... |
Here is one solution:
Clearly Double-SAT belongs to ${\sf NP}$, since a NTM can decide Double-SAT as follows: On a Boolean input formula $\phi(x_1,\ldots,x_n)$, nondeterministically guess 2 assignments and verify whether both satisfy $\phi$.
To show that Double-SAT is ${\sf NP}$-Complete, we give a reduction fro... |
|complexity-theory|np-complete|satisfiability| |
Here is one solution:
Clearly Double-SAT belongs to ${\sf NP}$, since a NTM can decide Double-SAT as follows: On a Boolean input formula $\phi(x_1,\ldots,x_n)$, nondeterministically guess 2 assignments and verify whether both satisfy $\phi$.
To show that Double-SAT is ${\sf NP}$-Complete, we give a reduction fro... |
null |
null |
If you could create the convex-hull in sub $O(n \log n)$ time, this would imply, that you can sort $n$ numbers in sub $O(n\log n)$ time.
You do this with contradiction. You have $n$ numbers $(x_1, x_2, \ldots, x_n)$, which you would like to sort. From these numbers, you create points $P$ in 2D space in some fashion... |
If you could create the convex-hull in $o(n \log n)$ time, this would imply, that you can sort $n$ numbers in $o(n\log n)$ time.
You do this with contradiction. You have $n$ numbers $(x_1, x_2, \ldots, x_n)$, which you would like to sort. From these numbers, you create points $P$ in 2D space in some fashion. For ex... |
By making use of the fact that sorting $n$ numbers requires
$\Omega(n \log n)$ steps for any optimal algorithm (which uses 'comparison' for sorting), how can I prove that finding the [convex-hull][1] of $n$ points is bounded by $\Omega (n \log n)$ steps?
[1]:http://en.wikipedia.org/wiki/Convex_hull |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.