id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
2,539
Minimizing the total variation of a sequence of discrete choices
<p>My setup is something like this: I have a sequence of sets of integers $C_i (1\leq i\leq n)$, with $|C_i|$ relatively small - on the order of four or five items for all $i$. I want to choose a sequence $x_i (1\leq i\leq n)$ with each $x_i\in C_i$ such that the total variation (either $\ell_1$ or $\ell_2$, i.e. $\su...
algorithms complexity theory optimization
1
2,546
Find string that minimizes the sum of the edit distances to all other strings in set
<p>I have a set of strings $S$ and I am using the edit-distance (<a href="http://en.wikipedia.org/wiki/Levenshtein_distance" rel="nofollow">Levenshtein</a>) to measure the distance between all pairs.</p>&#xA;&#xA;<p>Is there an algorithm for finding the string $x$ which minimizes the sum of the distances to all strings...
algorithms reference request strings string metrics
1
2,548
Why is GFp -> GFq false in LTL, even though GFp and GFq are false?
<p>Consider the <a href="http://en.wikipedia.org/wiki/Kripke_structure" rel="nofollow">Kripke structure</a>:&#xA;$$&#xA;\begin{array}{ccccccc}&#xA; \to &amp; (p, \neg q) &amp; \to &amp; (\neg p, \neg q) &amp; \to &amp; (\neg p, q) \\&#xA; &amp; \circlearrowright &amp; &amp; \circlearrowright &amp; &amp; \circlearrowr...
logic modal logic linear temporal logic
0
2,553
Maximum number of points that two paths can reach
<p>Suppose we are given a list of $n$ points, whose $x$ and $y$ coordinates are all non-negative. Suppose also that there are no duplicate points. We can only go from point $(x_i, y_i)$ to point $(x_j, y_j)$ if $x_i \le x_j$ and $y_i \le y_j$. The question is: given these $n$ points, what is the maximum number of point...
computational geometry dynamic programming recurrence relation
1
2,554
Is the 2nd parity bit in RAID 6 a simple calculation?
<p>I'm trying to understand how the 2nd parity bit or byte is set in RAID 6. I'm reading a <a href="http://kernel.org/pub/linux/kernel/people/hpa/raid6.pdf" rel="noreferrer">paper by H. Peter Anvin</a>, and it goes into Galois field algebra, which is somewhat new to me. Anyway, a rep from HP was trying to explain RAID ...
operating systems storage error correcting codes
0
2,557
How to simulate backreferences, lookaheads, and lookbehinds in finite state automata?
<p>I created a simple regular expression lexer and parser to take a regular expression and generate its parse tree. Creating a non-deterministic finite state automaton from this parse tree is relatively simple for basic regular expressions. However I can't seem to wrap my head around how to simulate backreferences, loo...
automata finite automata regular expressions
1
2,566
Can truth tables be used in non-boolean algebra to derive functions?
<p>There are obvious analogs (pardon the pun) between Boolean algebra and algebra. They have similar laws, operators and properties. I can't figure out why Karnaugh Maps and sum of products, which are used to derive a Boolean function from a truth table, doesn't have an equivalent in algebra. Perhaps it does, but I ha...
algorithms computability logic
0
2,569
Worst case $O(n \ln n)$ in place stable sort?
<p>I am having trouble finding good resources that give a worst case $O(n \ln n)$ <a href="http://en.wikipedia.org/wiki/In-place_algorithm">in place</a> <a href="http://www.algorithmist.com/index.php/Stable_Sort">stable</a> sorting algorithm. Does anyone know of any good resources?</p>&#xA;&#xA;<p>Just a reminder, in ...
algorithms reference request sorting in place
1
2,571
3-dimensional matching approximation algorithm (implementation details)
<p>I have a run-time implementation question regarding the 3-dimensional (unweighted 2-)approximation algorithm below:&#xA;How can I construct the maximum matching M_r in S_r in linear time in line 8?</p>&#xA;&#xA;<p>$X, Y, Z $ are disjoint sets; a matching $M$ is a subset of $S$ s.t. no two triples in $M$ have the sam...
algorithms graphs approximation matching
1
2,573
Proof of NP-completeness of graph isomorphism through edge contractions that reduce a metric
<blockquote>&#xA; <p><strong>Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/2634/np-completeness-or-not">NP-completeness of graph isomorphism through edge contractions with an edge validity condition</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>I know that graph contractability is $...
graphs np complete
0
2,575
Finding the $k$th largest element in an evolving query data structure
<p>Basically, the problem I am solving is this. Initially, the array $A$ is empty. Then I am given data to fill the array and at any time I have to make a query to print the $|A|/3$-th largest element inserted so far.</p>&#xA;&#xA;<p>I was solving the problem with segment trees, but I am not able to make a little modif...
algorithms data structures
1
2,576
Most efficient algorithm to print 1-100 using a given random number generator
<p>We are given a random number generator <code>RandNum50</code> which generates a random integer uniformly in the range 1–50.&#xA;We may use only this random number generator to generate and print all integers from 1 to 100 in a random order. Every number must come exactly once, and the probability of any number occur...
algorithms integers randomness random number generator
1
2,580
Partition of a set of integer into 3 subsets of approximately equal sum
<p>I'm having a very hard time trying to figure out how to solve this problem efficiently. Let me describe how it goes:</p>&#xA;&#xA;<p>"A hard working mom bought several fruits with different nutritional values for her 3 kids, Amelia, Jessica and Bruno. Both girls are overweight, and they are very vicious and always l...
algorithms integers approximation linear programming
0
2,582
How to detect stack order?
<p>We take the sequence of integers from $1$ to $n$, and we push them onto a stack one by one in order. Between each push, we can choose to pop any number of items from the stack (from 0 to the current stack size).</p>&#xA;&#xA;<p>Every time we pop a value from the stack, we will print it out.</p>&#xA;&#xA;<p>For examp...
algorithms stacks
1
2,583
Finding the Largest "Ordered" Difference in Elements of an Array
<p>Suppose we are given an array of positive integers $P = [p_1, p_2, \dots, p_N]$ where each $p_i$ represents the price of a product on a different day $i = 1 \dots N$. </p>&#xA;&#xA;<p>I would like to design an algorithm to find the maximum profit that you can given this array of prices. Profit is made by buying at a...
algorithms arrays
1
2,587
Time complexity version of the Church-Turing Thesis
<p>There's a <a href="http://plato.stanford.edu/entries/church-turing/#Bloopers" rel="nofollow">lot of debate</a> about what exactly the Church-Turing thesis is, but roughly it's the argument that "undecidable" should be considered equivalent to "undecidable by a universal turing machine."</p>&#xA;&#xA;<p>I'm wondering...
computability terminology turing machines church turing thesis
1
2,590
How can I find minimum number required to add to sequence such that their xor becomes zero
<p>Given a sequence of natural numbers, you can add any natural number to any number in the sequence such that their xor becomes zero. My goal is to minimize the sum of added numbers.</p>&#xA;&#xA;<p>Consider the following examples :</p>&#xA;&#xA;<ol>&#xA;<li><p>For $1, 3$ the answer is $2$; adding $2$ to $1$ we get $...
algorithms integers xor
0
2,595
Operations on OBDD: negation through Shannon's expansion
<p>I have a problem with the application of the <a href="http://en.wikipedia.org/wiki/Shannon_expansion" rel="nofollow">Shannon expansion</a> for to obtain the negation of a formula boolean, than will need for implement the negation operator on OBDD (<a href="http://en.wikipedia.org/wiki/Binary_decision_diagram" rel="n...
logic information theory
1
2,598
Balanced weighting of edges in cactus graph
<p>Given a <a href="https://en.wikipedia.org/wiki/Cactus_graph" rel="nofollow">cactus</a>, we want to weight its edges in such a way that</p>&#xA;&#xA;<ol>&#xA;<li>For each vertex, the sum of the weights of edges incident to the vertex is no more than 1.</li>&#xA;<li>The sum of all edge weights is maximized.</li>&#xA;<...
algorithms graphs greedy algorithms
1
2,604
What's the complexity of Spearman's rank correlation coefficient computation?
<p>I've been studying the <a href="http://en.wikipedia.org/wiki/Spearman%27s_rank_correlation_coefficient">Spearman's rank correlation coefficient</a></p>&#xA;&#xA;<p>$\qquad \displaystyle \rho = \frac{\sum_i(x_i-\bar{x})(y_i-\bar{y})}{\sqrt{\sum_i (x_i-\bar{x})^2 \sum_i(y_i-\bar{y})^2}}$.</p>&#xA;&#xA;<p>for two lists...
complexity theory time complexity space complexity
0
2,605
Is rejection sampling the only way to get a truly uniform distribution of random numbers?
<p>Suppose that we have a random generator that outputs&#xA;numbers in the range $[0..R-1]$ with uniform distribution and we&#xA;need to generate random numbers in the range $[0..N-1]$&#xA;with uniform distribution.</p>&#xA;&#xA;<p>Suppose that $N &lt; R$ and $N$ does not evenly divide $R$;&#xA;in order to get a <stron...
probability theory randomness random number generator sampling
1
2,608
How to random-generate a graph with Pareto-Lognormal degree nodes?
<p>I have read that the degree of nodes in a "knowledge" graph of people roughly follows a power law distribution, and more exactly can be approximated with a Pareto-Lognormal distribution.</p>&#xA;&#xA;<p>Where can I find a kind of algorithm that will produce a random graph with this distribution?</p>&#xA;&#xA;<p>See ...
algorithms graphs probability theory randomness
1
2,610
What is the average search complexity of perfect hashing?
<p>The lookup time in perfect hash-tables is $O(1)$ in the worst case. Does that simply mean that the average should be $\leq O(1)$?</p>&#xA;
complexity theory time complexity asymptotics hash tables
0
2,612
Is there a search engine over Artificial Intelligence and Machine Learning -related sites?
<p>Sometimes it is necessary to dig into Artificial Intelligence or specifically Machine Learning problems to make a research. Common googling (in my own experience) usually doesn't help much due to a lot of irrelevant or paid material among the results. Google Scholar in contrast is limited to scientific publications ...
reference request machine learning artificial intelligence
0
2,613
Using hash tables instead of lists for buckets in hash tables
<p>Say instead of using a linked list as buckets for a hash table of size $m$, we use another hash table of size $p$ as buckets this time. What would be the average case for this problem?</p>&#xA;&#xA;<p>I looked up perfect hashing and I got a very close algorithm, and it is $O(1)$. Can someone please clarify?</p>&#xA;
data structures time complexity hash tables
0
2,614
When does the function mapping a string to its prefix-free Kolmogorov complexity halt?
<p>In <em>Algorithmic Randomness and Complexity</em> from Downey and Hirschfeldt, it is stated on page 129 that </p>&#xA;&#xA;<p>$\qquad \displaystyle \sum_{K(\sigma)\downarrow} 2^{-K(\sigma)} \leq 1$, </p>&#xA;&#xA;<p>where $K(\sigma)\downarrow$ means that $K$ halts on $\sigma$, $\sigma$ being a binary string. $K$ den...
computability terminology kolmogorov complexity descriptive complexity
1
2,615
Prove that every two longest paths have at least one vertex in common
<p>If a graph $G$ is connected and has no path with a length greater than $k$, prove that every two paths in $G$ of length $k$ have at least one vertex in common. </p>&#xA;&#xA;<p>I think that that common vertex should be in the middle of both the paths. Because if this is not the case then we can have a path of lengt...
graphs combinatorics
1
2,621
What is the significance of the semi clustering formula in the Google Pregel paper?
<p>Semi clustering algorithm is mentioned in the <a href="http://people.apache.org/~edwardyoon/documents/pregel.pdf" rel="nofollow">Google Pregel paper</a>. The score of a semi cluster is calculated using the below formula</p>&#xA;&#xA;<p>$\qquad \displaystyle S_c =\frac{I_c - f_BB_c}{\frac{1}{2}V_c(V_c - 1)}$</p>&#xA;...
algorithms graphs terminology
0
2,623
Is this language Context-Free?
<p>Is the language</p>&#xA;&#xA;<p>$$L = \{a,b\}^* \setminus \{(a^nb^n)^n\mid n \geq1 \}$$</p>&#xA;&#xA;<p>context-free? I believe that the answer is that it is not a CFL, but I can't prove it by Ogden's lemma or Pumping lemma.</p>&#xA;
formal languages context free pumping lemma
1
2,629
Queue that can sort by multiple priorities?
<p>I have a high interest in priority-queues (E.g., see my answers on: <a href="https://cs.stackexchange.com/q/524">Does there exist a priority queue with $O(1)$ extracts?</a>), and was wondering if there is a priority-queue or similar data-structure where you can sort by multiple values?</p>&#xA;&#xA;<p>For example, i...
data structures asymptotics efficiency priority queues memory management
0
2,630
Expected number of swaps in bubble sort
<p>Given an array $A$ of $N$ integers, each element in the array can be increased by a fixed number $b$ with some probability $p[i]$, $0 \leq i &lt; n$. I have to find the expected number of swaps that will take place to sort the array using <a href="http://en.wikipedia.org/wiki/Bubble_sort" rel="nofollow noreferrer">b...
algorithms algorithm analysis sorting average case
0
2,633
NP-completeness of scheduling to minimise tardy tasks with release times
<p>In "Computers and Intractability A Guide to the Theory of NP-Completeness" textbook pp 236, "Sequencing to minimize tardy tasks" is NP-complete.<br>&#xA;To be specific the problem is as follows: </p>&#xA;&#xA;<p>For each task $t \in T$, partial order $&lt;$ on $T$, a length $l(t)$, and a deadline $d(t)$ and a positi...
complexity theory scheduling
0
2,634
NP-completeness of graph isomorphism through edge contractions with an edge validity condition
<p>Given Graphs $G=(V_1,E_1)$ and $H=(V_2,E_2)$. Can a graph isomorphic to $H$ be obtained from $G$ by a sequence of edge contractions ? We know this problem is NP-complete. What about if only a subset of edges are valid for contraction at each step of the sequence. For example when deciding the first edge for contract...
complexity theory computability graphs np complete np hard
0
2,637
Historical relation between computer science and the theory of dynamical systems
<p>I have asked this question at <a href="https://math.stackexchange.com/questions/167462/historical-relation-between-computer-science-and-the-theory-of-dynamical-systems">math.stackexchange</a>, but I have been redirected here.</p>&#xA;&#xA;<p>My question is, if there is any historical relation between the fields of D...
history
0
2,638
Does there exist a Turing complete typed lambda calculus?
<p>Do there exist any Turing complete typed lambda calculi? If so, what are a few examples?</p>&#xA;
computability lambda calculus type theory
1
2,641
Witness for the $EU(\phi_1,\phi_2)$ using BDDs
<p>I wanted ask if you know an algorithm to find the witness for $EU(\phi_1,\phi_2)$ (CTL formula "Exist Until") using BDDs (<a href="http://en.wikipedia.org/wiki/Binary_decision_diagram" rel="nofollow">Binary Decision Diagram</a>). In pratice you should use the fixed point for calculating $EU(\phi_1,\phi_2)$, that is...
formal methods model checking
1
2,642
An $\mathbb F$-algebra as input to an algorithm
<p>I want to specify, what it means to give an algebra as input to an algorithm and didn't find very much literature about it. So first I want to ask if you can recommend a book or paper that deals with the topic of complexity analysis of algebras over fields <em>and clearly define the decision problem</em>.</p>&#xA;&#...
computability terminology decision problem
0
2,644
Is there a difference between top-down and bottom-up dynamic programming?
<p>Is there a fundamental difference between top-down and bottom-up dynamic programming? </p>&#xA;&#xA;<p>In particular, is there a problem which can be solved bottom-up but not top-down? Or is the bottom-up approach just an unwinding of the recurrence in the top-down approach?</p>&#xA;
algorithms dynamic programming
0
2,646
Is it possible to always construct a hamiltonian path on a tournament graph by sorting?
<p>Is it possible to always construct a hamiltonian path on a <a href="http://en.wikipedia.org/wiki/Tournament_%28graph_theory%29#Paths_and_cycles" rel="nofollow">tournament graph</a> $G=(V,E)$ by sorting (using any sorting algorithm) with the following total order:</p>&#xA;&#xA;<p>$\qquad \displaystyle a \leq b \iff (...
algorithms graphs sorting
1
2,648
Collectively pay the bill problem
<p>There are $n$ people at a table. The $i$th person has to pay $p_i$ dollars. </p>&#xA;&#xA;<p>Some people don't have the right bills to pay exactly $p_i$, so they come up with the following algorithm.</p>&#xA;&#xA;<blockquote>&#xA; <p>First, everyone puts some of their money on the table. Then each individual takes ...
algorithms optimization
1
2,649
A regular expression for a given formal language
<p>I wanted to ask if someone can help me to construct a regular expression over the alphabet $\{a,b,x\}$ for the language $L$ which is constituted by all strings containing an odd number of $a$'s, and in which between each pair of consecutive $a$'s there is an even number of $b$'s (and an arbirtary number of $x$'s).</...
formal languages regular languages regular expressions
1
2,653
NP-completeness and NP problems
<p>Suppose that someone found a polynomial algorithm for a NP-complete decision problem. Would this mean that we can modify the algorithm a bit and use it for solving the problems that are in NP, but not in NP-complete? Or would this just shows the availability of a polynomial algorithm for each NP problem indirectly?<...
complexity theory
1
2,655
How do we distinguish NP-complete problems from other NP problems?
<p>I just learned that when we have a polynomial algorithm for NP-complete problems, it is possible to use that algorithm to solve all NP problems. </p>&#xA;&#xA;<p>So, the question is how we then distinguish non-NP-complete NP problems from NP-complete problems? It seems that all these problems will have a polynomial ...
complexity theory terminology np complete
1
2,658
How hard is finding the discrete logarithm?
<p>The <a href="http://en.wikipedia.org/wiki/Discrete_logarithm">discrete logarithm</a> is the same as finding $b$ in $a^b=c \bmod N$, given $a$, $c$, and $N$.</p>&#xA;&#xA;<p>I wonder what complexity groups (e.g. for classical and quantum computers) this is in, and what approaches (i.e. algorithms) are the best for ac...
algorithms complexity theory time complexity discrete mathematics
1
2,660
Is finding the longest path of a graph NP-complete?
<p>The problem of finding the largest subgraph of a graph that has a Hamiltonian path can be restated as finding the longest path of a graph. Is this NP-complete? Also, is finding the $k$-length path of a graph NP-complete? Is it still NP-complete if we require the path to visit a given vertex?</p>&#xA;
complexity theory graphs np complete
1
2,666
Prove that a boolean function computable in T(n) by a RAM machine is in DTIME(T(n)^2)
<p>The question is exercise 1.9 from Arora-Barak's book <em>Computational Complexity — A Modern Approach</em>:</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>Define a RAM Turing machine to be a Turing machine that has random access memory. We formalize this as follows: The machine has an infinite array A that is initialized to all blan...
complexity theory turing machines machine models simulation
0
2,669
regular expression given the language
<p>The language is:&#xA;$$&#xA;L = \{ (a^n) (b^m) \mid n + m = 3k, k \ge 0 \}&#xA;$$</p>&#xA;&#xA;<p>My attempt at an answer:&#xA;$$&#xA;(a \cup b)^{3k}&#xA;$$</p>&#xA;&#xA;<p>This will work if the a OR b can change for each instance in the string that is (3k) long. If not, what can I do to fix this?</p>&#xA;
formal languages regular languages regular expressions
1
2,671
Solving Recurrence Relations 'Chip & Conquer'
<p>I've been tasked with solving some recurrence relations, and I've been running into trouble with so called 'chip &amp; conquer' relations.</p>&#xA;&#xA;<p>Here are some example problems:</p>&#xA;&#xA;<p>$$T(n) = T(n-5) + cn^2$$</p>&#xA;&#xA;<p>and</p>&#xA;&#xA;<p>$$T(n) = T(n-2) + \log{n}$$</p>&#xA;&#xA;<p>I'm suppo...
asymptotics recurrence relation
0
2,674
Existence of a route following one-way streets
<p>I am trying to understand the approach for this problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>"If all streets are one way, there is still a legal way to drive from&#xA; one intersection to another"</p>&#xA;</blockquote>&#xA;&#xA;<p>The question is to prove that it can be done in linear time. I am not looking for dire...
algorithms graphs algorithm analysis
0
2,676
The $\text{k-key}$ problem
<p>Given an undirected graph, I define a structure called <em>k-key</em> as a path containing $k$ vertices which are connected to a simple cycle which contains $k$ vertices as well.</p>&#xA;&#xA;<p>Here's the <em>k-key problem</em>: given an undirected graph $G$ and a number $k$, decide whether $G$ contains k $k$-key.<...
complexity theory np complete reductions np hard
1
2,677
Algorithm for type conversion / signature matching
<p>I'm working on an expression typing system and looking for insights on what algorithms may be available which solve my problem -- or a proof that its complexity is too high to be reasonable to implement. The problem is defined below.</p>&#xA;&#xA;<p>I have a set of types which form a directed graph $T = (V,E)$ (assu...
algorithms typing
1
2,680
Lock-free, constant update-time concurrent tree data-structures?
<p>I've been reading a bit of the literature lately, and have found some rather interesting data-structures.</p>&#xA;&#xA;<p>I have researched various different methods of getting update times down to $\mathcal{O}(1)$ worst-case update time [1-7].</p>&#xA;&#xA;<p>Recently I begun looking into lock-free data-structures,...
reference request data structures time complexity concurrency search trees
0
2,682
Is the set of codes of Deterministic Finite-State Automata a regular language?
<p>Let $\Sigma$ be a given alphabet. Is there a way to code up Deterministic Finite state Automata (DFA) over $\Sigma$ as strings of $\Sigma$ in such a way that the corresponding subset of $\Sigma^*$ is a regular language?</p>&#xA;&#xA;<p>For example for Turing machines, the set of codes of Turing machines over a fixed...
formal languages computability automata finite automata
0
2,688
Time series probability and mutual information
<p>There is a time series of say $100$ data points. I wish to assign symbols of $0, 1, 2$ for each unique data point. The issue is I have tried but got stuck since no matter I specify the symbols, the program just outputs probability of $1$'s and $0$'s. The following are the questions:</p>&#xA;&#xA;<ol>&#xA;<li>How to ...
probability theory information theory
1
2,689
Is Karp Reduction identical to Levin Reduction
<h3>Definition: Karp Reduction</h3>&#xA;<p>A language <span class="math-container">$A$</span> is Karp reducible to a language <span class="math-container">$B$</span> if there is a polynomial-time computable function <span class="math-container">$f:\{0,1\}^*\rightarrow\{0,1\}^*$</span> such that for every <span class="m...
complexity theory reductions check my proof
1
2,690
Vertex coloring with an upper bound on the degree of the nodes
<p>Consider the set of graphs in which the maximum degree of the vertices is a constant number $\Delta$ independent of the number of vertices. Is the vertex coloring problem (that is, color the vertices with minimum number of colors such that no pair of adjacent nodes have the same color) on this set still NP-hard? Why...
algorithms complexity theory graphs np complete
1
2,696
Left recursion and left factoring -- which one goes first?
<p>if I have a grammar having a production that contains both left recursion and left factoring like </p>&#xA;&#xA;<p>$\qquad \displaystyle F \to FBa \mid cDS \mid c$ </p>&#xA;&#xA;<p>which one has priority, left recursion or left factoring?</p>&#xA;
formal languages formal grammars parsers left recursion
1
2,697
Why is solving of diagonal quadratic equations over $\mathbb R$ and $\mathbb C$ in $P$?
<p>Let $\mathbb F\in\{\mathbb R, \mathbb C\}$ the field of real or complex numbers. Then [1, page 22 in the middle] claims that the following equation can easily be solved in deterministic polynomial time:&#xA;$$ \sum_{i=1}^n a_ix_i^2=b$$&#xA;with $a_i, b\in\mathbb F$. Some discussion suggests, that the algorithmical m...
algorithms real numbers
1
2,698
Concept of reduction and algorithm
<p>Suppose that someone found an algorithm A for a NP problem (that is not NP-complete) that uses an algorithm B for PSPACE-complete or #P-complete problem during execution. (Remaining part of the algorithm takes polynomial time.)</p>&#xA;&#xA;<p>Then suppose there is also an algorithm C for a NP problem that uses the ...
complexity theory
1
2,704
Is SAT in P if there are exponentially many clauses in the number of variables?
<p>I define a <em>long CNF</em> to contain at least $2^\frac{n}{2}$ clauses, where $n$ is the number of its variables. Let $\text{Long-SAT}=\{\phi: \phi$ is a satisfiable long CNF formula$\}$. </p>&#xA;&#xA;<p>I'd like to know why $\text{Long-SAT} \in P$. First I thought it is $\text{NPC}$ since I can do a polynomial-t...
complexity theory np complete reductions satisfiability polynomial time
1
2,707
$\lambda$-calculus with reflection
<p>I'm looking for a simple calculus that supports reasoning about <a href="http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29">reflection</a>, namely, the introspection and manipulation of running programs.</p>&#xA;&#xA;<blockquote>&#xA; <p>Is there an untyped $\lambda$-calculus extension that enables...
logic lambda calculus semantics reflection
0
2,710
Is finding dead-end nodes in NL?
<p>Given a directed graph $G$ and two nodes $s,t$, decide whether there is some node $s'$ such that $s'$ is reachable from $s$ while $t$ is <em>not</em> reachable from $s'$.</p>&#xA;&#xA;<p>I am wondering whether this problem is in <a href="https://en.wikipedia.org/wiki/NL_%28complexity%29" rel="nofollow">NL</a>.</p>&#...
complexity theory graphs
1
2,712
Does $NP^{NP}=NP$?
<p>Is $NP$ with oracle access to $NP$ larger than just $NP$? &#xA;As I understand $NP^&#xA;{NP}$ is just a turing machine that can make queries to an other $NP$ machine if so than $NP$ can simulate $NP^{NP}$? Is there something wrong with this argument? </p>&#xA;
complexity theory
0
2,713
Are regular expressions $LR(k)$?
<p>If I have a Type 3 Grammar, it can be represented on a pushdown automaton (without doing any operation on the stack) so I can represent regular expressions by using context free languages. But can I know if a type 3 grammar is $LR(1)$, $LL(1)$, $SLR(1)$, etc. without constructing any parse tables?</p>&#xA;
formal languages regular languages formal grammars parsers regular expressions
1
2,717
Polygons generated by a set of segments
<p>Given a set of segments, I would like to compute the set of closed polygons inside the convex hull of the set of the end of those segments. The vertices of the polygons are the intersections of the segments. For example, if you draw the 6 lines restricted which equations are: $x=-1$, $x=0$, $x=1$, $y=-1$, $y=0$, $y=...
algorithms computational geometry
1
2,718
What is the difference between quantum TM and nondetermistic TM?
<p>I was going through the discussion on the question <a href="https://cs.stackexchange.com/questions/125/how-to-define-quantum-turing-machines/">How to define quantum Turing machines?</a> and I feel that quantum TM and <em>nondetermistic</em> TM are one and the same. The answers to the other question do not touch on t...
computability turing machines quantum computing nondeterminism
1
2,722
How would a neural network deal with an arbitrary length output?
<p>I've been looking into Recurrent Neural Networks, but I don't understand what the architecture of a neural network would look like when the output length is not necessarily fixed. </p>&#xA;&#xA;<p>It seems like most networks I've read descriptions of require the output length to be equal to the input length or at le...
neural networks
1
2,725
How to formalise efficient payment with a collection of coins in a wallet?
<h2>Context</h2>&#xA;&#xA;<p>If you have to pay an amount of money at a store and have a limited collection of payment items (i.e. coins and banknotes) -- let's for simplicity assume there are only coins -- a trivial algorithm is to always greedily pick the biggest coin that is smaller or equal to the remaining value y...
combinatorics
0
2,727
Function Maximization in Java
<p>I have a bivariate function like</p>&#xA;&#xA;<p>$&#xA;f(x,y) = \frac{1}{x^3 \sqrt{\pi}}. e^{\frac{2-x}{x^2}} . y^3 . e^{3.y \over 3-y}&#xA;$</p>&#xA;&#xA;<p>and I want to find its global maximum over a range of &#xA;$&#xA;x \in [0, 200] \text{, and } y \in [300,50000]&#xA;$</p>&#xA;&#xA;<p>What kind of algorithms I...
algorithms optimization mathematical analysis mathematical software
0
2,728
Does a never-halting machine always loop?
<p>A Turing machine that returns to a previously encountered state with its read/write head on the same cell of the exact same tape will be caught in a loop. Such a machine doesn't halt.</p>&#xA;&#xA;<p>Can someone give an example of a never-halting machine that doesn't loop?</p>&#xA;
computability turing machines halting problem
1
2,734
Algorithm to find optimal currency denominations
<p>Mark lives in a tiny country populated by people who tend to over-think things. One day, the king of the country decides to redesign the country's currency to make giving change more efficient. The king wants to minimize the expected number of coins it takes to exactly pay any amount up to (but not including) the am...
algorithms optimization combinatorics integers
1
2,735
Context-free grammar to a pushdown automaton
<p>I'm trying to convert a context free grammar to a pushdown automaton (PDA); I'm not sure how I'm gonna get an answer or show you my progress as it's a diagram... Anyway this is the last problem I have on a homework that's due later today, so I'd appreciate some kind of help, even if it's just an explanation of the c...
formal grammars context free pushdown automata
1
2,737
What complexity class does this variation of traveling salesman problem belong to?
<p>Given a TSP instance $T$, decide whether changing the city coordinates by adding a vector of coordinates $v$ will change the optimal TSP objective by atleast $x$. The city coordinates are integers.</p>&#xA;&#xA;<p>The problem is in PSPACE but even the verification problem seems to be NP-hard. Is that true?</p>&#xA;&...
complexity theory reductions np hard decision problem traveling salesman
0
2,739
Algorithm to translate a deterministic Büchi automaton to LTL (when possible)
<p><a href="http://en.wikipedia.org/wiki/Linear_temporal_logic">Linear temporal logic</a> and deterministic <a href="http://en.wikipedia.org/wiki/B%C3%BCchi_automaton">Büchi automata</a> are incomparable: DBA cannot express $FGa$, and LTL cannot express <em>"at least each odd letter is 'a'"</em>. But sometimes it is in...
logic automata linear temporal logic buchi automata
1
2,741
Minimize the maximum component of a sum of vectors
<p>I'd like to learn something about this optimization problem: For given non-negative whole numbers $a_{i,j,k}$,&#xA;find a function $f$ minimizing the expression</p>&#xA;&#xA;<p>$$\max_k \sum_i a_{i,f(i),k}$$</p>&#xA;&#xA;<p>An example using a different formulation might make it clearer:&#xA;You're given a set of set...
algorithms optimization linear programming
1
2,744
LTS of this simple FSP
<p>I have this finite-state process with the corresponding labeled transition system: </p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/mxLLU.png" alt="enter image description here"></p>&#xA;&#xA;<p>The FSP is: </p>&#xA;&#xA;<pre><code>MAKER = (kochen -&gt; fertig -&gt; MAKER).&#xA;USER = (fertig -&gt; essen -&gt; U...
automata finite automata process algebras
0
2,745
Building a finite state transducer
<p>I know it's possible to build a Finite State Transducer for converting numbers from base 2 to base 4 or 8 or other powers of 2 (translating from base N to base N^M is easy). However I've never seen a FST that can convert numbers from base 1 to base 2 or viceversa. Can a FST even do this? If so, can you please give s...
automata finite automata
1
2,749
Finding Feature Representation Such That Two Samples Are Similar in Feature Space
<p>Consider one specific useful function of our human brain: abstraction of object. Take the example of two pictures: if we are told the pictures are similar, we actually make conclusion about the aspects in which they are close to each other.</p>&#xA;&#xA;<p>I'm considering whether machine can have the ability describ...
machine learning artificial intelligence neural networks
1
2,752
Weak hashing function for memorable IPv6 addresses
<p>IPv6 addresses in the form of <code>862A:7373:3386:BF1F:8D77:D3D2:220F:D7E0</code> are much harder to memorize or even transcribe than the 4 octets of IPv4. </p>&#xA;&#xA;<p>There <a href="http://blog.jgc.org/2011/07/pronounceable-ipv6-addresses-wpa2-psk.html?m=1" rel="nofollow">have</a> <a href="http://www.halfbak...
cryptography computer networks hash user interface
1
2,754
Lossless Video Compression Pipeline
<p>The only paper I can find about an implementation of a lossless video codec is an <a href="http://www.ffmpeg.org/~michael/ffv1.html" rel="nofollow">article by Michael Niedermayer</a> which explains the FF1V compression pipeline.</p>&#xA;&#xA;<p>I'm wondering if anyone else has found any articles similar to this. I'v...
reference request data compression video
0
2,755
Sub-linear-time ordered set (!= sorted set) implementation?
<p>Does there exist any data structure that efficiently (linearithmic-or-similar in-order traversal, sublinear time insertion/search/removal) implements an ordered set (i.e. a set that allows for enumerating the items in insertion order)? </p>&#xA;&#xA;<p>If so, what data structure is it/how does it do this?</p>&#xA;
data structures
0
2,762
What is the average height of a binary tree?
<p>Is there any formal definition about the average height of a binary tree?</p>&#xA;&#xA;<p>I have a tutorial question about finding the average height of a binary tree using the following two methods:</p>&#xA;&#xA;<ol>&#xA;<li><p>The natural solution might be to take the average length of all possible&#xA;paths from ...
graphs terminology combinatorics binary trees
1
2,764
Canonical reference on agent-based computing
<p>I am interested in exploring the world of <a href="http://en.wikipedia.org/wiki/BDI_software_agent" rel="nofollow">BDI agents</a> (software agents that possess "beliefs, desires, intentions", essentially the agent has knowledge of the world, a set of motivations, and carries out certain plans).</p>&#xA;&#xA;<p>I rec...
reference request human computing agent based computing
1
2,770
Kolmogorov complexity of a decision problem
<p>What's the definition of Kolmogorov complexity for a decision problem? For example, how to define the length of the shortest program that solves the 3SAT problem? Is it the "smallest" Turing machine that recognizes the 3SAT langauge?</p>&#xA;
computability terminology decision problem kolmogorov complexity 3 sat
1
2,771
Assign m agents to N points by minimizing the total distance
<p>Suppose we have $N$ fixed points (set $S$ with $|S|=N$) on the plane and $m$ agents with fixed, known initial positions ($m&lt;N$) outside $S$. We should transfer the agents so that in our final configuration they are all positioned to different points of $S$. How could we achieve it by minimizing the total distance...
algorithms graphs optimization
1
2,774
How to convert a non-embedding context free grammar to regular grammar?
<p>Please note that I am aware the undecidability of the conversion of context-free grammar to regular grammar. But given the non-embedding property of the input context-free grammar, is there any algorithm to convert it to regular grammar, or DFA directly?</p>&#xA;
formal languages formal grammars context free
1
2,777
Determining how similar a given string is to a collection of strings
<p>I'm not sure if this question belongs here and I apologize if not. What I am looking to do is to develop a programmatic way in which I can probabilistically determine whether a given string "belongs" in a bag of strings. For example, if I have bag of 10,000 US city names, and then I have the string "Philadelphia",...
algorithms reference request string metrics
1
2,783
A polynomial reduction from any NP-complete problem to bounded PCP
<p>Text books everywhere assume that the <a href="https://en.wikipedia.org/wiki/Post_correspondence_problem"><em>Bounded</em> Post Correspondence Problem</a> is NP-complete (no more than $N$ indexes allowed with repetitions). However, nowhere is one shown a simple (as in, something that an undergrad can understand) pol...
complexity theory np complete reductions
1
2,784
Message receipt verification in a cluster
<p>At my current project I had a network problem come up for which I could not find a solution. In a peer-to-peer network I needed to send an action to all peers, and each peer was to act on it only if it could verify that all other peers would also act on it.</p>&#xA;&#xA;<p>That is, given a network of peers $P = { P_...
algorithms distributed systems computer networks fault tolerance
1
2,785
Where can I find the data of the computer experiments in the book "Neural Networks and Learning Machines"?
<p>The book <a href="http://rads.stackoverflow.com/amzn/click/0131471392" rel="nofollow">"Neural Networks and Learning Machines"</a> by Simon Haykin has many computer experiments to which many exercises are related. But there seems to be no data for these experiments available online. Where can I find them?</p>&#xA;
reference request data sets
1
2,789
Solving or approximating recurrence relations for sequences of numbers
<p>In computer science, we have often have to solve <a href="http://en.wikipedia.org/wiki/Recurrence_relation">recurrence relations</a>, that is find a <strong>closed form</strong> for a recursively defined sequence of numbers. When considering runtimes, we are often interested mainly in the sequence's <a href="http://...
asymptotics proof techniques combinatorics recurrence relation reference question
0
2,791
When did $LR(k)$ acquire the meaning "left-to-right scan, rightmost derivation?"
<p>According to <a href="http://en.wikipedia.org/wiki/LR_parser#LR_and_Other_Kinds_of_Parsers">the Wikipedia article</a>, the L in $LR(k)$ means "left-to-right scan", and the "R" means "rightmost derivation." However, in <a href="http://classes.engr.oregonstate.edu/eecs/winter2012/cs480/assignments/Knuth-1965-Translat...
formal languages reference request terminology formal grammars parsers
1
2,792
Removing Left Recursion from Context-Free Grammars - Ordering of nonterminals
<p>I have recently implemented the Paull's algorithm for removing left-recursion from context-free grammars:</p>&#xA;<blockquote>&#xA;<p>Assign an ordering <span class="math-container">$A_1, \dots, A_n$</span> to the nonterminals of the grammar.</p>&#xA;<p>for <span class="math-container">$i := 1$</span> to <span class...
algorithms context free formal grammars efficiency left recursion
1
2,794
Is this grammar ambiguous?
<p>I have the grammar: </p>&#xA;&#xA;<p>$\qquad \begin{align}&#xA; S &amp;\to S = P \mid S \neq P \mid P \\&#xA; P &amp;\to NUM&#xA;\end{align}$</p>&#xA;&#xA;<p>This grammar suffers from left recursion. To eliminate left recursion, I got: </p>&#xA;&#xA;<p>$\qquad \begin{align}&#xA; S &amp;\to PS' \\&#xA; S' &amp;\to\,...
formal grammars parsers ambiguity
0
2,795
Proof that a language involving $gcd$ is not context-free
<p>How would you prove that the following language is not context-free?</p>&#xA;&#xA;<p>$$ L= \{a^n b^m |\, gcd(n,m)=1 \}$$</p>&#xA;&#xA;<p>I suspect the solution uses the pumping lemma, but I'm not sure how to apply it.</p>&#xA;
formal languages formal grammars
0
2,797
Decidability of Machines
<p>I cannot understand decidability really well. I have been reading from books and internet, but I am little bit confused. &#xA;According to the book (as I understood), we can decide on decidability of a problem by constructing Turing Machines. Let us say that we want to decide whether an NFA is a decidable language. ...
computability automata finite automata turing machines
0
2,810
Finding a minimal containing rectangle from a given set of rectangles
<p>The problem is as follows:</p>&#xA;&#xA;<p>Given a finite set of rectangles ($S\subset\mathbb{R}\times\mathbb{R}$), build a data structure that will support the following operations:</p>&#xA;&#xA;<ul>&#xA;<li>Check, receives a rectangle $r\in\mathbb{R}\times\mathbb{R}$, and returns true iff there is a rectangle $c\i...
algorithms data structures computational geometry
0
2,811
Perplexed by Rice's theorem
<p><strong>Summary:</strong> According to Rice's theorem, everything is impossible. And yet, I <em>do</em> this supposedly impossible stuff <em>all the time!</em></p>&#xA;&#xA;<hr>&#xA;&#xA;<p>Of course, Rice's theorem doesn't simply say "everything is impossible". It says something rather more specific: "Every propert...
terminology computability undecidability rice theorem
1
2,814
Sums of Landau terms revisited
<p>I asked a (seed) question about sums of Landau terms <a href="https://cs.stackexchange.com/questions/366/what-goes-wrong-with-sums-of-landau-terms">before</a>, trying to gauge the dangers of abusing asymptotics notation in arithmetics, with mixed success.</p>&#xA;&#xA;<p>Now, <a href="https://cs.stackexchange.com/a/...
terminology asymptotics landau notation
1
2,816
Tighter analysis of modified Borůvka's algorithm
<p><a href="http://en.wikipedia.org/wiki/Bor%C5%AFvka%27s_algorithm">Borůvka's algorithm</a> is one of the standard algorithms for calculating the minimum spanning tree for a graph $G = (V,E)$, with $|V| = n, |E| = m$.</p>&#xA;&#xA;<p>The pseudo-code is:</p>&#xA;&#xA;<pre><code>MST T = empty tree&#xA;Begin with each ve...
algorithms algorithm analysis spanning trees
1