instruction
stringlengths
0
29.8k
⌀
Show that $\{xy \mid |x| = |y|, x\neq y\}$ is context-free
I do not think models with IO are "more powerful" than Turing machines, they just model different things. In theory, you could view IO as (noisy?) oracle. With a perfect oracle you can computer Turing-uncomputable functions; but where to get the oracle from? Humans are the only "super-Turing" choice (if there is any...
I've heard the motto [**interaction is more powerful than algorithms**][1] from [Peter Wegner][2]. The basis of the idea is that a (classical) Turing Machine cannot handle interaction, that is, communication (input/output) with the outside world/environment. > How can this be so? How can something be more powerful t...
Programming languages evolve and are improved with time (innovation). People take ideas from different languages and combine them into a new languages. Some features are improved (inheritance mechanisms, type systems), some are added (garbage collection, exception handling), some are removed (`goto` statements, low-...
- [Introduction to Algorithms][1] by Cormen, Leiserson, Rivest, Stein is a popular choice, title speaks for itself. - [Compilers: Principles, Techniques, And Tools][2] by Aho, Ulman and Sethi is a good book about compilers, has some introduction material about automata theory too. - [Principles of Model Checkin...
For the mathematics needed in TCS, I recommend the one and only GKP: [Concrete Mathematics](http://www-cs-faculty.stanford.edu/~knuth/gkp.html) by Graham, Knuth, Patashnik A comprehensive, high quality treatment of practically all the math you will need in (basic) TCS. It is an entertaining read and includes a we...
A drink dispenser requires the user to insert a coin ($\bar c$), then press one of three buttons: $\bar d_{\text{tea}}$ requests a cup of tea $e_{\text{tea}}$, ditto for coffee, and $\bar r$ requests a refund (i.e. the machine gives back the coin: $\bar b$). This dispenser can be modeled by the following [CCS](http://e...
CCS, the [Calculus of Communicating Systems](http://en.wikipedia.org/wiki/Calculus_of_communicating_systems), is a model of concurrency that describes interactions between two participants. Its primitives cover synchronization across channels, parallel composition and choice between actions. ### Syntax $$\begin{a...
null
CCS (Calculus of Communicating Systems) is a process calculus, one of the major models of concurrency, intended for modeling communications between two participants
null
We're in a shared memory concurrency model where all reads and writes to integer variables are atomic. * `do:` $S_1$ `in parallel with:` $S_2$   means to execute $S_1$ and $S_2$ in separate threads, concurrently. * `atomically(`$E$`)`   means to evaluate $E$ atomically, i.e. all other threads are stopped during...
|concurrency|process-algebras|
To my knowledge, there are three major process algebras that have inspired a vast range of research into formal models of concurrency. These are: * CCS and $\pi$-calculus both by Robin Milner * CSP by Tony Hoare and * ACP by Jan Bergstra and Jan Willem Klop All three seem to have to this day a quite active foll...
Similarities and differences in major process algebras
|concurrency|process-algebras|
[Algorithms][1] 4. Edition R. Sedgewick [An Introduction to the Analysis of Algorithms][2] P. Flajolet, R. Sedgewick [Introduction to Automata Theory, Languages, and Computation][3] J. E. Hopcroft, J. D. Ullman, (R. Motwani) The 1979 first Edition has more theoretical results that are missing in the 2001 s...
If you are entirely new to the field of TCS then Sipser's [Introduction to the Theory of Computation][1] is definitely the best book to get you started. I have read other introductionary books, and none of them, in my opinion, come close to Sipser's way of bringing the matter. [1]: http://www.amazon.com/Introduc...
If you are entirely new to the field of TCS then Sipser's [Introduction to the Theory of Computation][1] is definitely the best book to get you started. I have read other introductionary books, and none of them, in my opinion, come close to Sipser's way of bringing the matter. Other, more specific, good theoretical ...
[Algorithms][1] 4. Edition R. Sedgewick [An Introduction to the Analysis of Algorithms][2] P. Flajolet, R. Sedgewick [Introduction to Automata Theory, Languages, and Computation][3] J. E. Hopcroft, J. D. Ullman, (R. Motwani) The 1979 first Edition has more theoretical results that are missing in the 2001 s...
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions. An excellent reference is [Anal...
(This is supposed to be a comment to Suresh's answer, but it's simply too long to fit there. So I apologize in advance that it doesn't really answer Marc's question.) I find Neel's answer [*Halting problem, uncomputable sets: common mathematical proof?* on CSTheory](http://cstheory.stackexchange.com/questions/10635...
*This answer summarises parts of [TAoCP](https://en.wikipedia.org/wiki/The_Art_of_Computer_Programming) Vol 3, Ch 6.4.* Assume we have a set of values $V$, $n$ of which we want to store in an array $A$ of size $m$. We employ a hash function $h : V \to [0..M)$; typically, $M \ll |V|$. We call $\alpha = \frac{n}{m}$ t...
Is there an <s>*algorithmic*</s> approach to identify that dates given in a paragraph correlate to particular events (phrases) in the paragraph? Example, consider the following paragraph: > In June 1970, the great leader took the oath. But it was only after May 1972, post the death of the Minister of State, that ...
Windows NT used a point-to-point protocol where a client can communicate "securely" with a server by using a stream cipher to encrypt an array of messages with some key $k$. The server also encrypts its response with the same key $k$. But how is it aware of this key? More general: if Alice and Bob use some encryptio...
How is the key in a private key encryption protocol exchanged?
|encryption|
A possible way is to first use [Public-Key Cryptography](http://en.wikipedia.org/wiki/Public_key_infrastructure) to exchange a private key. However, when it's not possible, there are some specific key exchange protocols, probably the most well-know is the [Diffie-Hellman protocol](http://en.wikipedia.org/wiki/Diffie_He...
Most private key algorithms rely on infeasibility of certain computations like factorisation of a number into its prime factors given the current computing infrastructure. At the same time, most of them are also computationally intensive when used for encryption and decryption and therefore the entire message stream...
A possible way is to first use [Public-Key Cryptography](http://en.wikipedia.org/wiki/Public_key_infrastructure) to exchange a private key. However, when it's not possible, there are some specific key exchange protocols, probably the most well-known is the [Diffie-Hellman protocol](http://en.wikipedia.org/wiki/Diffie_H...
Since you ask for a algorithmic approach, I will be as stubborn as an algorithm. I'm sorry to treat this question like this, but since it doesn't seem like a complex theoretical problem, I will synthesize the possible approaches. Question: can you give me a algorithmic definition of a date and of particular event? ...
(inspired by the second bullet in [this question][1]) I read in many places that some problems are difficult to approximate (it is [**NP-hard** to approximate][2] them). But approximation is not a decision problem: the answer is a real number and not Yes or No. Also for each desired approximation factor, there are...
Decision problems vs "real" problems
|formal-languages|computability|np-hard|approximation|
In general, the problem of identifying dates and other temporal markers in text is called the problem of [extracting temporal references][1]. The search linked will take you to papers related to this. [1]: http://scholar.google.com/scholar?q=extracting%20temporal%20references&hl=en&btnG=Search&as_sdt=1,45&as_sd...
Usually what's shown is the NP-hardness of a "Gap" version of the problem. For example, suppose that you want to show that it's hard to approximate SET COVER to within a factor of 2. You define the following "promise" instance of SET COVER that we'll call 2-GAP-SET-COVER: Fix some number $\ell$. 2-GAP-SET-COVER ...
I read in many places that some problems are difficult to approximate (it is [**NP-hard** to approximate][2] them). But approximation is not a decision problem: the answer is a real number and not Yes or No. Also for each desired approximation factor, there are many answers that are correct and many that are wrong, a...
Decision problems vs "real" problems that aren't yes-or-no
I'm pretty fluent in C/C++, and can make my way around the various scripting languages (awk/sed/perl). I've started using python a lot more because it combines some of the nifty aspects of C++ with the scripting capabilities of awk/sed/perl. But why are there so many different programming languages ? I'm guessing al...
Why are there so many programming languages?
As you said, there is no decision to make, so new complexity classes and new types of reductions are needed to arrive at a suitable definition of *NP-hardness* for *optimization-problems*. One way of doing is to have two new classes **NPO** and **PO** that contain *optimizations problems* and thei mimic of course th...
As you said, there is no decision to make, so new complexity classes and new types of reductions are needed to arrive at a suitable definition of *NP-hardness* for *optimization-problems*. One way of doing this is to have two new classes **NPO** and **PO** that contain *optimizations problems* and they mimic of cour...
From the answers to http://cs.stackexchange.com/questions/249/when-is-hash-table-lookup-o1, I gather that hash tables have $O(1)$ worst-case behavior, at least amortized, when the data satisfies certain statistical conditions, and there are techniques to help make these conditions broad. However, from a programmer's...
For what kind of data are hash table operations O(1)?
|data-structures|time-complexity|hash-tables|
Whenever Alice and Bob wants to agree on a same private key, the most popular method is to use [Diffie-Hellman][1]. It works as follows: 1. Two public values are first chosen lets say $n=13$ and $g=17$. (These are usually very large prime numbers and known to everyone using that protocol). 2...
It is often said that hash table lookup operates in constant time: you compute the hash value, which gives you an index for an array lookup. Yet this ignores collisions; in the worst case, every item happens to land in the same bucket and the lookup time becomes linear ($\Theta(n)$). Are there conditions on the data...
The average-case analysis for the hash-tables is made under the usual assumption of uniformity of the inputs, which once makes due to occam’s razor. If you have additional knowledge about the domain and the distribution of the keys you can take the same average-case analysis and replace the uniform distribution with...
This protocol seems to be insecure due to the fact that Bob sends $E(R_A,K)$. This can be used by Trudy to "generate" encryptions of $E(\langle R_A+1,P_T\rangle , K)$ that will later be used to complete the authentication protocol. Specifically, consider the following attack: Trudy picks random $R_1$ and runs th...
|cryptography|protocols|authentication|
This protocol seems to be insecure due to the fact that Bob sends $E(R_A,K)$. This can be used by Trudy to "generate" encryptions of $E(\langle R_A+1,P_T\rangle , K)$ that will later be used to complete the authentication protocol. Specifically, consider the following attack: Trudy picks random $R_1$ and runs th...
Consider the following protocol, meant to authenticate $A$ (Alice) to $B$ (Bob) and vice versa. $$ \begin{align*} A \to B: &\quad \text{“I'm Alice”}, R_A \\ B \to A: &\quad E(\langle 1, R_A\rangle, K) \\ A \to B: &\quad E(\langle 2, R_A+1, P_A\rangle, K) \\ \end{align*} $$ * $R$ is a random nonce. * $K$...
Break an authentication protocol based on a pre-shared symmetric key, with message numbers
|cryptography|protocols|authentication|
A famous NP-Complete problem: Satisfaction of Boolean formulas constructed as a conjunction of clauses such that each clause is a disjunction of up to 3 variables.
null
3-SAT ([3-satisfiability](http://en.wikipedia.org/wiki/3-satisfiability#3-satisfiability)) is a particular case of [boolean satisfiability problem](http://en.wikipedia.org/wiki/Boolean_satisfiability_problem) when each clause contains exactly 3 literals. It is NP-complete.
null
3-SAT (3-satisfiability) is a famous NP-complete problem: satisfaction of boolean formulas constructed as a conjunction of clauses such that each clause is a disjunction of up to 3 variables.
null
For the mathematics needed in algorithm analysis, I recommend the one and only GKP: [Concrete Mathematics](http://www-cs-faculty.stanford.edu/~knuth/gkp.html) by Graham, Knuth, Patashnik A comprehensive, high quality treatment of practically all the math you will need in (basic) algorithmics. It is an entertainin...
|cryptography|encryption|
There is always the trivial solution: the users meet and exchange keys. This is not very practical for many cases, but possible. In addition to the Diffie-Hellman (DH) key-exchange protocol, there are also [quantum key distribution][1] protocols. One of the most known QKD protocols is the Bennett-Brassard protocol, ...
|cryptography|encryption|
3SAT ([3KNF satisfiability](http://en.wikipedia.org/wiki/3-satisfiability#3-satisfiability)) is a particular case of [boolean satisfiability problem](http://en.wikipedia.org/wiki/Boolean_satisfiability_problem). It restricts the space of considered formulae to those in 3KNF, that is formulae in [conjunctive normal form...
null
3SAT is a famous NP-complete problem. It asks for satisfiability of propositional logic formulae in 3-KNF.
null
*This is an aggregate answer that contains books from answers with score at least five. Please discuss its content in the [chat](http://chat.stackexchange.com/rooms/2710/computer-science).* ###Algorithms & Data Structures### * [Introduction to Algorithms](http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&ti...
null
By pruning edges you've reduced the search space for the training algorithm, which will have an immediate payoff in time performance. You've also introduced constraints on the functions the network can model. The constraints may force your model to find a more general solution since the more accurate one is unreachable...
null
Some books covering the Theory B part of TCS: * **Logic in CS**: _Logic in Computer Science: Modelling and Reasoning about Systems_ By Michael Huth and Mark Ryan * **The Lambda Calculus**: _Lambda-Calculus and Combinators. An introduction_ by J. Roger Hindley and Jonathan P. Seldin. * **Lead in to domain theor...
3SAT is a famous NP-complete problem. It asks for satisfiability of propositional logic formulae in 3-CNF.
null
3SAT ([3CNF satisfiability](http://en.wikipedia.org/wiki/3-satisfiability#3-satisfiability)) is a particular case of [boolean satisfiability problem](http://en.wikipedia.org/wiki/Boolean_satisfiability_problem). It restricts the space of considered formulae to those in 3CNF, that is formulae in [conjunctive normal form...
null
|soft-question|education|
Here is another idea that aims at (injectively) encoding the structure of trees into numbers, rather than just labelling them arbitrarily. For that, we use that any number's prime factorisation is unique. For our purposes, let $E$ denote an empty position in the tree, and $N(l,r)$ a node with left subtree $l$ and ri...
Programming languages evolve and are improved with time (innovation). People take ideas from different languages and combine them into a new languages. Some features are improved (inheritance mechanisms, type systems), some are added (garbage collection, exception handling), some are removed (`goto` statements, low-...
Turing machines can handle interaction just fine, using oracle tapes. It works are follows: from the point of view of a computer that handles interaction, the input of the operator is simply another sequence of bits that it sent into the computer from time to time. We all know that a lazy sysadmin could write a script ...
Some good books covering the Theory B part of TCS: * **Logic in CS**: _Logic in Computer Science: Modelling and Reasoning about Systems_ By Michael Huth and Mark Ryan. Broad coverage of various uses of logic in computer science. About 3rd year undergraduate level. * **The Lambda Calculus**: _Lambda-Calculus and C...
Some good books covering the Theory B part of TCS: * **Logic in CS**: _Logic in Computer Science: Modelling and Reasoning about Systems_ By Michael Huth and Mark Ryan. Broad coverage of various uses of logic in computer science. About 3rd year undergraduate level. * **The Lambda Calculus**: _Lambda-Calculus an...
Basic ray tracing has a major problem related to ambient light. Most illumination models treat ambient light as a constant factor pervading the ether. While ray tracing is great for computing reflections, it suffers from numerical instability and complicated surface intersection tests. Ray tracing may not play nicely w...
Raytracing is a very nice and intuitive algorithm, and it is a more physically realistic way of describing the illumination of a scene than rasterization, but: - Raytracing is slow, specially if you want to implement the more realistic effects that distinguish it from rasterization (e.g. refraction, reflection, mot...
Raytracing is a very nice and intuitive algorithm, and it is a more physically realistic way of describing the illumination of a scene than rasterization, but: - Raytracing is slow, specially if you want to implement the more realistic effects that distinguish it from rasterization (e.g. refraction, reflection, mot...
Ray Tracing versus object-based rendering?
*This is an aggregate answer that contains books from answers with score at least five. Please discuss its content in the [chat](http://chat.stackexchange.com/rooms/2710/computer-science).* ###Algorithms & Data Structures### * [Introduction to Algorithms](http://mitpress.mit.edu/catalog/item/default.asp?ttype=2&ti...
{"Voters":[{"Id":39,"DisplayName":"Gilles"},{"Id":29,"DisplayName":"svick"},{"Id":68,"DisplayName":"Stéphane Gimenez"},{"Id":48,"DisplayName":"Gopi"},{"Id":98,"DisplayName":"Raphael"}]}
As you said, there is no decision to make, so new complexity classes and new types of reductions are needed to arrive at a suitable definition of *NP-hardness* for *optimization-problems*. One way of doing this is to have two new classes **NPO** and **PO** that contain *optimizations problems* and they mimic of cour...
Turning Machines model computation, and don't have a concept of interaction. In that sense a machine that supported interaction with an outside system can do things a Turning Machine can't. But the computation done *between* bit of input from an outside source can obviously always be modelled by a Turing Machine, so ev...
The class of context-free languages corresponds to languages (equivalently) described by context-free grammars or accepted by (non-deterministic) pushdown automata.
null
Note: This is a seeding question, so please feel free to be pedantic etc. I will be deleting this paragraph some time after accepting an answer. I recently read that it is possible to have arrays which need not be initialized: i.e. it is possible to use them without having to spend any time trying to set each member...
Saving on array initialization
|data-structures|arrays|