instruction
stringlengths
0
29.8k
⌀
|untagged|
{"Voters":[{"Id":39,"DisplayName":"Gilles"}]}
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
{"Voters":[{"Id":39,"DisplayName":"Gilles"}]}
{"Voters":[{"Id":39,"DisplayName":"Gilles"}]}
We receive a stream of $n-1$ pairwise different numbers from the set $\left\{1,\dots,n\right\}$. How can I determine the missing number with an algorithm that reads the stream once and uses a memory of only $O(log_2 n)$ bits?
Determine missing number in data stream
|algorithms|integers|online-algorithms|
I've been looking around for an algorithm that would optimize the distance between 2 list of coordinates and choose which coordinate should go together. Say I have List 1: 205|200 220|210 200|220 200|180 List 2: 210|200 207|190 230|200 234|190 Calculated Distance bet...
Algorithm to minimize distance variance between 2D coordinates
|algorithms|
|formal-languages|regular-languages|context-free|formal-grammars|
I know that there are non-regular languages, so that $L^*$ is regular, but all examples I can find are context senitive but not context free. In case there are none how do you proof it?
Is there a context free, non-regular language $L$, so that $L*$ is regular?
|regular-languages|context-free|
null
|formal-languages|regular-languages|context-free|formal-grammars|
$L = \{a^n b^n \mid n\in\mathbb{N}\}$ is context-free but not regular (classical example). So is $L' = \{a^n b^n \mid n\in\mathbb{N}\} \cup \{a,b\}$. $L'^\ast = \{a,b\}^\ast$ is regular.
I know that there are non-regular languages, so that $L^*$ is regular, but all examples I can find are context-sensitive but not context free. In case there are none how do you prove it?
Is there a context free, non-regular language $L$, so that $L^*$ is regular?
Is there a context free, non-regular language $L$, for which $L^*$ is regular?
You may also wish to consult the text *Computational Complexity* by Christos Papadimitriou. Specifically Chapter 14, Section 3 that delves into oracles. Proofs for $P^A = NP^A$ and $P^B \not= NP^B$ for some oracles $A$ and $B$ for instance are provided in detail, and may be helpful for your primary problem. Hope that h...
As spotted by svick, the first issue with the code in the OP is that names beginning with upper-case letters are variables in Prolog. So `admit(CP) :- admit(AD)` is equivalent to `admit(X) :- admit(Y)`, which results in Prolog immediately entering an infinite loop trying to demonstrate that `admit` holds for some term ...
null
We receive a stream of $n-1$ pairwise different numbers from the set $\left\{1,\dots,n\right\}$. How can I determine the missing number with an algorithm that reads the stream once and uses a memory of only $O(\log_2 n)$ bits?
|algorithms|integers|online-algorithms|
To solve a problem with Prolog, as with any programming language, be it declarative or imperative, you have to think about the representation of the solution and the input. Since this is a programming question, it would've been popular on StackOverflow.com where programmers solve programming problems. Here I would a...
null
To solve a problem with Prolog, as with any programming language, be it declarative or imperative, you have to think about the representation of the solution and the input. Since this is a programming question, it would've been popular on StackOverflow.com where programmers solve programming problems. Here I would a...
To solve a problem with Prolog, as with any programming language, be it declarative or imperative, you have to think about the representation of the solution and the input. Since this is a programming question, it would've been popular on StackOverflow.com where programmers solve programming problems. Here I would a...
HdM's solution works. I coded it in C++ to test it. I can't limit the `value` to $O(\log_2 n)$ bits, but I'm sure you can easily show how only that number of bits is actually set. #include <iostream> #include <vector> #include <cstdlib> #include <algorithm> using namespace std; ...
First of all, note that by definition * $\delta(q,a) = \sigma_P(P_{0,q}\cdot a) =: s_1$ and * $\delta(\pi_P(q),a) = \sigma_P(P_{0,\pi_P(q)}\cdot a) =: s_2$. Let us investigate $s_1$ and $s_2$ in a sketch: ![sketch][1] <sup>[[source](http://verrech.net/sefiles/cs_1669.tikz)]</sup> Now assume $s_2 > s_1...
We know that the $polyL$-hierarchy doesn't have complete problems, as it would conflict with the space hierarchy theorem. But: Are there complete problems for each level of this hierarchy? To be precise: Does the class $DSPACE(\log(n)^k)$ have complete problems under $L$-reductions for each $k > 0$?
Complete Problems for $DSPACE(\log(n)^k)$
|complexity-theory|space-complexity|
|algorithms|computational-geometry|
To solve a problem with Prolog, as with any programming language, be it declarative or imperative, you have to think about the representation of the solution and the input. Since this is a programming question, it would've been popular on StackOverflow.com where programmers solve programming problems. Here I would a...
I've been looking around for an algorithm that would optimize the distance between 2 list of coordinates and choose which coordinate should go together. Say I have List 1: 205|200 220|210 200|220 200|180 List 2: 210|200 207|190 230|200 234|190 Calculated Distance bet...
You know $\Sigma_{i=1}^n i = {n(n+1) \over 2}$, and because $S = {n(n+1) \over 2}$ could be coded in $O(\log(n))$ bits this can be done in $O(\log n)$ memory and in one path (just find $S - currentSum$, this is missing number). But this problem could be solve in general case (for constant $k$): we have $k$ missing n...
HdM's solution works. I coded it in C++ to test it. I can't limit the `value` to $O(\log_2 n)$ bits, but I'm sure you can easily show how only that number of bits is actually set. For those that want pseudo code, using a simple $fold$ operation with exclusive or ($⊕$): $$ Missing = fold(⊕, \{1...N\} ∪ InputStream...
HdM's solution works. I coded it in C++ to test it. I can't limit the `value` to $O(\log_2 n)$ bits, but I'm sure you can easily show how only that number of bits is actually set. For those that want pseudo code, using a simple $fold$ operation with exclusive or ($⊕$): $$ Missing = fold(⊕, \{1...N\} ∪ InputStream...
HdM's solution works. I coded it in C++ to test it. I can't limit the `value` to $O(\log_2 n)$ bits, but I'm sure you can easily show how only that number of bits is actually set. For those that want pseudo code, using a simple $\text{fold}$ operation with exclusive or ($\oplus$): $$\text{Missing} = \text{fold}(\...
You know $\sum_{i=1}^n i = \frac{n(n+1)}{2}$, and because $S = \frac{n(n+1)}{2}$ could be coded in $O(\log(n))$ bits this can be done in $O(\log n)$ memory and in one path (just find $S - \mathrm{currentSum}$, this is missing number). But this problem could be solved in general case (for constant $k$): we have $k$ m...
|complexity-theory|reductions|space-complexity|
Reading the paper [An Introduction to the Lambda Calculus][1], I came across a paragraph I didn't really understand, on page 34 (my italics): > Within each of the two paradigms there are several versions of typed > lambda calculus. In many important systems, especially those a la > Church, it is the case that term...
Simple explanation as to why certain computable functions cannot be represented by a typed term?
|logic|computability|turing-machines|type-theory|
I'm looking for a data structure that supports efficient approximate lookups of keys (e.g., Levenshtein distance for strings), returning the closest possible match for the input key. The best suited data structure I've found so far are Burkhard-Keller trees, but I was wondering if there are other/better data structures...
Efficient map data structure supporting approximate lookup
|data-structures|
I'm finding it a bit hard to concisely write down the proof, but I hope this explanation provides you enough intuition to see why simple typed terms cannot represent all untyped terms. The simply typed lambda calculus is strongly normalising. Every $\beta$ reduction will bring us closer to normal form. When the func...
I'm looking for a data structure that supports efficient approximate lookups of keys (e.g., Levenshtein distance for strings), returning the closest possible match for the input key. The best suited data structure I've found so far are Burkhard-Keller trees, but I was wondering if there are other/better data structures...
I'm looking for a data structure that supports efficient approximate lookups of keys (e.g., Levenshtein distance for strings), returning the closest possible match for the input key. The best suited data structure I've found so far are [Burkhard-Keller trees](http://en.wikipedia.org/wiki/BK-tree), but I was wondering i...
null
The data structures you are interested in are metric trees. That is, they support efficient searches in metric spaces. A metric space is formed by a set of objects and a distance function defined among them satisfying the triangle inequality. The goal is then, given a set of objects and a query element, to retrieve tho...
The data structures you are interested in are metric trees. That is, they support efficient searches in metric spaces. A metric space is formed by a set of objects and a distance function defined among them satisfying the triangle inequality. The goal is then, given a set of objects and a query element, to retrieve tho...
|computability|logic|lambda-calculus|type-theory|
|data-structures|strings|efficiency|
I am wondering if there are any experiments that show the existence or the non-existence of a correlation between usage of a dynamic language (such as Python, Ruby, or even languages that run on the Java platform such as Groovy, Clojure) over a static language (such as C/C++), and the difference in the productivity.
What you are looking for is "approximate near neighbor search" (ANNS) in the Levenshtein/edit distance. From a theoretical perspective, edit distance has so far turned out to be relatively hard for near-neighbor searches, afaik. Still, there are many results, see the references in this [Ostrovsky and Rabani][1] paper. ...
null
I find that merijn's answer handles the first part of your question quite well. I shall try to answer the second part: why finding functions that are computable but not representable in the polymorphic $\lambda$-calculus requires "standing on ones head". I'm afraid it requires some explanation of the concepts that y...
|cryptography|encryption|randomness|
Given that you do not want to learn precise concepts (a position which I find ridiculuous), here is a Discovery channel explanation. In the discussion below "function" always refers to a function mapping natural numbers to natural numbers (possibly undefined at some arguments). Any programming language which has ...
Given that you do not want to learn precise concepts (a position which I find ridiculuous), here is a Discovery channel explanation. In the discussion below "function" always refers to a function mapping natural numbers to natural numbers (possibly undefined at some arguments). Any programming language which has ...
null
To translate your statement into the relational algebra, I think it asks: > Can we rewrite $\sigma_A(A)\bowtie \sigma_B(B)$ as $\sigma_A(\sigma_B(A\bowtie B))$? (Where $\sigma$ is select and $\bowtie$ is join.) The answer is "Yes," and it's a standard query optimization. To be honest, I'm not sure how to prove...
null
In the paper "[The Emptiness Problem for Intersections of regular Languages][1]" it is showed that deciding the emptiness of the intersection of the languages recognized by $g(n)$ DFAs is complete for $NSPACE(g(n)\log{n})$; in particular the emptiness of the intersection of the languages recognized by $\log^{k-1}{n}...
In the paper "[The Emptiness Problem for Intersections of regular Languages][1]" it is showed that deciding the emptiness of the intersection of the languages recognized by $g(n)$ DFAs is complete for $NSPACE(g(n)\log{n})$; in particular the emptiness of the intersection of the languages recognized by $\log^{k-1}{n}...
Has anyone seen this problem before? >We are given vertices $V_1$,...,$V_n$ and possible parent sets for each vertex. Each parent set has an associated cost. Let $O$ be an ordering (a permutation) of the vertices. We say that a parent set of a vertex $V_i$ is consistent with an ordering O if all of the parents come ...
Need help understanding this optimization problem
|optimization|search-algorithms|
Has anyone seen this problem before? It's suppose to be np-complete. >We are given vertices $V_1$,...,$V_n$ and possible parent sets for each vertex. Each parent set has an associated cost. Let $O$ be an ordering (a permutation) of the vertices. We say that a parent set of a vertex $V_i$ is consistent with an orderi...
I have problem with solving the following exercise >Given the set $P$ on $n$ points, build data structure of $P$ such that given horizontal segment $s$ find the first point that $s$ touches when moving upwards. Required complexity is $S(n)=nlogn$, $Q(n)=log^2n$. The preprocessing time is equivalent to sorting, s...
Search Problem in 2-dimensions
|algorithms|computational-geometry|
This is not an answer to the question per se, but an extended comment. There was an interesting set of slides regarding CERN's Advanced Storage (CASTOR) at CHEP'2010. This is a large mixed media archive with some 25 PB of tape archives (ca. 2010). One of the presentations: "[Tape archive challenges][1]" highlights s...
This is not an answer to the question per se, but an extended comment. There was an interesting set of slides regarding CERN's Advanced Storage (CASTOR) at CHEP'2010. This is a large mixed media archive with some 25 PB of tape archives (ca. 2010). One of the presentations: "[Tape archive challenges][1]" highlights s...
null
Just an exetended comment. In the paper "[The Emptiness Problem for Intersections of regular Languages][1]" it is showed that deciding the emptiness of the intersection of the languages recognized by $g(n)$ DFAs is complete for $NSPACE(g(n)\log{n})$; in particular the emptiness of the intersection of the language...
It is well-known that every boolean function $f:\{0,1\}^n\to \{0,1\}$ can be realized using a boolean circuit of depth 2, containing AND gates in the first level and one single OR gate in the upper level; this is simply the [DNF representation][1] of $f$. Another type of gate which is of great interest in circuit co...
Depth-2 circuits with OR and MOD gates are not universal?
|complexity-theory|circuits|
What you are looking for is "approximate near neighbor search" (ANNS) in the Levenshtein/edit distance. From a theoretical perspective, edit distance has so far turned out to be relatively hard for near-neighbor searches, afaik. Still, there are many results, see the references in this [Ostrovsky and Rabani][1] paper. ...
I find that merijn's answer handles the first part of your question quite well. I shall try to answer the second part: why finding functions that are computable but not representable in the polymorphic $\lambda$-calculus requires "standing on ones head". I'm afraid it requires some explanation of the concepts that y...
Given that you do not want to learn precise concepts, here is an intuitive explanation. In the discussion below "function" always refers to a function mapping natural numbers to natural numbers (possibly undefined at some arguments). Any programming language which has 1. computable syntax and rules of evaluation,...
Has anyone seen this problem before? It's suppose to be NP-complete. >We are given vertices $V_1$,...,$V_n$ and possible parent sets for each vertex. Each parent set has an associated cost. Let $O$ be an ordering (a permutation) of the vertices. We say that a parent set of a vertex $V_i$ is consistent with an orderi...
|terminology|optimization|
|terminology|optimization|
You can think of the parent sets as incident nodes; that is if $V_i$ is in the parent set of $V_j$, there is a (directed) edge from $V_i$ to $V_j$. An ordering "consistent" with this graph in the sense of the exercise is a [topological sorting](https://en.wikipedia.org/wiki/Topological_sorting), that is a topologica...
Has anyone seen this problem before? It's suppose to be NP-complete. >We are given vertices $V_1,\dots ,V_n$ and possible parent sets for each vertex. Each parent set has an associated cost. Let $O$ be an ordering (a permutation) of the vertices. We say that a parent set of a vertex $V_i$ is consistent with an order...
I have problem with solving the following exercise >Given the set $P$ on $n$ points, build in time $O(n\log n)$ a data structure of $P$ such that given a horizontal segment $s$ find the first point that $s$ touches when moving upwards in time $O(\log^2n)$. The preprocessing time is equivalent to sorting, so we ca...
The $log^2(n)$ implies that at each node in the search you probably have to do another search. This gave me an idea. Let's construct a tree from the input data: $$LeafNode = \{ x, y \}$$ $$NonLeafNode = \{ Min_x, Max_x, MinYPoint \}$$ Each node will partition the input space into two non-overlapping ranges. The ro...
|logic|circuits|
I have problem with solving the following exercise >Given the set $P$ on $n$ points in two dimensions, build in time $O(n\log n)$ a data structure of $P$ such that given a horizontal segment $s$ find the first point that $s$ touches when moving upwards from the x-axis in time $O(\log^2n)$. The preprocessing time ...
Finding the point nearest to the x-axis over some segment
Need help understanding this optimization problem on graphs
The $log^2(n)$ implies that at each node in the search you probably have to do another search. This gave me an idea. Let's construct a tree from the input data: $$LeafNode = \{ x, y \}$$ $$NonLeafNode = \{ Min_x, Max_x, MinYPoint \}$$ Each node will partition the input space into two non-overlapping ranges. The ro...