instruction
stringlengths
0
29.8k
⌀
This is a broad question that does not have an easy answer; it's a long way from electrons skittering along copper wires to rendering a website in Firefox. I will attempt to give you an overview from bottom to top and point you towards the right things to look up. ### Encoding Numbers The basic motivation is to c...
I am a graduate student taking a course in theory of computation and I have serious trouble producing content once I'm asked to. I'm able to follow the textbook (Introduction to the Theory of Computation by Michael Sipser) and lectures; however when asked to prove something or come up with a formal description of a spe...
Strategies for becoming unstuck in understanding TCS
|computability|education|intuition|
{"Voters":[{"Id":39,"DisplayName":"Gilles"}]}
I am currently working on a solution to a problem for which (after a bit of research) the use of a hill climbing, and more specificly a *shotgun* (or *random-restart*) [hill climbing](http://en.wikipedia.org/wiki/Hill_climbing) algorithmic idea seems to be the best fit, as I have no clue how the best start value can be...
How to implement the details of shotgun hill climbing to make it effective?
I am currently working on a solution to a problem for which (after a bit of research) the use of a hill climbing, and more specificly a *shotgun* (or *random-restart*) [hill climbing](http://en.wikipedia.org/wiki/Hill_climbing) algorithmic idea seems to be the best fit, as I have no clue how the best start value can be...
{"Voters":[{"Id":98,"DisplayName":"Raphael"}]}
The point of the Python scientific libraries is that Python merely acts as a glue code for shuffling around the data between the scientific libraries. Python itself does little of the high performance grind work. Python is a good language for this, as it supports both the procedural and object-oriented paradigms (and f...
Given a regular language and a string that does not violate the regular language rules - but that is not necessarily part of the language - what is the best way to compute which letters can be inserted before/after and between the letters of this string as not to break the language rules? E.g. the language is `ab`, ...
Compute 'insertable' letters in a regular language
|algorithms|regular-languages|finite-automata|
Just an idea: you can use scientific libraries written in Java (I think you'll find a lot of work already available) with Javascript - that has a syntax similar to Java - used only as a wrapping language for: - scripting - user interaction - (re)modeling and standardization of the underlying high level classes/pa...
Just an idea: you can use scientific libraries written in Java (I think you'll find a lot of work already available) with Javascript - that has a syntax similar to Java - used only as a wrapping language for: - scripting - user interaction - (re)modeling and standardization of the underlying high level classes/pa...
This is homework (for which this site has no tag), and I'm looking for a push in the right direction. Proofs were never something I was properly taught, so now they're kind of a weak point. Here's the problem: > The following grammar generates numbers in binary notation (C is the > start symbol): > > (1) C ->...
Trying to prove a grammar only generates certain types of strings?
|formal-grammars|proof-techniques|
The general idea behind doing multiple climbs is to try to avoid local optima. This is the reason shotgun climbing might work better than just a plain hill climbing method. Usually one starts with a random value. On the other hand if one can guess something better, that can be used as a initial value as well. If the...
There are plenty of algorithms for finding the min-cut of an undirected graph. [Karger's algorithm](http://en.wikipedia.org/wiki/Karger%27s_algorithm) is a simple yet effective randomized algorithm. In short, the algorithm works by selecting edges uniformly at random and contracting them with self-loops removed. The...
Here's a question from a past exam I'm trying to solve: For an undirected graph $G$ with positive weights $w(e) \geq 0$, I'm trying to find the minimum cut. I don't know other ways of doing that besides using the max-flow min-cut theorem. But the graph is undirected, so how should I direct it? I thought of directin...
Finding the minimum cut of an undirected graph
This is homework and I'm looking for a push in the right direction. Proofs were never something I was properly taught, so now they're kind of a weak point. Here's the problem: > The following grammar generates numbers in binary notation ($C$ is the > start symbol): > > $\qquad \begin{align}C &\to C 0 \mid A 1...
|formal-languages|regular-languages|formal-grammars|proof-techniques|
The point of the Python scientific libraries is that Python merely acts as a glue code for shuffling around the data between the scientific libraries. Python itself does little of the high performance grind work. Python is a good language for this, as it supports both the procedural and object-oriented paradigms (and f...
Proving a grammar only generates words whose alternating digit sums is are multiples of three
A computer works by manipulating energy gradients (which we then interpret as 1's and 0's) in a **consistent**, **defined** way. It's the *consistency* which defines a computer, while it's the *definition* which separates the different processors. Also, learn about how just two logic gates (OR, and AND) are suffici...
Here is a hint: figure out what each of the other two symbols $A,B$ generate. You can then prove part (1) by induction. This will also allow you to come up with the explicit construction needed to prove part (2).
I'm assuming you are given a DFA $A = (Q,\Sigma,\delta,q_0,F)$. The method can be adapted to handle NFAs. Let the word be $w = w_1 \ldots w_n$. For each $i \in \{0,\ldots,n\}$, calculate the state $s_i$ that the automaton reaches after reading the prefix of length $i$ of $w$. For each $i \in \{0,\ldots,n\}$ and each...
The problem is NP-complete. Here is a reduction from 3SAT-5, an NP-complete version of 3SAT in which every variable appears exactly 5 times (and so the number of variables and number of clauses are linearly related). We start by constructing two set systems. The first system $\mathcal{S}$ consists of 6 sets $A_0,A_1...
This is homework and I'm looking for a push in the right direction. Proofs were never something I was properly taught, so now they're kind of a weak point. Here's the problem: > The following grammar generates numbers in binary notation ($C$ is the > start symbol): > > $\qquad \begin{align}C &\to C 0 \mid A 1...
The point of the Python scientific libraries is that Python merely acts as a glue code for shuffling around the data between the scientific libraries. Python itself does little of the high performance grind work. Python is a good language for this, as it supports both the procedural and object-oriented paradigms (and f...
This is a broad question that does not have an easy answer; it's a long way from electrons skittering along copper wires to rendering a website in Firefox. I will attempt to give you an overview from bottom to top and point you towards the right things to look up. ### Encoding Numbers The basic motivation is to c...
This is homework and I'm looking for a push in the right direction. Proofs were never something I was properly taught, so now they're kind of a weak point. Here's the problem: > The following grammar generates numbers in binary notation ($C$ is the > start symbol): > > $\qquad \begin{align}C &\to C 0 \mid A 1...
Rough hint: play around with the many equivalent models you have for regular languages. For 1), I find problematic that the contribution of an already generated digit changes as more symbols are added to the front. Things would be easier if the grammar was right-linear. >! Convert the given grammar to an NFA and ...
When converting a DFA to a regular expression using the [transitive closure method](http://cs.stackexchange.com/a/2395), what is the significance of state $k$ and what values $k$ takes? If $k$ represents the intermediate states then what are the values for $k$? That is while applying the method, for which value of $k$ ...
For 1, I'd work by induction. That is I'd find a property of the strings generated by A, B and C and show that it holds for all construction. For example for C the property is that the alternating sum is a multiple of 3. - it holds for the third production: the alternating sum of 0 is a multiple of 3 - it holds for...
Given a regular language and a string that does not violate the regular language rules - but that is not necessarily part of the language - what is the best way to compute which letters can be inserted before/after and between the letters of this string as not to break the language rules? A string 'does not break th...
Given a regular language and a string that does not violate the regular language rules - but that is not necessarily part of the language - what is the best way to compute which letters can be inserted before/after and between the letters of this string as not to break the language rules? A string 'does not break th...
Given a regular language and a string that does not violate the regular language rules - but that is not necessarily part of the language - what is the best way to compute which letters can be inserted before/after and between the letters of this string as not to break the language rules? A string 'does not break th...
Given a regular language and a string that does not violate the regular language rules - but that is not necessarily part of the language - what is the best way to compute which letters can be inserted before/after and between the letters of this string as not to break the language rules? A string 'does not break th...
Let $L$ a regular language and define the *[subsequence](https://en.wikipedia.org/wiki/Subsequence) closure* of $L$ as $\qquad \displaystyle S(L) = \{ w \mid \exists w' \in L.\ w \text{ subsequence of } w'\}$. The problem I want to solve is to find for such subsequences $w \in S(L)$ which letters can be inserted ...
null
I'm not familiar with the topic, so all I can do is give a few pointers. Manipulating partitions of finite sets is known by several names: * [union-find](http://en.wikipedia.org/wiki/Union_find) when you start with singletons and progressively merge sets; * [partition refinement](http://en.wikipedia.org/wiki/Par...
A [partition of a set](http://en.wikipedia.org/wiki/Partition_of_a_set) S is a separation of the set into an arbitrary number of non-empty, pairwise disjoint subsets whose union is exactly S. What manner of a data structure should be used to represent a partition of a set if the following methods need to be optimized: ...
Data structure for partition of a set
|data-structures|
|data-structures|partitions|sets|
Edit: The OP changed the question. What follows works for one interpretation of the original question. I'm assuming you are given a DFA $A = (Q,\Sigma,\delta,q_0,F)$. The method can be adapted to handle NFAs. Let the word be $w = w_1 \ldots w_n$. For each $i \in \{0,\ldots,n\}$, calculate the state $s_i$ that the...
Here is Ran G.'s answer mentioned in the comments: Google gives quite a nice results: [1][1], [2][2]. [1]: http://www.ccs.neu.edu/home/viola/classes/gems-08/lectures/le3.pdf [2]: http://www.cs.berkeley.edu/~luca/cs278-01/notes/lecture28.ps
null
Here is Raphael's answer: [Chan and Pătraşcu][1] give an $o(n\log n)$ time algorithm, but as far as I can tell from skimming the paper, they need $\Omega(n)$ space. Furthermore, [Ajtai et al.][2] prove that any (exact) $O(n)$ time algorithm needs $\Omega(n)$ space. There seem to be approximations fitting your crit...
null
The problem is NP-complete. This rules out an exact algorithm that works in all circumstances, but does not rule out heuristic algorithms that work well in practice, or approximations algorithm with provable approximation guarantees. The reduction is from 3SAT. Given a 3SAT instance $\phi$ with variables $x_1,\ldots...
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, ..., N} with N big (say 2^56) - we have a function f : S -> S with, supposedly, many collisions (the images are uniformly dis...
Removing duplicates efficiently and with a low memory overhead
|sorting|data-structures|
I am going to attempt to write a random number generator using exisiting randomize algorithms. Can you suggest witch algorithm has the biggest sequence that never repeats? I don't care if they are fast or slow.
Random algorithm with biggest sequence that never repeats
|randomness|
null
Here is Ran G.'s answer mentioned in the comments: Google gives quite nice results: [1][1], [2][2]. [1]: http://www.ccs.neu.edu/home/viola/classes/gems-08/lectures/le3.pdf [2]: http://www.cs.berkeley.edu/~luca/cs278-01/notes/lecture28.ps
I am going to attempt to write a random number generator using exisiting randomize algorithms. Can you suggest which algorithm has the biggest sequence that never repeats? I don't care if they are fast or slow.
Here is Raphael's answer: [Chan and Pătraşcu][1] give an $o(n\log n)$ time algorithm, but as far as I can tell from skimming the paper, they need $\Omega(n)$ space. Furthermore, [Ajtai et al.][2] prove that any (exact) $O(n)$ time streaming algorithm needs $\Omega(n)$ space. There seem to be approximations fitting...
|algorithms|data-structures|sorting|
null
you ask a general question in your title and then at least two basic/specific points in the question, and I think there are good (separate) answers to each one: - how to prove stuff - create formal descr of a TMs behavior here addressing only the 1st item (which is inherently broad & deserves it)-- its sort of t...
this answer will look at the "bigger picture" context of your question. computer science is actually a relatively young and somewhat open science and it doesnt yet have great or even good answers to some basic & fundamental questions. the basic question "what is efficiently computed" is either _accurately_ or _roughly_...
this answer will look at the "bigger picture" context of your question. computer science is actually a relatively young and somewhat open science and it doesnt yet have great or even good answers to some basic & fundamental questions. the basic question "what is efficiently computed" is either _accurately_ or _roughly_...
this answer will look at the "bigger picture" context of your question. computer science is actually a relatively young and somewhat open science and it doesnt yet have great or even good answers to some basic & fundamental questions. the basic question "what is efficiently computed" is either _accurately_ or _roughly_...
The solution is to compute the DFA of the subsequence closure of the original language, and then using this DFA I just used the 'trivial' algorithm: try to insert each possible symbol in each position, if the resulting word is valid for this new DFA - i.e. belongs to $S(L)$ - then the symbol can be inserted at that pos...
The solution is to compute the DFA of the subsequence closure of the original language, and then using this DFA I just used the 'trivial' algorithm: try to insert each possible symbol in each position, if the resulting word is valid for this new DFA - i.e. belongs to $S(L)$ - then the symbol can be inserted at that pos...
The solution is to compute the DFA of the subsequence closure of the original language, and then using this DFA I just used the 'trivial' algorithm: try to insert each possible symbol in each position, if the resulting word is valid for this new DFA - i.e. belongs to $S(L)$ - then the symbol can be inserted at that pos...
null
See the [TPTP archive](http://www.cs.miami.edu/~tptp/), Thousands of Problems for Theorem Provers. It is somewhat standard in the field. This is more the "nodes" of the theorem graph you are asking about. Some papers referring to the archive may have explored the edges in this graph. Note that in the field of ATM, a...
null
I just started reading "Parsing Techniques, A Practical Guide", Second Edition, by Dick Grune and Ceriel J.H. Jacobs. On page 12, the authors start describing a set of rules that can be used to generate the set of all enumerations of names of the type "tom, dick and harry": the rules allow single names (e.g. "tom")...
beginner question: Is this phrase structure grammar correct?
|formal-grammars|
|formal-grammars|parsing|
You are correct. Speaking in formal notation, you have $\qquad \displaystyle \mathtt{Sentence} \Rightarrow \mathtt{List}\ \mathtt{End} \Rightarrow \mathtt{Name}\ \mathtt{End}$ and we can not get rid of $\mathtt{End}$. That is clearly an oversight. Your modification is valid. In particular, we do not need to ge...
Is this phrase structure grammar from my textbook correct?
|formal-languages|formal-grammars|parsing|
If you don't want to follow Yuval's advice :), Mersenne Twister algorithm is a good random number generator and has a [quite simple implementation][1] (period of $2^{19937}−1$). See Wikipedia page for quick highlights on advantages/disadvantages. There are also many [open source implementations in many programming lang...
null
In resolution theorem proving, it is normally assumed variables in different clauses are distinct. This is not something that happens automatically; it requires significant extra code and computation to implement. Given that, I'm looking for a test case for it. The problem is, in all the test cases I've tried so far...
Distinct variables for different clauses
|logic|automated-theorem-proving|
If you don't have distinct variables in your clauses, resolution will give you too weak conclusions. For example, let's have 4 clauses: 1. $A\lor B(x)$ 2. $\lnot A\lor C(x)$ 3. $\lnot B(c)$ 4. $\lnot C(d)$ where $x, y$ are variables and $c, d$ constants. If we perform resolution on the first two without ren...
You are correct, in a sense. Speaking in formal notation, you have $\qquad \displaystyle \mathtt{Sentence} \Rightarrow \mathtt{List}\ \mathtt{End} \Rightarrow \mathtt{Name}\ \mathtt{End}$ and we can not get rid of $\mathtt{End}$. We have not generated a wrong *word*, but a sentence that can not be derived further...
Is it possible to design a compiler which optimizes a loop in which arrays are accessed in interleaved fashion ? For example: for(int i = 0; i < n; i++) { // some operation on a[i] and b[i] where // a and b are integer arrays } Now I think a good compiler optimization would be s...
access arrays in alternate memory location
|optimization|compilers|
Some work has been done that matches your description. For instance: * Compiler-directed array interleaving for reducing energy in multi-bank memories. by Delaluz, V. Design Automation Conference, 2002. Proceedings of ASP-DAC 2002. 7th Asia and South Pacific and the 15th International Conference on VLSI Design. Pro...
A theory, in this sense, is an [equivalence relation](http://en.wikipedia.org/wiki/Equivalence_relation) on the formula, which states when these formula are equivalent (as in: $F$ is equivalent to $G$ iff $F$ implies $G$ and $G$ implies $F$). The theory is usually presented by a set of deduction rules, though this is n...