id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
6,308
Practical applications of disjoint set datastructure
<p>I know that the disjoint set datastructure is used to keep track of the connected components of an undirected graph when the edges are added to the graph dynamically . I also know that is is used in <a href="http://en.wikipedia.org/wiki/Kruskal%27s_algorithm">Kruskal's algorithm for minimum spanning trees</a> . W...
algorithms graphs data structures
1
6,309
Determining the classification of languages
<blockquote>&#xA; <p>$L_0 = \{ \langle M, w, 0 \rangle \mid \text{$M$ halts on $w$}\}$ <br>&#xA; $L_1 = \{ \langle M, w, 1 \rangle \mid \text{$M$ does not halt on $w$}\}$</p>&#xA; &#xA; <p>$L = L_0 \cup L_1$</p>&#xA;</blockquote>&#xA;&#xA;<p>I need to determine where in the hierarchy of languages (recursive, recur...
formal languages turing machines undecidability halting problem
1
6,311
Prove correctness of recursive multiplication algorithm
<p>I'm in a first year discrete math course and we started algorithms. I created a recursive algorithm to multiply two numbers together:</p>&#xA;&#xA;<pre><code>function multiply($n, $r) {&#xA; if($n == 1)&#xA; return $r;&#xA; else if($r == 1)&#xA; return $n;&#xA; else&#xA; return $r + multiply($n - 1, ...
algorithms algorithm analysis correctness proof induction
0
6,312
Language member explanation
<p>Given the following formal language $L$:</p>&#xA;&#xA;<p>$$ L=\{ww \mid w\in\{a,b\}^*\}$$</p>&#xA;&#xA;<p>Why is $a$ not a member of this language?</p>&#xA;&#xA;<p>So what is $\{a,b\}^*$ exactly? I thought it means $(a+b)^*$?</p>&#xA;
formal languages terminology regular expressions
1
6,319
Shifting subset sum solution by constant positive integer
<p>While reading the <a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow">Wikipedia article about the subset sum problem</a> I came across this example: "is there a non-empty subset whose sum is zero? For example, given the set $\{ −7, −3, −2, 5, 8 \}$, the answer is yes because the subset $\{ −3, −...
integers decision problem
1
6,321
Line smoothing algorithm that perserve data uniformity
<p>Intro:</p>&#xA;&#xA;<p>I'm working with huge data set that i need to plot in browser, and since there may be up to 1M points my idea was to create different representations for different zoom levels</p>&#xA;&#xA;<p>lets say i have 100k points, i would average two-by-two until i get 50k, then i would repeat that unti...
computational geometry approximation graphics
0
6,322
Maximal derangements
<p>When one shuffles playing cards, the goal is evidently to achieve a possibly big derangement&#xA;of a given deck. For manual shuffling there are terms like inshuffle, outshuffle etc. I like&#xA;to know whether there is a sensible general measure of derangements of n objects and&#xA;efficient algorithm to compute tha...
combinatorics probability theory permutations
0
6,323
Algorithmic consequences of algebraic formula for partition function?
<p><a href="http://www.aimath.org/news/partition/brunier-ono">Bruinier and Ono</a> have found an algebraic formula for the <a href="http://en.wikipedia.org/wiki/Partition_function_%28number_theory%29#Partition_function">partition function</a>, which was widely reported to be a breakthrough. I am unable to understand th...
algorithms complexity theory number theory
1
6,325
Computing the rank of a multiset after inserting another element
<p>What is the procedure for computing the rank of a <a href="http://mathworld.wolfram.com/Multiset.html" rel="nofollow">multiset</a> after inserting an element?</p>&#xA;&#xA;<p>For instance, lets say we have a set $S = (0,1)$ containing $n = 2$ distinct elements.</p>&#xA;&#xA;<p>The multiset $M = (1,1)$ has rank $5$ b...
algorithms combinatorics sets binary arithmetic
1
6,326
What are some applications of binary finite fields in CS?
<p>I was looking at details on <a href="http://en.wikipedia.org/wiki/Finite_field" rel="nofollow">finite fields</a>. Finite binary fields, e.g. $\mathbb{F_2}$, are used in CS in some places such as circuit theory [1]. </p>&#xA;&#xA;<blockquote>&#xA; <p>What are some key applications of finite fields in CS?</p>&#xA;</b...
algorithms reference request discrete mathematics applied theory
1
6,327
Trigonometry in computer science
<p>What's the use of studying trigonometry in computer science? I mean, is it essential? Does it have a specific application in computer science? Because I can't seem to muster enough motivation for learning it.</p>&#xA;
education mathematical analysis applied theory
1
6,330
How do the following Hash Functions compare?
<p>Consider the two hash functions used to map IP addresses. $x_i$ represents a octave (or "bit field") of the address.</p>&#xA;&#xA;<p>Hash Function 1:&#xA;$$h_a(x_1, x_2, x_3, x_4) = \sum^{4}_{i=1} a_ix_i \bmod n$$</p>&#xA;&#xA;<p>Where $n$ is a prime number closest to the total number of IP addresses being mapped. T...
hash tables hash
0
6,334
Tensor Product in Quantum Computation
<p>I can not understand the following equality $$\langle ij|(|0\rangle \langle 0|\otimes I)kl \rangle= \langle i|0\rangle \langle 0|k \rangle \langle j|I|l \rangle?$$</p>&#xA;&#xA;<p>Also to estimate phase $\phi$ in Nielsen &amp; Chuang book, I can not understand why &#xA;$(|0 \rangle + e^{2\pi i 2^{t-1}\phi} |1 \ran...
quantum computing
1
6,342
Proof that a randomly built binary search tree has logarithmic height
<p>How do you prove that the expected height of a randomly built <a href="http://en.wikipedia.org/wiki/Binary_search_tree">binary search tree</a> with $n$ nodes is $O(\log n)$? There is a proof in CLRS <em>Introduction to Algorithms</em> (chapter 12.4), but I don't understand it.</p>&#xA;
data structures algorithm analysis binary trees search trees average case
1
6,343
Can you have three consecutive black nodes in red-black search tree?
<p>Suppose I am making a red-black search tree, and in my right subtree, I have a black node, then a red node, and it has two black children, the black children further black childrens. As such a lemma has been made that red-black trees with $n$ internal nodes have height at most $2\log(n+1)$, would this proof still ho...
data structures binary trees search trees
1
6,345
How does this recurrence relation fit the algorithm?
<p>I have the following pseudo code: </p>&#xA;&#xA;<pre><code>Multiply(y,z) &#xA;1. if (z==0) return 0 &#xA;2. else if (z is odd) &#xA;3. then return (Multiply(2y, floor(z/2)) + y ) &#xA;4. else return (Multiply(2y, floor(z/2))) &#xA;</code></pre>&#xA;&#xA;<p>Towards analysing this procedure's run...
time complexity algorithm analysis asymptotics recurrence relation
0
6,347
How do you go about designing a vector processor architecture for the sum of matrix products?
<p>The following equation is a matrix expression where $B_i$ and $C_i^T$ are $n\times n$ matrices and k is a positive integer:</p>&#xA;&#xA;<p>$$P = \sum_{i=1}^k B_i C_i^T $$</p>&#xA;&#xA;<p>So $P = B_1 C_1^T + B_2 C_2^T + \cdots +B_k C_k^T $</p>&#xA;&#xA;<p>If $B_i $ and $C_i$ are $n\times n$ matrices themselves, ...
computer architecture parallel computing matrices
1
6,348
Why can't we use a hash tables for collision resolving in hash tables?
<p>To prevent collisions, hash tables with open addressing use a methodology to chain the contents. Why can't we use another hash table allocated to each slot of the primary hash table?</p>&#xA;
data structures hash tables
1
6,352
Difference between decision tree and rule based reasoner
<p>I am new to this topic, and in some scientific papers I've been reading about prediction in sports I encountered the term rule based reasoner. Is it this term the same as a semantic reasoner( where the two main directions are forward and backwards chaining?). If yes, can you point out the difference between a decisi...
terminology artificial intelligence data mining
0
6,353
Supporting material for theory of computation
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/454/list-of-intro-tcs-books-for-those-who-dont-know-much-about-tcs">List of intro TCS books for those who don’t know much about TCS</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>Im taking a course on...
automata
0
6,357
What precisely is infinite ambiguity in a grammar?
<p>From what I've read, an example of infinite ambiguity is usually given in a form of a loop:</p>&#xA;&#xA;<p>$S \rightarrow aA \\&#xA;A \rightarrow B \\&#xA;B \rightarrow A \\&#xA;B \rightarrow b$</p>&#xA;&#xA;<p>But a grammar is called <em>ambiguous</em> if there's more than 1 way to derive the input string &omega;....
terminology formal grammars ambiguity
1
6,360
Will this algorithm terminate on any input?
<p>One can compress data with straight-line grammars. An algorithm that employs this technique is called <em>Sequitur</em>. If I understood correctly, Sequitur basically starts with one rule representing the input and then does these three steps till the grammar does not change anymore:</p>&#xA;&#xA;<ol>&#xA;<li>For ea...
algorithms algorithm analysis formal grammars data compression correctness proof
1
6,362
Can all packing/covering problems be rephrased as set packing/covering problems?
<p>Can all <a href="http://en.wikipedia.org/wiki/Packing_problem" rel="nofollow">packing problems</a> be rephrased as <a href="http://en.wikipedia.org/wiki/Set_packing" rel="nofollow">set packing problems</a>?</p>&#xA;&#xA;<p>Can all <a href="http://en.wikipedia.org/wiki/Covering_problem" rel="nofollow">covering proble...
terminology optimization
0
6,363
Nim game tree + minimax
<p><img src="https://i.stack.imgur.com/2hUx4.jpg" alt="search tree"></p>&#xA;&#xA;<p><strong>Problem : Two players have in front of&#xA;them a single pile of objects, say a stack of 7 pennies. The first player divides the original&#xA;stack into two stacks that must be unequal. Each player alternatively thereafter does...
artificial intelligence search trees game theory
1
6,366
Computer graphics: Linear Interpolation
<p>I have two vector points $p_1$ and $p_2$. Each point has a color value $c_1$ and $c_2$.&#xA;Now using <em>linear interpolation</em>, I would like to get the color value at point $p_3$.</p>&#xA;&#xA;<p>Concrete example:</p>&#xA;&#xA;<p>$\qquad \displaystyle p_1 = (1, 3) \text{ with } c_1 = (2, 4, 1)$<br>&#xA;$\qquad ...
graphics
0
6,368
Can you have a binary search tree with O(logn + M) property for the following case
<p>Let $n$ be the number of strings which are sorted in lexicographical order and stored in a balanced binary search tree. You are provided with a prefix $x$ of which $M$ strings have the prefix $x$. I have devised the following algorithm, where I search until I find the first occurence of the prefix $x$ in one of the ...
binary trees search trees
1
6,369
Lower bound for Convex hull
<p>By making use of the fact that sorting $n$ numbers requires &#xA;$\Omega(n \log n)$ steps for any optimal algorithm (which uses 'comparison' for sorting), how can I prove that finding the <a href="http://en.wikipedia.org/wiki/Convex_hull" rel="noreferrer">convex-hull</a> of $n$ points is bounded by $\Omega (n \log n...
complexity theory computational geometry lower bounds
0
6,371
Proving DOUBLE-SAT is NP-complete
<p>The well known SAT problem is defined <a href="http://en.wikipedia.org/wiki/Boolean_satisfiability_problem">here</a> for reference sake. </p>&#xA;&#xA;<p>The DOUBLE-SAT problem is defined as</p>&#xA;&#xA;<p>$\qquad \mathsf{DOUBLE\text{-}SAT} = \{\langle\phi\rangle \mid \phi \text{ has at least two satisfying assignm...
complexity theory np complete satisfiability
1
6,374
How to correlate a matrix of values to get a coordinated point?
<p>I got a n*m matrix updated in realtime (i.e. about every 10ms) with values between 0 and 1024, and I want to work out from that matrix a multitouch trackpad behaviour, which is:</p>&#xA;&#xA;<ul>&#xA;<li>generate one or more points on the surface given the values on the matrix,</li>&#xA;<li>make this or those point ...
algorithms matrices
1
6,375
Is the clique problem NP-complete also on bipartite or planar graphs?
<p>We know that the clique problem is NP-complete. Is the restriction of the problem to bipartite graphs or planar graphs still NP-complete?</p>&#xA;
complexity theory graphs np complete
0
6,378
What is the time complexity of calling successor $n$ times during tree traversal?
<p>According to some <a href="http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/binarySearchTree.htm" rel="nofollow noreferrer">sources</a>, the time complexity of finding the successor of a node in a tree is $O(h)$. So, if the tree is well balanced, the height $h=\log n$, and the successor function takes ...
binary trees search trees
1
6,379
Inventory planning problem solved through dynamic programming
<p>I am working on problem (15-11) Inventory planning from <em>Introduction to Algorithms</em> (CLRS, 3rd Ed).</p>&#xA;<blockquote>&#xA;<p><strong>15-11: Inventory Planning, p.411</strong></p>&#xA;<p>The Rinky Dink Company makes machines that resurface ice rinks. The demand for such products varies from month to month,...
algorithms dynamic programming check my algorithm
0
6,382
Graph Closeness - Different result with gephi and NodeXL
<p>I'm writing a JavaScript library for calculating graph measurements such as degree centrality, eccentrality, closeness and betweenness.</p>&#xA;&#xA;<p>In order to validate my library I use two exist applications <a href="http://gephi.org" rel="nofollow">Gephi</a> and <a href="http://nodexl.codeplex.com/" rel="nofol...
graphs terminology
1
6,385
Multitape Turing machines against single tape Turing machines
<p><em>Introduction</em>: I recently learned that a multi-tape Turing Machine $\text{TM}_k$ is no more "powerful" than a single tape Turing machine $\text{TM}$. The proof that $\text{TM}_k \equiv \text{TM}$ is based on the idea that a $\text{TM}$ can simulate a $\text{TM}_k$ by using a unique character to separate th...
time complexity turing machines simulation tape complexity
1
6,386
Construction of binary random variable
<p>We throw two coins in a row and thus get the event space $\{ZZ, WW, ZW, WZ\}$. &#xA;Each of the 4 elementary events has a probability $1/4$.&#xA;how can I construct 3 binary random variable $x_1$, $x_2$, $x_3$ about this event space, which are 2-fold independent, but not independent.</p>&#xA;
probability theory sampling
0
6,389
Relations between the knapsack problem, the bin packing problem, and the set packing problem?
<p>I wonder what relations are between <a href="http://en.wikipedia.org/wiki/Knapsack_problem">the knapsack problem</a>, <a href="http://en.wikipedia.org/wiki/Bin_packing_problem">the bin packing problem</a> and <a href="http://en.wikipedia.org/wiki/Set_packing">the set packing problem</a>?</p>&#xA;&#xA;<p>From their m...
knapsack problems packing
0
6,391
How to prove $L \cdot L^{*} = L^{+}$
<p>How can one formally prove</p>&#xA;&#xA;<p>$L \cdot L^{*} = L^{+}$</p>&#xA;&#xA;<p>It looks obvious to me since with the concatenation you get rid of $\varepsilon$, but I cannot think of a formal proof through induction or something.</p>&#xA;
formal languages regular languages
1
6,393
When are 2 decision/optimization problems equivalent?
<p>Does anybody know a good definition of 2 decision / optimization problems being equivalent? </p>&#xA;&#xA;<p>I am asking since for example allowing polynomial time computations any 2 problems in NP could be considered equivalent.</p>&#xA;
complexity theory terminology undecidability
1
6,400
Show that a language is not regular by Pumping Lemma
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/1031/how-to-prove-that-a-language-is-not-regular">How to prove that a language is not regular?</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>Show that $L_2=\{a^nb^k|n\not= k-1\}$ is not regular by Pu...
formal languages automata regular languages pumping lemma
0
6,402
The binary-GCD algorithm state machine
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/6404/runtime-of-the-binary-gcd-state-machine">Runtime of the binary-GCD state machine</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p><strong>Hello I am doing self study from MIT OCW exercises and I co...
algorithms proof techniques
0
6,404
Runtime of the binary-GCD state machine
<p>I am doing self study from <a href="http://www.myoops.org/twocw/mit/NR/rdonlyres/Electrical-Engineering-and-Computer-Science/6-042JFall-2005/3970D151-BFD3-4181-81CD-804F109B3AC2/0/ln7.pdf" rel="nofollow">MIT OCW exercises</a> and I could not understand this question.</p>&#xA;&#xA;<blockquote>&#xA; <p>The following ...
algorithms finite automata proof techniques
0
6,405
Maximum number of nodes with height h
<p>How is $\frac{n}{2^{h+1}}$ the maximum possible number of nodes at height $h$ for a binary search tree or heap tree? I saw this as proof to asymptotically bound the <code>build_heap</code> function in the book, but I don't get it.</p>&#xA;
data structures binary trees
1
6,406
Can $f$ be not computable even if $L$ is decidable?
<p>I am trying to teach myself computability theory with a textbook. According to my book, a function $f$ over an alphabet $A=\{a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z\}$ is only computable iff the language</p>&#xA;&#xA;<p>$$&#xA;L = \{s\#^j\sigma : s\in A^*, \sigma \in A, \text{ th...
formal languages computability undecidability
1
6,408
Quantum computing 'amplitudes'
<p>As far as I understand, you receive an output from a quantum computer for an algorithm in the form of an amplitude, which is one of the many states your qubits may be in, however this amplitude is a complex number.</p>&#xA;&#xA;<p>I understand that you have to square the amplitude to find the probability of finding ...
quantum computing computation models
0
6,410
Solving a recurrence relation with √n as parameter
<p>Consider the recurrence </p>&#xA;&#xA;<p>$\qquad\displaystyle T(n) = \sqrt{n} \cdot T\bigl(\sqrt{n}\bigr) + c\,n$ </p>&#xA;&#xA;<p>for $n \gt 2$ with some positive constant $c$, and $T(2) = 1$.</p>&#xA;&#xA;<p>I know the Master theorem for solving recurrences, but I'm not sure as to how we could solve this relation ...
asymptotics recurrence relation master theorem
1
6,414
To prove Turing-completeness, is it enough to prove capability of producing arbitrary output?
<p>Turing completness is being typically proved via reduction to already proved Turing-complete machine.</p>&#xA;&#xA;<p>Can the same be obtained by showing, that the machine in question is capable of generating arbitrary output – if proper input is given?</p>&#xA;
simulation turing completeness
1
6,415
Context Free Grammar for language
<p>The language is $L = \{a^{i} b^{j} c^{k} \;|\; k \neq 2j\}$. I'm trying to write a grammar for this language, what I have so far is:</p>&#xA;&#xA;<p>$S \rightarrow AT_{1} \;|\; AT_{2} \;|\; AT_{3} \;|\; AB \;|\; AC$</p>&#xA;&#xA;<p>$A \rightarrow aA \;|\; \varepsilon$ </p>&#xA;&#xA;<p>$B \rightarrow bB \;|\; \vareps...
formal languages formal grammars context free
1
6,418
Find non-regular $L$ such that $L \cup L^R$ is regular?
<p>I've been studying for an exam I have tomorrow, and I was looking through some previous sample exam questions, when I came across this problem:</p>&#xA;&#xA;<blockquote>&#xA; <p>Give a non-regular language $L$ such that $L \cup L^R$ is regular.</p>&#xA;</blockquote>&#xA;&#xA;<p>I've been sitting here and thinking a...
formal languages regular languages
1
6,419
Proving the language of words with equal numbers of symbols non-context-free
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/265/how-to-prove-that-a-language-is-not-context-free">How to prove that a language is not context-free?</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>I'm having a hard time figuring this out, any hel...
formal languages context free
1
6,420
Is it more effective to vote for a woman?
<p>A certain political party wants to encourage women to participate in their primary elections, so they decide, that the 4th position is reserved for a woman. That is, if there is no woman in the top 4 positions, then the woman with the largest number of votes will be promoted to the 4th position, and the candidates a...
game theory voting
1
6,423
What are the different types of databases?
<p>Is there is a study or classification available on different types of databases? (Examples include structured, unstructured, semi structured relational, object oriented, folksonomies, etc.) </p>&#xA;
terminology reference request databases
1
6,432
Scheduling algorithms and quantum time
<p>I would like to know what impacts does a scheduling algorithm, let's say Round Robin or FIFO, have on an Operating System. I understand that a scheduling algorithm has the processes run in burst then switch between one another. But what does this mean for an OS. All I can figure out is that the OS has to keep track ...
operating systems process scheduling
0
6,433
Modulo hash function and multiples of three
<p>This is a textbook based question. In The Art of Computer Programming Volume 3, Knuth says that for a hash function $h(k) = k \bmod M$, $M$ should not be a multiple of $3$.</p>&#xA;&#xA;<p>The explanation given is:</p>&#xA;&#xA;<blockquote>&#xA; <p>If keys are alphabetic, two keys that differ only by permutation of...
data structures hash tables hash
0
6,435
Base of logarithm in runtime of Prim's and Kruskal's algorithms
<p>For Prim's and Kruskal's Algorithm there are many implementations which will give different running times. However suppose our implementation of Prim's algorithm has runtime $O(|E| + |V|\cdot \log(|V|))$ and Kruskals's algorithm has runtime $O(|E|\cdot \log(|V|))$.</p>&#xA;&#xA;<p>What is the base of the $\log$?</p>...
algorithms time complexity graphs algorithm analysis runtime analysis
1
6,443
Simplification of regular expression and conversion into finite automata
<p>This is a beginners question. I and reading the book "Introduction to Computer Theory" by Daniel Cohen. But I end up with confusion regarding simplification of regular expressions and finite automata. I want to create an FA for the regular expression</p>&#xA;&#xA;<p>$\qquad \displaystyle (a+b)^* (ab+ba)^+a^+\;.$</p>...
formal languages automata finite automata regular expressions
1
6,444
What is the complexity of Hoffman and Pavley's Nth best path algorithm?
<p>I am currently working on a project where I'm using an implementation of Hoffman and Pavley's "<a href="http://dl.acm.org/citation.cfm?doid=320998.321004" rel="nofollow">Method for the Solution of the Nth Best Path Problem</a>" to find n-th best path through a directed graph. The implementation is based on <a href="...
algorithms time complexity graphs algorithm analysis shortest path
0
6,446
Modification of Hamilton Path
<p>Although I know that the <a href="http://en.wikipedia.org/wiki/Hamiltonian_path_problem" rel="nofollow noreferrer">Hamilton Path problem</a> is ${\sf NP}$-complete, I think the following variant can be solved in polynomial time:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a planar graph with vertex set $V$, edge set $E...
algorithms complexity theory graphs np hard
1
6,452
Is it possible to analyse computation?
<p>Take a Turing machine, with a terminating program, convert it to some representation of the machine which captures, in a lossless manner, its state as it performs the computation.</p>&#xA;&#xA;<p>So you have a complete representation of the machine, the program, and its internal organisation as it performs the compu...
graphs optimization runtime analysis compilers artificial intelligence
0
6,453
Shortest path in graph - upgrade an algorithm
<p>We are given a graph with $n$ vertices, $m$ edges, and path edge costs of $x$. For vertices without a direct path that are distant exactly one neighbor, we can add new edge with edge cost $y$. Our task is to find shortest path (i.e minimum cost) between the start vertex and all others vertices.</p>&#xA;&#xA;<p>I hav...
algorithms graphs
0
6,454
Robustness of Turing Machines - 3 dimensional case
<p>How can one show that a machine with a three dimensional memory arranged in an infinite grid can be simulated by a single-tape Turing machine? I'd imagine there's some sort of mapping possible from three dimensional coordinates to single coordinates (eg. (0,0,0) -> 0, (1,0,0) -> 1, (-1,0,0) -> 2, ...) but I can't fi...
turing machines simulation machine models
0
6,455
An efficient data structure supporting Insert, Delete, and MostFrequent
<p>Assume that we have a set $D$ and each member of $D$ is a data and key pair. We want a data structure that would support the following operations:</p>&#xA;&#xA;<ul>&#xA;<li>Insert $(d,k)$ into $D$,</li>&#xA;<li>Delete member $e$, (no need to search to find $e$, e.g. $e$ points to a member in $D$),</li>&#xA;<li>MostF...
algorithms data structures abstract data types
0
6,456
How many different max-heaps exist for a list of n integers?
<p>How many different max-heaps exist for a list of <span class="math-container">$n$</span> integers?</p>&#xA;&#xA;<p>Example: list <code>[1, 2, 3, 4]</code></p>&#xA;&#xA;<p>The max-heap can be either <code>4 3 2 1</code>:</p>&#xA;&#xA;<pre><code> 4&#xA; / \&#xA; 3 2&#xA; /&#xA;1&#xA;</code></pre>&#xA;&#xA;<p>o...
data structures combinatorics heaps
1
6,459
Comparing Time complexity?
<p>How would I solve these problems involving time complexity:</p>&#xA;&#xA;<ol>&#xA;<li><p>Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size $n$, insertion sort runs in $8n^2$ steps, while merge sort runs in $64n \log_2 n$ steps. For which values of $n$ d...
time complexity algorithm analysis
0
6,463
Hardness of ambiguity/non-ambiguity for context-free grammars
<p>A <a href="http://en.wikipedia.org/wiki/Formal_grammar" rel="nofollow">grammar</a> is <em><a href="http://en.wikipedia.org/wiki/Ambiguous_grammar" rel="nofollow">ambiguous</a></em> if at least one of the words in the&#xA;language it defines can be parsed in more than one way. A simple example of an ambiguous grammar...
computability formal grammars context free undecidability ambiguity
1
6,470
Iterative binary search analysis
<p>I'm a little bit confused about the analysis of <a href="http://en.wikipedia.org/wiki/Binary_search" rel="nofollow">binary search</a>.&#xA;In almost every paper, the writer assumes that the array size $n$ is always $2^k$.&#xA;Well I truly understand that the time complexity becomes $\log(n)$ (worst case) under this ...
algorithms time complexity algorithm analysis runtime analysis search algorithms
1
6,473
Why is $\sum_{j=0}^{\lfloor\log (n-1)\rfloor}2^j$ in $\Theta (n)$?
<p>I am trying to understand summation for amortization analysis of a hash-table from a <a href="http://videolectures.net/mit6046jf05_leiserson_lec13/" rel="nofollow noreferrer">MIT lecture video</a> (at time 16:09). </p>&#xA;&#xA;<p>Although you guys don't have to go and look at the video, I feel that the summation he...
algorithms data structures algorithm analysis mathematical analysis discrete mathematics
1
6,476
Minimum s-t cut in weighted directed acyclic graphs with possibly negative weights
<p>I ran into the following problem:</p>&#xA;&#xA;<p>Given a directed acyclic graph with real-valued edge weights, and two vertices s and t, compute the minimum s-t cut.</p>&#xA;&#xA;<p>For general graphs this is NP-hard, since one can trivially reduce max-cut to it by simply reversing the edge weights (correct me if I...
algorithms complexity theory graphs weighted graphs
1
6,477
What limits the implementation of proximity operators for text indexing and searching?
<p><a href="https://academia.stackexchange.com/questions/5079/are-there-hacks-or-smaller-scientific-search-engines-offering-you-context-sensit">I was asking on academia.se</a>, if anyone knows scientific search engines offering a <a href="http://en.wikipedia.org/wiki/Proximity_search_%28text%29" rel="nofollow noreferre...
search algorithms data mining searching
0
6,478
Exponential input and poly-time algorithm
<p>For a list of integers, of size n, where n is exponential, will merge-sort(n), run in poly-time or psuedo poly-time?</p>&#xA;
algorithms terminology time complexity polynomial time
0
6,479
Recursive-Descent Predictive Parser for $S \rightarrow 0S1\ |\ 01$
<p>I am having difficulty with one of the exercises in the <em>Dragon Book</em>:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Exercise 2.4.1(c):</strong> Construct recursive-descent parsers, starting with&#xA; the following grammars:</p>&#xA; &#xA; <p>$$S \rightarrow 0S1\ |\ 01$$</p>&#xA;</blockquote>&#xA;&#xA;<p>Yet,...
context free compilers parsers
0
6,480
Commonly used Error Correcting Codes
<p>We know error correcting codes are parameterized as (n,k,d) codes. I wanted to know the values of these parameters for some commonly used error correcting codes in computer memories or in DRAMs, etc.</p>&#xA;&#xA;<p>I just wanted to see some values for these parameters, used in real life applications.</p>&#xA;
computer architecture error correcting codes
1
6,484
Proving the language which consists of all strings in some language is the same length as some string in another language is regular
<p>So I've been scratching my head over this problem for a couple of days now. Given some language $A$ and $B$ that is regular, show that the language $L$ which consists of all strings in $A$ whose length is equal to some string in $B$ is a regular language.</p>&#xA;&#xA;<p>In equation form:</p>&#xA;&#xA;<p>$$L = \{x ...
formal languages regular languages finite automata proof techniques closure properties
0
6,488
First-order logic arity defines decidability?
<p>I've read first-order logic is in general undecidable, and that could be decidable only when working with unary operators. (I think that's propositional logic, correct me if I am wrong)</p>&#xA;&#xA;<p>The question is <strong>why arity leads to undecidable problems?</strong></p>&#xA;&#xA;<p>I would like to see some ...
reference request logic undecidability satisfiability first order logic
1
6,491
Resolution and incomplete Knowledge Base
<p>Assume I have an incomplete knowledge base, for example:</p>&#xA;&#xA;<pre><code>(rich(dave), poor(dave)) // dave is either poor or rich&#xA;&#xA;(not rich(dave), not poor(dave)) // dave is not poor and rich at the same time.&#xA;</code></pre>&#xA;&#xA;<p>My questions are:&#xA;1. If I do resolution on the above cl...
logic knowledge representation reasoning
1
6,497
Alternatives to SVD for rank factorization
<p>I have rank-deficient matrix $M \in \mathbb{R}^{n\times m}$ with $\text{rank}(M) = k$ and I want to find a <a href="http://en.wikipedia.org/wiki/Rank_factorization" rel="noreferrer">rank factorization</a> $M = PQ$ with $P \in \mathbb{R}^{n \times k}$ and $Q \in \mathbb{R}^{k \times m}$. </p>&#xA;&#xA;<p>A popular ap...
algorithms machine learning numerical analysis linear algebra
0
6,500
Can a graph have a cycle containing all nodes but not Hamiltonian?
<p>Is it possible for a graph to have a cycle that goes through all the nodes, but it does not have a Hamiltonian cycle (i.e. the cycle goes through some nodes more than once)? If yes, can anyone prove it? If not, can anyone give a counterexample?</p>&#xA;
graphs
1
6,502
Levenstein distance and dynamic time warp
<p>I am not sure how to draw parallel between the Wagner–Fischer algorithm and dtw algo.&#xA;In both case we want to find the distance of each index combination (i,j).</p>&#xA;&#xA;<p>In Wagner–Fischer, we initiate the distance by the number of insert we'd have to do from one empty string to another.</p>&#xA;&#xA;<pre>...
algorithms dynamic programming string metrics edit distance time series analysis
0
6,503
BPP search: what does boosting correctness entail?
<p>It is not really clear to me, how and if I can do boosting for correctness (or error reduction) on a <a href="http://en.wikipedia.org/wiki/BPP_%28complexity%29" rel="nofollow">BPP</a> (bounded-error probabilistic polynomial-time) search problem. Can anyone of you explain me how it works?</p>&#xA;&#xA;<p>With BPP sea...
probabilistic algorithms search problem
1
6,504
How can I convert the Turing machine the recognizes language $L$ into an unrestricted grammar?
<p>According to <a href="http://en.wikipedia.org/wiki/Unrestricted_grammar">this Wikipedia article</a>, unrestricted grammars are equivalent to Turing machines. The article notes that I can convert any Turing machine into an unrestricted grammar, but it only shows how to convert a grammar to a Turing machine.</p>&#xA;&...
formal grammars turing machines simulation
1
6,506
Some questions regarding compilers and assemblers
<p>Lots of basic questions are there in my mind. I need to clear them.</p>&#xA;&#xA;<p><strong>Statement 1:</strong> A compiler converts a human-readable codes to object codes, and those are converted to a machine code (executable) by linker.</p>&#xA;&#xA;<p>Am I right here?</p>&#xA;&#xA;<p>At <a href="http://en.wikipe...
terminology compilers code generation
1
6,507
Stochastical algorithm
<p>We have a stochastic random source. This gives the bit $0$ (or $1$) with probability $1/2$. &#xA;We want to generate a uniform distribution on the set S = $\{0, 1,..., n-1\}$. </p>&#xA;&#xA;<p>Which algorithm gives with probability $1/n$ the value $i\in S$. And how many bits are needed.</p>&#xA;
algorithms randomness sampling
1
6,514
Breadth First Search with cost
<p>Looking for some tutorials / references that discuss Breadth First Search that takes into consideration the cost of paths, but could not find much information.</p>&#xA;&#xA;<p>Could someone refer a tutorial?</p>&#xA;
algorithms reference request graphs search algorithms
1
6,515
Reduction of A_LBA to E_LBA
<p>I have a rather interesting one to ponder and would love if I could get an answer for it. We were discussing the topic of mapping reduction today in my Computing theory course and I was wondering why this reduction can't exist, $A_{LBA} \leq_{m} E_{LBA}$, since both of them are linear bound automata (LBAs). I do rea...
computability turing machines reductions undecidability
1
6,517
what is semantics?
<p>There are many popular languages. But, computer scientists tell us that in order to understand the behaviour of programs in those languages definitely and unambiguously argue upon program behavior (e.g. prove their identity), we need to translate them into another, well understood language. They call such language "...
formal languages semantics
1
6,519
How asymptotically bad is naive shuffling?
<p>It's well-known that this 'naive' algorithm for shuffling an array by swapping each item with another randomly-chosen one doesn't work correctly:</p>&#xA;&#xA;<pre><code>for (i=0..n-1)&#xA; swap(A[i], A[random(n)]);&#xA;</code></pre>&#xA;&#xA;<p>Specifically, since at each of $n$ iterations, one of $n$ choices is m...
algorithms algorithm analysis asymptotics probability theory randomness
1
6,521
Reduce the following problem to SAT
<p>Here is the problem. Given $k, n, T_1, \ldots, T_m$, where each $T_i \subseteq \{1, \ldots, n\}$. Is there a subset $S \subseteq \{1, \ldots, n\}$ with size at most $k$ such that $S \cap T_i \neq \emptyset$ for all $i$? I am trying to reduce this problem to SAT. My idea of a solution would be to have a variable $x_i...
complexity theory reductions np hard
1
6,525
NP-Completeness - Proof by Restriction
<p>I'm reading Garey &amp; Johnsons <em>"Computers and Intractability"</em> and I'm at the part <em>"Some techniques for solving NP-Completeness"</em>. Here's the text about Proof by Restriction:</p>&#xA;&#xA;<blockquote>&#xA; <p>Proof by restriction is the simplest, and perhaps most frequently&#xA; applicable, of ou...
complexity theory np complete proof techniques
1
6,526
Set Similarity - Calculate Jaccard index without quadratic complexity
<p>I have a group of n sets for which I need to calculate a sort of "uniqueness" or "similarity" value. I've settled on the <a href="http://en.wikipedia.org/wiki/Jaccard_index">Jaccard index</a> as a suitable metric. Unfortunately, the Jaccard index only operates on two sets at a time. In order to calculate the simi...
algorithms time complexity
0
6,528
Mathematical model on which current computers are built
<p>It is said that "The Turing machine is not intended as practical computing technology, but rather as a hypothetical device representing a computing machine. Turing machines help computer scientists understand the limits of mechanical computation." [Wikipedia]</p>&#xA;&#xA;<p>So on which model current machines are bu...
turing machines computer architecture machine models
1
6,531
Can Santa be both fair and efficient?
<p>As the net-evergreen <a href="http://www.snopes.com/holidays/christmas/santa/physics.asp">The Physics of Santa</a> establishes, it is physically impossible for Santa to get a gift to every kid on the planet. Route planning won't help much there, but can a good planning algorithm at least make sure that every kid get...
complexity theory graphs scheduling
0
6,532
Equivalence of GFp and Gp in LTL
<p>In linear time logic, is $\mathbf{GF}p$ equivalent to $ \mathbf{G}p$ ?</p>&#xA;&#xA;<p><em>$\mathbf{GF}p$ means that it is always the case that p is true eventually.</em></p>&#xA;&#xA;<p>Let $\mathbf{G} p$ be defined as: $\forall j \ge0,\ p$ holds in the suffix $q_j, q_{j+1}, q_{j+2},\ldots$</p>&#xA;&#xA;<p>and sin...
logic linear temporal logic
1
6,536
Definition of the state of an object in OOP
<p>I need a concise definition of the "state of an object" in object-oriented programming (for a paper).</p>&#xA;&#xA;<p>For about half of a day I searched for a paper that I can cite on this topic, but I couldn't find one. All the papers I found were mostly general papers on object-oriented programming and they didn't...
terminology reference request programming languages object oriented
0
6,540
Direct vs. Random Access
<p>Would someone please clarify for me the difference between direct and random access?</p>&#xA;&#xA;<p>Specifically, why does this Wikipedia article on <a href="http://en.wikipedia.org/wiki/Direct_access_storage_device" rel="nofollow">Direct Access Storage Devices</a> distinguish between the two:</p>&#xA;&#xA;<blockq...
memory allocation access control
0
6,541
Why does $A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon$?
<p>I have a book that proves the halting problem with this simple statement:</p>&#xA;&#xA;<p>$$&#xA;A_\text{TM} \le_m \text{HALTING} \le_m \text{HALTING}^\varepsilon&#xA;$$</p>&#xA;&#xA;<p>It states that halting problem reduces to the language consisting of $\langle M, \omega \rangle$ for which a Turing machine $M$ ac...
turing machines reductions undecidability halting problem
1
6,542
Is the following NP-complete?
<p>I have encountered the following problem.</p>&#xA;&#xA;<p>We have $N$ points in discrete coordinates,distributed through a plane with vertical axis $[1..Y]$ and horizontal axis $[1..X]$.&#xA;We can perform the action of removing all points with vertical coordinate $y$, in short removing $y$.</p>&#xA;&#xA;<p><img src...
complexity theory np complete computational geometry
0
6,546
Dynamic programming algorithms with log in the run-time
<p>Most of the classic examples of dynamic programming algorithms have run-times such as $n$ or $n^2$. Are there any natural examples with a $O(n \log n)$ run-time?</p>&#xA;
algorithms reference request dynamic programming
0
6,549
Call by value-result vs. call by reference?
<p>From my Googling, it appears that call by value-result is similar to call by reference in that it changes values in the caller, but it's different in that the changes don't take place until the callee exits, and that if the same variable is passed as more than one argument, it'll be treated as separate values in the...
terminology programming languages semantics evaluation strategies
1
6,552
When can a greedy algorithm solve the coin change problem?
<p>Given a set of coins with different denominations $c1, ... , cn$ and a value v you want to find the least number of coins needed to represent the value v.</p>&#xA;&#xA;<p>E.g. for the coinset 1,5,10,20 this gives 2 coins for the sum 6 and 6 coins for the sum 19. </p>&#xA;&#xA;<p>My main question is: when can a greed...
algorithms combinatorics greedy algorithms
1
6,558
Process state in multi threaded process
<p>What would be the process state in a multi threaded process, in which threads are in different states (running, waiting, blocked etc)</p>&#xA;
terminology operating systems process scheduling threads
0
6,562
Generalizing the Comparison Sorting Lower Bound Proof
<p>Let's start with the comparison sorting lower bound proof, which I'll summarize as follows:</p>&#xA;&#xA;<ol>&#xA;<li>For $n$ distinct numbers, there are $n!$ possible orderings.</li>&#xA;<li>There is only one correct sorted sequence of the $n$ numbers.</li>&#xA;<li>We are given that comparison ($&lt;$) is the only ...
proof techniques sorting information theory check my proof lower bounds
0