instruction stringlengths 0 29.8k ⌀ |
|---|
|automata|regexp| |
null |
Perhaps this is an interesting question with explicit answers, but you probably really have a problem with "exactly how to define this".
A list does not directly corresponds to a unique data structure, nor does a tree. A singly linked list corresponds to a (sufficiently unique) data structure, as does a binary tree.... |
other answers address the question directly. for more/deeper background, this paper by Lafitte on the subj considers the larger context of busy beaver-like functions & has some results/theorems fitting the idea into a more general framework. it shows that (informally) "busy beaver-like functions" have a close connectio... |
You must remember that the vertices diagonal from one another can be colored the same! Your formula does not take that into account.
Inclusion-exclusion principle tells us that given some ground set $|X|=n$, the number of elements of $X$ which lie in none of the subsets $A_i$ is
$$ \sum_{I \subseteq [n]} (-1)^{|I|}... |
You must remember that the vertices diagonal from one another can be colored the same! Your formula does not take that into account.
Inclusion-exclusion principle tells us that given some ground set $|X|=n$, the number of elements of $X$ which lie in none of the subsets $A_i$ is
$$ \sum_{I \subseteq [n]} (-1)^{|I|}... |
This follows from the following three claims:
### Claim 1: ###
> if $L_1 \subseteq L_2$, then $L_1^* \subseteq L_2^*$.
### Claim 2: ###
>$L(0+1) \subseteq L(0^*1^*)$
### Claim 3: ###
>$ (0^*1^*)^* \subseteq (0+1)^* \equiv \Sigma^*$
The 2nd and 3rd claims are trivial. Prove the first claim and you're do... |
The language of both regular expressions is the same, $L((0+1)^*)=L((0^*1^*)^*)$. This follows from the following three claims:
### Claim 1: ###
> if $L_1 \subseteq L_2$, then $L_1^* \subseteq L_2^*$.
### Claim 2: ###
>$L(0+1) \subseteq L(0^*1^*)$
### Claim 3: ###
>$ (0^*1^*)^* \subseteq (0+1)^* \equiv \S... |
I want to filter efficiently a list of integers for duplicates in a way that only the resulting set needs to be stored.
One way this can be seen:
- we have a range of integers $S = \{1, \dots{}, N\}$ with $N$ big (say $2^{40}$)
- we have a function $f : S \to S$ with, supposedly, many collisions (the images ... |
in recent years the field of "collective intelligence" or sometimes known as "Web2.0" has had a big impact on computer science, software engineering, and software development. Stackexchange software itself is a large scale evolving application/implementation and experiment along the lines of harnessing collective intel... |
references on collective intelligence wrt CS apps |
|reference-request|education|software-engineering|books| |
- [Programming Collective Intelligence: Building Smart Web 2.0 Applications](http://www.amazon.com/Programming-Collective-Intelligence-Building-Applications/dp/0596529325/) by Segaran
- [Collective Intelligence in Action](http://www.amazon.com/Collective-Intelligence-Action-Satnam-Alag/dp/1933988312/) by Alag
- [... |
X[0] = 0
for i = 1 to N-1
X[i] = uniform(0,1)
X[n] = 1
sort X[0..N]
for i = 1 to N
Z[i] = X[i] - X[i-1]
return Z[1..N]
Here, `uniform(0,1)` returns a real number independently and uniformly distributed between 0 and 1.
|
Given a directed graph and two distinct vertices S and T, is there a polynomial-time algorithm which finds every vertex which is on at least one simple path from S to T?
It is not difficult to find all vertices that are both successors of S and predecessors of T but this is only a superset of the set above. For exam... |
How to find the vertices on simple path between two given vertices in a directed graph |
|algorithms|graphs| |
Given a directed graph and two distinct vertices S and T, is there a polynomial-time algorithm which finds every vertex which is on at least one simple path from S to T?
It is not difficult to find all vertices that are both successors of S and predecessors of T but this is only a superset of the set above. For exam... |
You must remember that the vertices diagonal from one another can be colored the same! Your formula does not take that into account. We can find the chromatic number of a graph via the inclusion-exclusion principle. It is a very general counting technique that allows us to count complex structures, if we can prove cert... |
null |
|formal-languages|regular-languages|regular-expressions| |
|reference-request|machine-learning|education|learning-theory| |
The [answer by Nicholas above][2] and [this one][1] helped me see the flaw in my thinking. I thought of elaborating more specifically upon Nicholas',
> You must remember that the vertices diagonal from one another can be colored the same
and also obtain the chromatic polynomial by adjusting for my wrong reasonin... |
|formal-languages|regular-languages|closure-properties| |
The above answer is correct, but there is a little more that can be said about infinite alphabets and computability.
A Turing Machine is described in WP as $M = (Q, \Gamma,b,\Sigma,\delta, q_0, q_f)$ in which all sets are finite. Thus the transition function $$ \delta: Q / F \times \Gamma \rightarrow Q \times\Gamma... |
The above answer is correct, but there is a little more that can be said about infinite alphabets and computability.
A Turing Machine is described in WP as $M = (Q, \Gamma,b,\Sigma,\delta, q_0, q_f)$ in which all sets are finite. Thus the transition function $$ \delta: Q / F \times \Gamma \rightarrow Q \times\Gamma... |
I am trying to derive the <a href="http://alexandria.tue.nl/repository/freearticles/597601.pdf">classic paper</a> in the title only by elementary means (no generating functions, no complex analysis, no Fourier analysis) although with much less precision. In short, I "only" want to prove that the average height $h_n$ of... |
On "The Average Height of Planted Plane Trees" by Knuth, de Bruijn and Rice (1972) |
|combinatorics|discrete-mathematics|trees|average-case|random-walks| |
This is an NP-hard problem.
@article{DBLP:journals/tcs/FortuneHW80,
author = {Steven Fortune and
John E. Hopcroft and
James Wyllie},
title = {The Directed Subgraph Homeomorphism Problem},
journal = {Theor. Comput. Sci.},
volume = {... |
The above answer is correct, but there is a little more that can be said about infinite alphabets and computability.
A Turing Machine is described in WP as $M = (Q, \Gamma,b,\Sigma,\delta, q_0, q_f)$ in which all sets are finite. Thus the transition function $$ \delta: Q / F \times \Gamma \rightarrow Q \times\Gamma... |
The above answer is correct, but there is a little more that can be said about infinite alphabets and computability.
A Turing Machine is described in WP as $M = (Q, \Gamma,b,\Sigma,\delta, q_0, q_f)$ in which all sets are finite. Thus the transition function $$ \delta: Q / F \times \Gamma \rightarrow Q \times\Gamma... |
I've read the wikipedia page for [rule 110][1] in cellular automata, and I more or less know how they work (a set of rules decides where to draw the next 1 or 0).
I've just read they're Turing complete, but I can't even fathom how would you 'program' in 'rule 110'?
[1]: http://en.wikipedia.org/wiki/Rule_110 |
How is rule 110 turing complete? |
|untagged| |
|algorithms|graphs| |
|turing-completeness|cellular-automata| |
From Matthew's proof:
"*The approach taken here is not to design a new cellular automaton,
but to take the very simplest one that naturally exhibits complex behav-
ior, and see if we can find within that complex behavior a way to make
it do what we want. We will not concern ourselves directly with the
lookup tab... |
From Matthew's proof:
"*The approach taken here is not to design a new cellular automaton,
but to take the very simplest one that naturally exhibits complex behav-
ior, and see if we can find within that complex behavior a way to make
it do what we want. We will not concern ourselves directly with the
lookup tab... |
In recent years the field of "collective intelligence" sometimes known as [Web 2.0](http://en.wikipedia.org/wiki/Web_2.0) has had a big impact on computer science, software engineering, and software development. Stackexchange software itself is a large scale evolving application or implementation and experiment along t... |
Other answers address the question directly. For more and deeper background, this paper by Lafitte on the subject considers the larger context of busy beaver-like functions. It also has some results and theorems fitting the idea into a more general framework. It shows that (informally) "busy beaver-like functions" have... |
The Hartmanis-Stearns [time](http://en.wikipedia.org/wiki/Time_hierarchy_theorem) and [space](http://en.wikipedia.org/wiki/Space_hierarchy_theorem) hierarchy theorems prove that there is no "fastest growing" function in terms of time or space because the scale is unbounded. But it does give an _ordering_ such that all ... |
References on collective intelligence with respect to CS applications |
Thanks for your answers.
As master foo pointed, the second problem:
Given a directed graph and three distinct vertices S and T and I, deciding if there exist a simple path from S to T going through I, is indeed NP complete.
From the paper from Steven Fortune and John E. Hopcroft and James Wyllie, it is clear that ... |
null |
_I wonder whether the massively parallel computation units provided in graphic cards nowadays are good enough to simulate 1D cellular automata (or maybe 2D cellular automata?) efficiently._
being very general, yes GPU computing is the best alternative in standard hardware available for everybody.
More in detail; ... |
_I wonder whether the massively parallel computation units provided in graphic cards nowadays are good enough to simulate 1D cellular automata (or maybe 2D cellular automata?) efficiently._
being very general, yes GPU computing is the best alternative in standard hardware available for everybody.
More in detail; ... |
_I wonder whether the massively parallel computation units provided in graphic cards nowadays are good enough to simulate 1D cellular automata (or maybe 2D cellular automata?) efficiently._
being very general, yes GPU computing is the best alternative in standard hardware available for everybody.
More in detail; ... |
Say there is a data table $D$ that we cannot see, with $M$ columns. We are given exact cross-tabulation frequencies for all ${M \choose 2}$ pairs of columns.
From the cross-tabs, we can derive a set of possible rows $R$ of $D$ and maximum frequencies for each possible row.
How can we reconstruct the original tabl... |
Reconstructing a data table from cross-tabulation frequencies |
|algorithms| |
I am learning about graph coloring. One of the exercise problems(grimaldi) led me to derive the chromatic polynomial for any cycle($C_n, n \ge 3$).
$P(C_n, \lambda) = (\lambda - 1)^n + (-1)^n(\lambda - 1)$, where $\lambda$ is the number of colours available
Is it possible to interpret the terms of above polynomia... |
Chromatic polynomial of a cycle - Interpreting its terms |
|graphs| |
null |
I am dealing with the problem of computing $ s = \lfloor sqrt(x)\rfloor$ with $x \in [0,30^2]$. The common "sqrtf(x)" on C language is too slow for this case, however it always gives me the correct result. I've tried with the Newton's method and i get very small errors when the square root of a number is exact, leading... |
fastest square root method with exact integer result? |
|algorithm-analysis| |
I am dealing with the problem of computing $ s = \lfloor sqrt(x)\rfloor$ with $x \in [0,30^2]$. The common "sqrtf(x)" on C language is too slow for this case, however it always gives me the correct result. I've tried with the Newton's method but i get very small errors when the square root of a number is exact. This le... |
I am studying algorithms from CLRS book.I am trying to understand the difference between
- probability of hiring **ith** person from n persons
- probability of hiring **ith** person from n persons based on ranks
Using the normal probability we know the answer for the first one is **1/(n-i)** and the answer fo... |
Hiring a person from n persons - Rank and Probablity |
|algorithms|randomized-algorithms|probabilistic-algorithms| |
When people is interviewed following a *random* arrival order, the probability of candidate *i* of being hired is *1/i*. This follows from the fact that, assuming a random order of arrivals, for each *i* the group of initial *i* candidates is random, so that the *i*-th candidate has probability *1/i* of being assumed, ... |
The following book is a very good and complete source on Machine Learning:
> [Neural Networks and Learning Machines, Third Edition][1] is renowned for its thoroughness and readability. This well-organized and completely up-to-date text remains the most comprehensive treatment of neural networks from an engineering p... |
|computability|automata|turing-completeness|cellular-automata| |
From Matthew's proof:
> The approach taken here is not to design a new cellular automaton,
but to take the very simplest one that naturally exhibits complex behav-
ior, and see if we can find within that complex behavior a way to make
it do what we want. We will not concern ourselves directly with the
lookup tab... |
Thanks for your answers.
As [master foo pointed out](http://cs.stackexchange.com/a/4778/98), the second problem -- given a directed graph and three distinct vertices $s, t$ and $i$, decide if there exist a simple path from $s$ to $t$ going through $i$ -- is indeed NP-complete.
From the paper [The Directed Subgraph ... |
Say there is a data table $D$ that we cannot see, with $M$ columns. We are given exact [cross-tabulation](https://en.wikipedia.org/wiki/Cross_tabulation) frequencies for all ${M \choose 2}$ pairs of columns, that is how often each combination of two values occurs.
From the cross-tabulations, we can derive a set of p... |
I am dealing with the problem of computing $ s = \lfloor sqrt(x)\rfloor$ with $x \in [0,30^2]$. The common `sqrtf(x)` on C language is too slow for this case, however it always gives me the correct result. I've tried with the Newton's method but I get very small errors when the square root of a number is exact. This le... |
Fastest square root method with exact integer result? |
|algorithms|integers|discrete-mathematics| |
I am studying algorithms from CLRS book. I try to understand the difference between
- probability of hiring the $i$th person out of $n$ and
- probability of hiring the $i$th person out of $n$ persons based on ranks.
Using the normal probability, we know the answer for the first one is $\frac{1}{n-i}$ and the ... |
Hiring one person out of n -- rank and probablity |
|probability-theory| |
When people are interviewed following a *random* arrival order, the probability of candidate $i$ being hired is $\frac{1}{i}$. This follows from the fact that, assuming a random order of arrivals, for each $i$ the group of initial $i$ candidates is random, so that the $i$-th candidate has probability $\frac{1}{i}$ of b... |
Say there is a data table $D$ that we cannot see, with $M$ columns. We are given exact [cross-tabulation](https://en.wikipedia.org/wiki/Cross_tabulation) frequencies for all ${M \choose 2}$ pairs of columns, that is how often each combination of two values occurs.
From the cross-tabulations, we can derive a set of p... |
What's the best way that anyone can do to have a good introduction to the theory of distributed system, any books or references, and topics should be covered first and requirements to start learning in this topic. |
Start learning about Theory of Distributed Systems? |
|distributed-systems| |
|reference-request|education|distributed-systems| |
A 3CNF formula with $n$ variables and $c$ clauses can be represented on a TM tape with a binary string in the following way (I think it is a reasonable compact representation):
$0^n \; 1^c \; 0 \; (( (0|1)^{\log n} \; (0|1) )^3)^c$
$n$ leading $0$s that represent the number of variables, followed by<br>
$c$ $1$s... |
Time complexity of an enumeration of 3SAT formulas |
|turing-machines| |
A good start would by [Distributed Systems](http://groups.csail.mit.edu/tds/distalgs.html) by Nancy Lynch. It is perhaps a little dated, but nothing is wrong with the book as such. An impossibility result does not change with time. |
|algorithms|formal-languages|turing-machines|enumeration| |
I am learning algorithms.. So, I came along with something very interesting.
The asymptotic bound of linear equation ( `(a*n)+b` ) is `O(n^2)`.. for all `a>0`.
This is same that of not so surprising.. `a* n^2 + b* n + c` |
Why bound of linear function is same as that of quadratic equation |
|algorithms|complexity-theory|time-complexity| |
A 3CNF formula with $n$ variables and $c$ clauses can be represented on a TM tape with a binary string in the following way (I think it is a reasonable compact representation):
$0^n \; 1^c \; 0 \; (( (0|1)^{\log n} \; (0|1) )^3)^c$
$n$ leading $0$s that represent the number of variables, followed by<br>
$c$ $1$s... |
A 3CNF formula with $n$ variables and $c$ clauses can be represented on a TM tape with a binary string in the following way (I think it is a reasonable compact representation):
$0^n \; 1^c \; 0 \; (( (0|1)^{\log n} \; (0|1) )^3)^c$
$n$ leading $0$s that represent the number of variables, followed by<br>
$c$ $1$s... |
I am studying algorithms from CLRS book. I try to understand the difference between
- probability of hiring the $i$th person out of $n$ and
- probability of hiring the $i$th person out of $n$ persons based on ranks.
Using the normal probability, we know the answer for the first one is $\frac{1}{n-i}$ and the ... |
I am looking for a fast k-mismatch string matching algorithm. Given a pattern string P of length m, and a text string T of length n, I need a fast (linear time) algorithm to find all positions where P matches a substring of T with at most k mismatches. This is different from the k-differences problem (edit distance). A... |
Fast k mismatch string matching algorithm |
|algorithms|strings|string-metrics|substrings| |
Roger Wattenhofer's *[Principles of Distributed Computing](http://disco.ethz.ch/lectures/podc_allstars/)* lecture collection is also a good place to start.
It is freely available online, it assumes no prior knowledge on the area, and the material is very well up-to-date — it even covers some results that were presen... |
I am learning algorithms. So, I came along with something very interesting.
The asymptotic bound of linear function $an+b$ is $O(n^2)$ for all $a>0$.
This is same as for $an^2 + bn + c$. But shouldn't it be different? |
|algorithms|asymptotics| |
I am dealing with the problem of computing $ s = \lfloor sqrt(x)\rfloor$ with $x \in [0,30000^2]$. The common `sqrtf(x)` on C language is too slow for this case, however it always gives me the correct result. I've tried with the Newton's method but I get very small errors when the square root of a number is exact. This... |
$O$ only gives an *upper bound*; see also [here](http://cs.stackexchange.com/questions/57). Clearly, $n^2$ is -- up to a constant factor -- an uppper bound for linear functions.
In fact, you can prove that
> $n^{k_1} \in O(n^{k_2})$ for all $k_1 \leq k_2$.
Together with
> $n^{k_1} + n^{k_2} \in O(n^{\max \{... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.