instruction
stringlengths
0
29.8k
⌀
|homework|
As Artem notes in his [comment](http://cs.stackexchange.com/questions/2222/complexity-np-complete-and-p-complete#comment5885_2222), the question is rather unmeaning as you can define whatever you like. Let me illustrate where things start to be "kind of silly". Some notation: For two problems $P,Q$, write $P \leq_F ...
The problem can be phrased in terms of [permutation groups][1]. Now a permutation group contains all the "anagram moves", both primitive (swapping two letters) and composite of sequences of primitive moves. It seems that you are interested in only a subset of the possible permutations. I will attempt to define thes...
There are devices that do not allow users to load any application they want on it, only run a limited class of applications approved by the device vendor. Take an iPhone as an example where new applications are loaded (solely) from app-store and programs that would allow execution of arbitrary code by user (without ...
|computability|turing-completeness|
Goldstein, Kilman, and Zheng [GKZ05] study the same problem as yours under the name “minimum common string partition problem.” Unfortunately, it NP-hard, even with the restriction that each letter occurs at most twice in each of the input strings. (Of course, if each letter occurs at most once, then the problem is tr...
{"Voters":[{"Id":41,"DisplayName":"Kaveh"},{"Id":472,"DisplayName":"mrm"},{"Id":31,"DisplayName":"Dave Clarke"},{"Id":39,"DisplayName":"Gilles"}]}
I have the following problem: > We want to implement a filtering strategy in e-mail servers to reduce the number of spam messages. Each server will have a buffer, and before sending an e-mail, it checks whether there is a duplicate of the same message in its own buffer and contacts k distinct neighboring servers at ...
Probabilities of duplicate mail detection by comparing notes among servers
|combinatorics|probability-theory|
Goldstein, Kilman, and Zheng [GKZ05] study the same problem as yours under the name “minimum common string partition problem.” Unfortunately, one of their results is that it is NP-hard, even with the restriction that each letter occurs at most twice in each of the input strings. This means that no polynomial-time alg...
If a given server receives $m \leq M$ copies, it does not receive $M-m$ copies. Also, there are many ways to pick $m$ messages out of $M$; you have to consider all of them. Furthermore, important assumptions are that * "randomly" means "uniformly at random", that is the probability that any given copy goes to any...
|algorithms|strings|search-algorithms|natural-language-processing|
|operating-systems|process-scheduling|threads|
I really wonder how torrent downloads can be resumed at later point of time. If such a technology exists, then why is it not possible in browsers? It is often not possible to pause a browser download so that it can be resumed at a later point of time. Often, the download will start again from the beginning. But in ...
Why is it seemlingly easier to resume torrent downloads than browser downloads?
|computer-networks|communication-protocols|
Context: I'm working on [this problem](http://stackoverflow.com/questions/10875675/how-to-find-out-all-the-popping-out-possibilities-of-two-stacks): > There are two stacks here: > A: 1,2,3,4 <- Stack Top B: 5,6,7,8 > A and B will pop out to other two stacks: C and D. For example: > pop(A),p...
null
Why is it seemingly easier to resume torrent downloads than browser downloads?
If a given server receives $m \leq M$ copies, it does not receive $M-m$ copies. Also, there are many ways to pick $m$ messages out of $M$; you have to consider all of them. Furthermore, important assumptions are that * "randomly" means "uniformly at random", that is the probability that any given copy goes to any...
This problem is known as the “minimum common string partition problem.” (More precisely, the answer in the minimum common string partition problem equals the answer in your problem plus 1.) Unfortunately, it is NP-hard, even with the restriction that each letter occurs at most twice in each of the input strings, as i...
I was reading **Linux Kernel Development** by Robert Love, where I came across this > Linux takes an interesting approach to thread support: It does not > differentiate between threads and normal processes.To the kernel, all > processes are the same— some just happen to share resources. I do not know much about...
How are threads implemented in different OSs?
There is some terminology confusion SELECT t1.name, t2.address FROM table1 JOIN (SELECT id, address FROM table2 AS t3 WHERE t3.id = t1.id) is called *inner view*. The *subquery* is technically query block within either WHERE or SELECT clause (*scalar subquery*),...
The bittorrent protocol was designed to transfer large files out-of-order. It divides files in chunks (*pieces* in bittorrent terminology), and maintains a map of which participant holds which chunks. One of the elementary commands is for one participant to request a chunk from another participant. If a client crashes ...
It depends on what system you are considering. No: One of the criteria that could/should/must be used for approbation from the device vendor would be that the program does something, at least sometimes. It reasonably implies that the program terminates on at least one input. Unfortunately for a system to be [T...
First, Apple may wish to restrict applications, but in practice, all versions of the iPhone can be [jailbroken](http://en.wikipedia.org/wiki/IOS_jailbreaking): you can then upload arbitrary machine executables. Whether the phone vendor likes or dislikes that you jailbreak the phone is immaterial to evaluating its compu...
There is some terminology confusion SELECT t1.name, t2.address FROM table1 JOIN (SELECT id, address FROM table2 AS t3 WHERE t3.id = t1.id) is called *inner view*. The *subquery* is technically query block within either WHERE or SELECT clause, e.g. select...
There is some terminology confusion SELECT t1.name, t2.address FROM table1 JOIN (SELECT id, address FROM table2 AS t3 WHERE t3.id = t1.id) is called *inner view*. A *subquery* is technically query block within either WHERE or SELECT clause, e.g. select d...
null
The iPhone has a [Turing Machine App](http://itunes.apple.com/us/app/turing-machine-simulator/id303032123?mt=8). Therefore, if it has an infinite amount of memory, the iPhone would be Turing complete. But no general purpose computer is Turing complete because it has a finite amount of memory, which is insufficient t...
Most tutorials on Lambda Calculus provide example where Positive Integers and Booleans can be represented by Functions. What about -1 and i?
Representing Negative and Complex Numbers Using Lambda Calculus
|logic|lambda-calculus|
I need an algorithm to calculate the number of ways of expressing a number N as sum of numbers inside the interval [a, b]
Numbers of ways of expressing the sum of a number between [a,b]
|algorithms|
If the source vertex $s$ and target vertex $t$ are in different components of the graph, then there are no walks from $s$ to $t$. If the $s$ and $t$ are in the same component, and that component has only one vertex (so in particular, $s=t$), then there is exactly one walk from $s$ to $t$, namely the unique walk that...
I was reading something about the concept of walks in a graph b/w a start vertex and a terminating vertex in a graph and then suddenly a problem struck me, is there any algorithm or a method that can be used to enumerate all the distinct walks from a start vertex to a terminal vertex in a graph, if so can you all point...
Enumerating all the walks in a graph between a start vertex and a terminal vertex?
|algorithms|graphs|
Lambda-calculus can encode most data structures and basic types. For example, you can [encode a pair][1] of existing terms in the lambda calculus, using the same [Church encoding][2] that you usually see to encode nonnegative integers and boolean: $$\mbox{pair}= λxyz.zxy$$ $$\mbox{fst} = λp.p(λxy.x)$$ $$\mbox{snd}...
Just an additional comment to complement the good answers above: ... just check in the *game section* of your favourite smartphone, if you find a [puzzle game that is PSPACE complete][1] (my favourite is [Sokoban][2]) and the game has a *level editor* and a *help option to automatically find the solution*, then yo...
If the source vertex $s$ and target vertex $t$ are in different components of the graph, then there are no walks from $s$ to $t$. If $s$ and $t$ are in the same component, and that component has only one vertex (so in particular, $s=t$), then there is exactly one walk from $s$ to $t$, namely the unique walk that sta...
First encode natural numbers and pairs, as described by jmad. Represent an integer $k$ as a pair of natural numbers $(a,b)$ such that $k = a - b$. Then you can define the usual operations on integers as (using Haskell notation for $\lambda$-calculus): neg = \k -> (snd k, fst k) add = \k m -> (fst k + fst...
Lambda-calculus can encode most data structures and basic types. For example, you can [encode a pair][1] of existing terms in the lambda calculus, using the same [Church encoding][2] that you usually see to encode nonnegative integers and boolean: $$\mbox{pair}= λxyz.zxy$$ $$\mbox{fst} = λp.p(λxy.x)$$ $$\mbox{snd}...
[COQ][1] is an interactive theorem prover that uses the calculus of inductive constructions, i.e. it relies heavily on inductive types. Using those, discrete structures like natural numbers, rational numbers, graphs, grammars, semantics etc. are very concisely represented. However, since I grew to like the proof ass...
Does there exist any work on creating a Real Number/Probability Theory Framework in COQ?
|coq|uncountability|
If a given server receives $m \leq M$ copies, it does not receive $M-m$ copies. Also, there are many ways to pick $m$ messages out of $M$; you have to consider all of them. Furthermore, important assumptions are that * "randomly" means "uniformly at random", that is the probability that any given copy goes to any...
|probability-theory|coq|real-numbers|uncountability|
The [standard library][1] of Coq has a section about real numbers. These are the classical real numbers, using the [Dedekind completion][2]. There are also results about complex numbers, I suppose there are several libraries, I happen to know [this one][3]. Note that there is also a lot of results for _constructive_ re...
|algorithms|combinatorics|
What you want is the number of [integer partitions](https://en.wikipedia.org/wiki/Integer_partition) restricted to the interval $[a,b]$. I suggest you take a look at the approaches to count *all* partitions (check references and external links of the article) and adapt it to your needs.
Is connecting islands with pontoons NP-complete?
null
|algorithms|reference-request|graphs|
We want to solve a minimal-cost-flow problem with a generic negative-cycle cancelling algorithm. That is, we start with a random valid flow, and then we do not pick any "good" negative cycles such as minimal average cost cycles, but use Bellman-Ford to discover a minimal cycle and augment along the discovered cycle. Le...
Why is the complexity of negative-cycle-cancelling $O(V²AUW)$?
|graphs|algorithm-analysis|
|algorithms|graphs|algorithm-analysis|runtime-analysis|check-my-proof|
The slides from my course in software architecture hints that these are seperate terms, but I can't seem to find the difference. Aren't all of them just translating interfaces?
What's the difference between a bridge, a mediator and a wrapper?
|software-engineering|
There is some terminology confusion; the query block within parenthesis SELECT t1.name, t2.address FROM table1 JOIN (SELECT id, address FROM table2 AS t3 WHERE t3.id = t1.id) is called *inner view*. A *subquery* is query block within either WHERE or SELECT claus...
null
Here is the professor's solution, which he calls "reduction": For each $i$ from $0$ to $l$, try to construct a solution if we know that the deviation is less than or equal to $i$. The first $i$ for which a solution can be found is the minimum deviation. We can find a solution given the deviation in $O(n)$ time. So the...
|terminology|software-engineering|
Generally there are _a lot_ of notions of interfaces in computer science. You should probably say that you are talking about about [design patterns][1]. In this page there is [a classification][2] of different patterns that clear things up. - The [mediator][3] pattern is [behavioral][4] (about communication between ...
null
There are different schools of thought. The prevailing wisdom, originated with *System R*, is calculate cost of every execution strategy and select the minimal one. This leaves you at the mercy of optimizer calculating/guessing statistics and costing everything properly. Some people believe that this is almost never do...
There are different schools of thought. The prevailing wisdom, originated with *System R*, is calculate cost of every execution strategy and select the minimal one. This leaves you at the mercy of optimizer calculating/guessing statistics and costing everything properly. Some people believe that this is almost never do...
There are different schools of thought. The prevailing wisdom, originated with *System R*, is calculate cost of every execution strategy and select the minimal one. This leaves you at the mercy of optimizer calculating/guessing statistics and costing everything properly. Some people believe that this is almost never do...
It was very common for early patterns research to put a lot of emphasis on the "intended use" of a pattern, over and above any structural differences in the implementation. Then, people who were at that stage of architectural maturity where they were "doing patterns because patterns is what you do" developed long, oft...
If a person owns property in the town, then when voted out, they presumably forfeit the property. This creates an economic incentive to systematically rob minority groups via things like the Spanish [Edict of Expulsion](http://www.sephardicstudies.org/decree.html) which expelled the community of Jews that had thrived ...
Generally there are _a lot_ of notions of interfaces in computer science. You should probably say that you are talking about about design patterns. In [the corresponding Wikipedia article][1], there is [a classification][2] of different patterns that clears things up: - The [mediator][3] pattern is [behavioral][4] (...
Pointers to algorithms or source code would be much appreciated. Given a PEG grammar and the name of the start production, I would like to label each node with the set of characters that can follow it. I would be happy with a good approximation that is conservative -- if a character can follow a node then it must a...
Computing followers conservatively for a PEG grammar
|reference-request|formal-grammars|
Let $\emptyset \neq C \subset \mathrm{RE}$ and let $L=\{<M>|L(M) \in C \}$. suppose that $<M_{loopy}> \in L$, where $M_{loopy}$ is a TM that never halts. I wonder if it is possible that $L \in \mathrm{RE}$? $(\mathrm{RE}$ is the set of the recursive enumerable languages$)$. By Rice theorem I know that $L \notin R...
Rice theorem. a TM that never halts and the set of Recursive enumerable languages
|formal-languages|turing-machines|
It is possible that $L$ is an r.e. set. Consider the case $C = RE$. Then $L$ is the set of all codes of all Turing machines. This is a recursive set, in fact, depending on the details of the encoding, we could have $L = \mathbb{N}$. So it is actually false that $L$ cannot be recursive. I suspect you misformulated th...
Let $f$ and $g$ be two functions and $p$ a number. Consider the following program: Recurs(v,p): find s < v such that f(s,v) < v/2 and g(s,v-s) < p if no such s exists, return v else if s < v/4, then return v-s U Recurs(s,p) else if s > v/4, then return Recurs(s,p) U Recurs(v-s,p) e...
What is the depth of the recursion of the following algorithm
|algorithms|recurrence-relation|
You are given $n$ integers $a_1, \ldots, a_n$ all between $0$ and $l$. Under each integer $a_i$ you should write an integer $b_i$ between $0$ and $l$ with the requirement that the $b_i$'s form a non-decreasing sequence (i.e. $b_i \le b_{i+1}$ for all $i$). Define the deviation of such a sequence to be $\max(|a_1−b_1|,\...
How to use greedy algorithm to solve this?
|optimization|greedy-algorithms|
|computability|turing-machines|
|logic|lambda-calculus|integers|real-numbers|
Given a [parsing expression grammar](https://en.wikipedia.org/wiki/Parsing_expression_grammar) (PEG) grammar and the name of the start production, I would like to label each node with the set of characters that can follow it. I would be happy with a good approximation that is conservative -- if a character can follow ...
Computing follow sets conservatively for a PEG grammar