id int64 1 141k | title stringlengths 15 150 | body stringlengths 43 35.6k | tags stringlengths 1 118 | label int64 0 1 |
|---|---|---|---|---|
6,564 | Big Omega of $n \log n$ | <p>While studying master method at recurrences topic I'm stacked at a point. It is written in the book as:</p>

<blockquote>
 <p>$T(n) = 3T(n/4) + n \log n$,</p>
 
 <p>we have $a = 3, b = 4$, </p>
 
 <p>$f(n) = n \log n$, and </p>
 
 <p>$n^{\log_b(a)} = n^{\log_4 3} = O(n^{0.7... | asymptotics landau notation master theorem | 0 |
6,567 | Loop invariants? | <pre><code>Insertion-Sort (A) [where A is an array of numbers to be sorted]

(1) for j = 2 to A.length
(2) key = A[j]
(3) i = j -1
(4) while i > 0 and A[i] > key
(5) A[i+1] = A[i]
(6) i = i - 1
(7) A[i + 1] = key
</code></pre>&#... | algorithms algorithm analysis correctness proof | 0 |
6,568 | Inherent ambiguity of the language $L_2 = \{a^nb^mc^m \;|\; m,n \geq 1\}\cup \{a^nb^nc^m \;|\; m,n \geq 1\}$ | <p>I went through a question asking me to choose the inherently ambiguous language among a set of options.</p>

<p>$$L_1 = \{a^nb^mc^md^n \;|\; m,n \geq 1\}\cup \{a^nb^nc^md^m \;|\; m,n \geq 1\}$$
$$and$$
$$L_2 = \{a^nb^mc^m \;|\; m,n \geq 1\}\cup \{a^nb^nc^m \;|\; m,n \geq 1\}$$</p>

<p>The sol... | formal languages formal grammars context free ambiguity | 1 |
6,569 | Does $(a \mid b)^*$ match $a^n$ and $b^n$? | <p>I am getting confused by the regular expression $(a\mid b)^*$ as it for sure matches $aab$ and $ab$.</p>

<p>Does $(a\mid b)^*$ also match strings like $aa$, $aaaa$, $bb$ or $bbb$, that is those that use only $a$ or $b$?</p>
 | formal languages terminology regular expressions | 0 |
6,571 | Simulate the concatenation of two log-space programs in log-space | <p>I've got two log-space programs $F$ and $G$.</p>

<ul>
<li>Program $F$ will get input in array $A[1..n]$ and will create the output array $B[1..n]$.</li>
<li>Program $G$ will get as input $B$ as created by $F$ and create from it the output array $C[1..n]$.</li>
</ul>

<p>I have to write a... | algorithms complexity theory simulation space complexity | 0 |
6,582 | Integer LP formulation and the existence of a solution | <p>A film producer is seeking actors and investors for his new movie. There are $n$ available actors; actor $i$ charges $s_i$ dollars. For funding, there are $m$ available investors. Investor $j$ will provide $p_j$ dollars, but only on the condition that certain actors $L_j \subseteq \{1,2,...,n\}$, are included in the... | optimization linear programming | 0 |
6,588 | Reducing the integer factorization problem to an NP-Complete problem | <p>I'm struggling to understand the relationship between NP-Intermediate and NP-Complete. I know that if P != NP based on Ladner's Theorem there exists a class of languages in NP but not in P or in NP-Complete. Every problem in NP can be reduced to an NP-Complete problem, however I haven't seen any examples for reducin... | np complete reductions factoring | 1 |
6,589 | Does Max-SNP hard imply NP-hard | <p>I have difficulties understanding the definition of the class <a href="http://en.wikipedia.org/wiki/SNP_%28complexity%29">Max-SNP</a> (optimization variant of <strong>strict NP</strong>), thus I have to following basic question:</p>

<pre><code>If a problem is known to be Max-SNP hard, does this imply NP-har... | complexity theory np hard | 1 |
6,590 | Language acceptance by DFA | <p>I have some questions regarding acceptance of a language by DFA</p>

<ol>
<li>Whether more that one dfa accept a language </li>
<li>Whether a dfa can accept more than one language</li>
</ol>
 | automata regular languages finite automata | 1 |
6,595 | Invariant Proof of For Loops? | <p>From <a href="http://rads.stackoverflow.com/amzn/click/0262033844" rel="nofollow">CLRS</a> (third edition, page 19), there is a footnote:</p>

<blockquote>
 <p>When the loop is a for loop, the moment at which we check the loop invariant just prior to the first iteration is immediately after the initial ... | proof techniques correctness proof loop invariants | 0 |
6,597 | Proof of linear search? | <p>Consider the searching problem:</p>
<blockquote>
<p>Input: A sequence of <span class="math-container">$n$</span> numbers <span class="math-container">$A=(a_1, a_2, \ldots , a_n)$</span> and a value <span class="math-container">$v$</span>.</p>
<p>Output: An index <span class="math-container">$i$</span> su... | proof techniques correctness proof loop invariants | 0 |
6,604 | How to modify semantic actions when removing left-recursion from a grammer | <p>Is there any algorithm that tells us how to modify semantic actions associated with a left-recursive grammar? For example, we have the following grammar, and its associated semantic actions:</p>

<p>$ S \rightarrow id = expr $ { S.s = expr.size }</p>

<p>S $\rightarrow$ if expr then $S_1$ else $S_2$... | formal grammars compilers semantics left recursion | 1 |
6,606 | Algorithm to pack any small boxes into a big box | <p>I have a container with a certain dimension. A number of small boxes that may be different in size is to be packed into the container. How to arrange the small boxes such that the container contains as many as possible?</p>

<ul>
<li>No rotation is allowed.</li>
<li>The heavier boxes must not be on t... | algorithms combinatorics efficiency approximation knapsack problems | 0 |
6,609 | Infinite Language vs. finite language | <p>I'm unclear about the use of the phrases "infinite" language or "finite" language in computer theory.</p>

<p>I think the root of the trouble is that a language like $L=\{ab\}^*$ is <strong>infinite</strong> in the sense that it can generate an infinite (but countable) number of strings. Yet, it can still be... | formal languages terminology regular languages | 0 |
6,611 | Functions between sets? | <p>I recently took a practice exam for the Computer Science GRE and this was one of the questions: </p>

<blockquote>
 <p>Assume that set $A$ has 5 elements and set $B$ has 4 elements, how many functions exist from set $A$ to set $B$?</p>
</blockquote>

<p>I had no idea what this means, I don't... | combinatorics sets | 1 |
6,616 | Need a practical solution for creating pattern database(5-5-5) for 15-Puzzle | <p>I have asked this exact question on <a href="https://stackoverflow.com/questions/13229722/need-a-practical-solution-for-creating-pattern-database5-5-5-for-15-puzzle">StackOverflow</a>. I did not get the answer that I was looking for. Please read this question fully before answering. Thank You.<br><br>
For static... | algorithms artificial intelligence recursion | 1 |
6,617 | Concise example of exponential cost of ML type inference | <p>It was brought to my attention that the cost of type inference in a functional language like OCaml can be very high. The claim is that there is a sequence of expressions such that for each expression the length of the corresponding type is exponential on the length of the expression.</p>

<p>I devised the se... | lambda calculus type theory functional programming type inference type checking | 0 |
6,618 | How to implement a prolog interpreter in a purely functional language? | <p>Is there a clear reference, with pseudo-code, on how to go about implementing a Prolog interpreter in a purely functional language? That which I have found so far seems to deal only with imperative languages, is merely a demonstration of Prolog implemented in itself, or offers no concrete algorithm to use for interp... | functional programming prolog logic programming | 1 |
6,624 | Are two terms where one is without a $\lambda\beta$ normal form unconvertible in $\lambda\beta$? | <p>I know that if you try and make the theory</p>

<p>$$\lambda\beta+\{s = t\ |\text{ s, t are terms without }\lambda\beta\text{ normal forms}\}$$</p>

<p>then that theory becomes inconsistent. Are two terms where one is without a $\lambda\beta$ normal form also unconvertible in $\lambda\beta$, ie can i... | terminology logic lambda calculus | 0 |
6,626 | How do I show that whether a PDA accepts some string $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidable? | <p>How do I show that the problem of deciding whether a PDA accepts some string of the form $\{ w!w \mid w \in \{ 0, 1 \}^*\}$ is undecidable?</p>

<p>I have tried to reduce this problem to another undecidable one such as whether two context-free grammars accept the same language. However, I'm not sure how to u... | formal languages automata context free undecidability pushdown automata | 1 |
6,627 | Implementing addition for a binary counter | <p>A binary counter is represented by an infinite array of 0 and 1.</p>

<p>I need to implement the action $\text{add}(k)$ which adds $k$ to the value represented in the array.</p>

<p>The obvious way is to add 1, k times. Is there a more efficient way?</p>
 | algorithms data structures efficiency | 1 |
6,634 | Greedy algorithms tutorial | <p>Could anyone point me to simple tutorial on greedy algorithm for Minimum Spanning tree - Kruskal's and Prims' Method</p>

<p>I am looking for a tutorial which </p>

<ul>
<li>does not include all the mathematical notation </li>
<li>explains algorithm along with the analysis of the running ti... | algorithm analysis greedy algorithms | 1 |
6,637 | Memoized Palindrome Subsequence | <p>I am trying to find the maximum palindrome sub-sequence and after going through some tutorials, I came up with a memoized version.But I am not sure about the runtime.I want to know if the following algorithm will work.Could also someone explain what the runtime will be?</p>

<pre><code>Memoized-Palindrome(A,... | algorithm analysis dynamic programming memoization | 1 |
6,640 | Don Knuth and MMIXAL vs. Chuck Moore and Forth -- Algorithms and Ideal Machines -- was there any cross-pollination / influence in their ideas / work? | <p><strong>Question:</strong></p>

<p><strong>To what extent is it known (or believed) that Chuck Moore and Don Knuth had influence on each other's thoughts on ideal machines, or their work on algorithms?</strong></p>

<p>I'm interested in citations, interviews, articles, links, or any other sort of evi... | programming languages history | 1 |
6,641 | Counting sort on non-integers - why not possible? | <p>What is it about the structure of <a href="http://en.wikipedia.org/wiki/Counting_sort">counting sort</a> that only makes it work on integers?</p>

<p>Surely strings can be counted?</p>

<pre><code>''' allocate an array Count[0..k] ; initialize each array cell to zero ; THEN '''
for each input ite... | algorithms sorting | 1 |
6,649 | Proving that NPSPACE $\subseteq$ EXPTIME | <p>I am following <strong>"Introduction to the theory of computation" by Sipser</strong>.</p>

<p>My question is about relationship of different classes which is present in <strong>Chapter 8.2. The Class PSPACE</strong>.</p>

<p>$P \subseteq NP \subseteq PSPACE = NPSPACE \subseteq EXPTIME$</p>

... | complexity theory time complexity space complexity | 1 |
6,650 | How can P =? NP enhance integer factorization | <p>If ${\sf P}$ does in fact equal ${\sf NP}$, how would this enhance our algorithms to factor integers faster. In other words, what kind of insight would this fact give us in understanding integer factorization better?</p>
 | complexity theory computability np complete p vs np factoring | 1 |
6,655 | How can I prove that a build max heap's amortized cost is $O(n)$? | <p>Suppose a <strong>build</strong> max-heap operation runs bubble down over a heap. How does its amortized cost equal $O(n)$?</p>
 | data structures runtime analysis heaps | 1 |
6,656 | Is $\{a^nb^m \mid n,m\ge 0, n\ne m\}$ regular or not? | <blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/4752/prove-that-the-complement-of-0n1n-mid-n-geq-0-is-not-regular-using">Prove that the complement of $\{0^n1^n \mid n \geq{} 0\}$ is not regular using closure properties</a> </p>
</blockquote>
... | formal languages regular languages closure properties | 0 |
6,662 | Dynamic programming: Knapsack with repetition, Find the number of redundant machines | <p>I have just started to learn Dynamic Programming, and so far I have studied the few basic concepts; longest common subsequent problem, edit distance problem and the knapsack problem. I have attempted to solve the following exercise that is related with this topic, and so far I think I have a way how to approach it ,... | dynamic programming | 0 |
6,664 | Viterbi training vs. Baum-Welch algorithm | <p>I'm trying to find the most probable path (i.e., sequence of states) on an hidden Markov model (HMM) using the Viterbi algorithm. However, I don't know the transition and emission matrices, which I need to estimate from the observations (data).</p>

<p>To estimate these matrices, which algorithm should I use... | algorithms hidden markov models | 0 |
6,665 | Intuition behind Relativization | <p>I take course on Computational Complexity. My problem is I don't understand <strong>Relativization method</strong>. I tried to find a bit of intuition in many textbooks, unfortunately, so far with no success. I will appreciate if someone could shed the light on this topic so that I will be able to continue by myself... | complexity theory np complete complexity classes relativization np | 1 |
6,667 | What are the potential uses of a good R.N.S. system? | <p>We can consider a <a href="http://en.wikipedia.org/wiki/Residue_number_system" rel="nofollow">Residue Number System (R.N.S.)</a> that has efficient operations for add, multiply, and compare between two numbers.</p>

<p><strong>A more rigorous definition</strong></p>

<p>We can suppose that we can per... | algorithms data structures | 0 |
6,668 | Function that spreads input | <p>I'd like to know if there is a function $f$ from n-bit numbers to n-bit numbers that has the following characteristics:</p>

<ul>
<li>$f$ should be bijective</li>
<li>Both $f$ and $f^{-1}$ should be calculable pretty fast</li>
<li>$f$ should return a number that has no significant correlation to ... | binary trees hash binary arithmetic | 0 |
6,669 | Constructing a graph of min-degree k with the smallest diameter possible | <p>I need to build a graph with $N$ vertices such that each vertex has degree at least $k$ and the graph has the smallest diameter. What algorithm can I use?</p>
 | graphs | 0 |
6,672 | Prove multiple cell move instructions don't increase power of Turing Machines | <p>How can you prove that multiple-cell-move instructions, for example (X, Y, 5R) and (X, Y, 17L), do not increase the power of a Turing Machine? </p>
 | turing machines | 1 |
6,673 | 'Texas Hold Em Poker' Agent Heuristics to help decide whether to fold or bet? | <p>I am designing a poker agent with different heuristics to decide whether to raise, fold or pass (in Texas holdem poker). I am planning to have 4 heuristics with the agent biased to one of them.</p>

<p>The poker game will consist of 10 agents playing against each other.</p>

<p>I have two heuristics ... | artificial intelligence heuristics | 0 |
6,676 | Confusion about big-O notation comparison of two functions | <p>On page 16 of this <a href="http://www.cs.berkeley.edu/~vazirani/algorithms/all.pdf" rel="noreferrer">algorithms book</a>, it states:</p>

<blockquote>
 <p>For example, suppose we are choosing between two algorithms for a particular computational task. One takes $f_1(n) = n^2$ steps, while the other tak... | asymptotics landau notation | 1 |
6,678 | What is the difference between abstract and concrete data structures? | <p>I thought associative array (i.e. map, or dictionary) and hashing table were the same concept, until I saw in <a href="http://en.wikipedia.org/wiki/Abstract_data_type#Implementation" rel="nofollow noreferrer">Wikipedia</a> that</p>

<blockquote>
 <p>For dictionaries with very small numbers of bindings, ... | data structures abstract data types | 1 |
6,679 | Relation between interactive proof systems (IP), NP, coNP, PSPACE | <p>I would like to ask you some clarification on the following question:
know that ${\sf NP}$ is a subset of ${\sf IP}$ 
and also ${\sf coNP}$ it is a subset of ${\sf IP}$.
So ${\sf IP}$ is a biggest class, but how much it is big?</p>

<p>May i say that ${\sf PSPACE}$ is a subset of ${\sf IP}$? or t... | complexity theory time complexity space complexity complexity classes interactive proof systems | 0 |
6,680 | Is the codomain/range of a hash function always $\mathbb{Z}$ or $\mathbb{N}$? | <p>From <a href="http://en.wikipedia.org/wiki/Hash_function#Universal_hashing" rel="nofollow">Wikipedia</a></p>

<blockquote>
 <p>A hash function is any algorithm or subroutine that maps <strong>large data
 sets of variable length</strong>, called keys, to <strong>smaller data sets of a
 fixed le... | terminology hash | 1 |
6,688 | Guessing the best choice to maximize returns | <p>There are $N$ number of people and $X$ amount of objects with different values. Each person will choose an object and will obtain that objects value. If multiple people choose the same object then the value of the object is shared among the people. For example, If there are 2 objects and 3 people, one of the objects... | artificial intelligence randomized algorithms | 0 |
6,690 | How to quickly find a few bisimulations on a given labelled digraph? | <p>We are given a labelled directed graph, where both vertices (or states) and edges (or transitions) have labels. Informally, two states are bisimilar when they have the same label and they can simulate each other's transitions. On the states the two states evolve to, the same again is true.</p>

<p>More forma... | algorithms graphs process algebras | 1 |
6,694 | Floating-Point Binary to Decimal | <p>I'm having difficulty with the following question:</p>

<blockquote>
 <p>Given a bit pattern with mantissa $10110000$ and exponent $0111$, what
 does the bit pattern represent in denary (i.e decimal / base 10)?</p>
</blockquote>

<p>I got the right answer(!) but the wrong (or alternativ... | terminology binary arithmetic | 0 |
6,695 | Proving that if $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}$ | <p>I'd really like your help with proving the following.</p>

<p>If $\mathrm{NTime}(n^{100}) \subseteq \mathrm{DTime}(n^{1000})$ then $\mathrm{P}=\mathrm{NP}$.</p>

<p>Here, $\mathrm{NTime}(n^{100})$ is the class of all languages which can be decided by nondeterministic Turing machine in polynomial time... | time complexity complexity classes p vs np | 1 |
6,698 | Extract Max for a max-heap in $\log n + \log\log n$ comparisons | <p>Given a <strong>max heap</strong> with <strong>extract-max</strong> operation.</p>

<p>The basic version takes $2 \log n$ comparisons.
How can I make the running time just $\log n + \log\log n$ comparisons?
How about $\log n + \log\log\log n $ comparisons?</p>

<p>I thought of putting $-\inft... | data structures heaps | 1 |
6,700 | Finding $c$ and $n_0$ for a big-O bound | <p>A book I am reading demonstrates how $5n^3 + 2n^2 + 22n + 6 = O(n^3)$, which I believe is true. After all, there exists a value $c$ for which $cn^3$ is always greater than $5n^3 + 2n^2 + 22n + 6$ for all $n$ greater than or equal to some value $n_0$.</p>

<p>However, the book then casually notes that $c = 5$... | asymptotics landau notation | 1 |
6,702 | Prove that $2^{(log(n)^{1/2})}$ is $O(n^a)$ | <p>Hopefully this is the right section. I need to prove that $2^{(log(n)^{1/2})}$ is $O(n^a)$. From the basic principle of Big-O notation, I know I need to find two numbers $c$ and $N$ so that $f(n) \le c\cdot g(n)$ for all values of $n \ge N$. In this case, $f(n)$ is $2^{(log(n)^{1/2})}$, and $g(n)$ is $n^a$.</p>
... | asymptotics landau notation | 0 |
6,704 | Finite State Automata for recognising consecutive characters | <p>I'm currently working on this question as part of some homework, it has me stumped.</p>

<p><img src="https://i.stack.imgur.com/taFpH.png" alt="FSA Question"></p>

<p>I'm familiar with finite state automata (FSA), I know how they work and I've read everything I can find on Google, but nothing's helpe... | formal languages finite automata | 1 |
6,711 | When does $1.00001^n$ exceed $n^{100001}$? | <p>I have been told than $n^{1000001} = O(1.000001^n)$. If that's the case, there must be some value $n$ at which $1.000001^n$ exceeds $n^{1000001}$.</p>

<p>However, when I consult Wolfram Alpha, I get a negative value for when that occurs.
<a href="http://www.wolframalpha.com/input/?i=1.000001%5Ex+%3D+x%5... | asymptotics landau notation | 1 |
6,717 | Formalization of the shortest path algorithm to a linear program | <p>I'm trying to understand a formalization of the shortest path algorithm to a linear programming problem:</p>

<p>For a graph $G=(E,V)$, we defined $F(v)=\{e \in E \mid t(e)=v \}$ and $B(v)=\{ e \in E \mid h(e)=v\}$ where $t(e)$ is a tail of a node, and $h(e)$ is a head of a node.</p>

<p>Also the s... | algorithms graphs shortest path linear programming | 1 |
6,718 | coNP and limitation of NDTM | <p>I am trying to understand if someone can apply an <strong>NTM</strong> to recognize a <span class="math-container">$coNP$</span> language.</p>

<p>From the definition we know that:</p>

<p><span class="math-container">$NP$</span> - set of languages that can be recognized by NTM in polynomial time.</p... | complexity theory np complete complexity classes | 0 |
6,719 | CFG and PDA for the grammar that has perfectly nested parentheses and brackets | <p>I gotta make a CFG and PDA for the grammar that has perfectly nested parentheses and brackets.</p>

<p>$\qquad\begin{align}
 S &\to [S] \\
 S &\to (S) \\
 S &\to SS \\
 S &\to \varepsilon
\end{align}$</p>

<p>Not sure if this is correct, or how to make the PDA from... | formal languages automata formal grammars context free pushdown automata | 0 |
6,720 | Minimum weight triangulation | <p>I'm just curious about the pseudocode (or real source code, doesn't matter) of the recursive version of this algorithm. In almost every book chapter/paper when describing this topic, they mention that the recursive version takes exponential time and then they give the code for the dynamic programming approach. I und... | algorithms computational geometry recursion | 1 |
6,732 | Is there any nontrivial problem in the theory of serial algorithms with a nontrivial polynomial lower bound of $\Omega(n^2)$? | <p>In the theory of distributed algorithms, there are problems with lower bounds, as $\Omega(n^2)$, that are "big" (I mean, bigger than $\Omega(n\log n)$), and nontrivial.
I wonder if are there problems with similar bound in the theory of serial algorithm, I mean of order much greater than $\Omega(n\log n)$.</p>&#... | algorithms complexity theory lower bounds | 0 |
6,733 | Best a-little-advanced examples of dynamic programming | <p>I was offered by a professor to give some tutoring in his course of Algorithm Design, based on Kleinberg and Tardos' book. He suggested me to prepare two exercise on dynamic programming, one exercise for polynomial reduction, and another one for approximation algorithms.The exercise should be not too advanced, but n... | algorithms education dynamic programming | 0 |
6,735 | Reduction to Hamiltonian cycle | <p>Given that the <a href="http://en.wikipedia.org/wiki/Hamiltonian_path_problem" rel="nofollow">Hamiltonian cycle problem</a> is NP-complete, I want to prove that the following problem is NP-complete:</p>

<blockquote>
 <p>Given an undirected graph $G(V,E)$ and vertices $s,t\in V$, does there
 exist ... | complexity theory np complete reductions | 0 |
6,740 | One time pad, get plaintext using ciphers encoded with the same key | <p>I'm trying to solve a problem:</p>

<p>I have 11 ciphers encoded with the same key.
My aim is to decode target cipher.</p>

<p>If I do xor C1, C2 (<strong>ciphers encoded with the same key</strong>) I do get M1 xor M2 (where M1, M2 are plain text messages).</p>

<p>Please say what to do n... | cryptography encryption xor | 0 |
6,741 | probability wheel, redistribution of probabilities | <p>I have a contiguous ordered data structure (0 based index): </p>

<pre><code>x= [1/3, 1/3, 1/3]
</code></pre>

<p>Let's say I selected index 1 and increased the probability by 1/3. Rest of the probabilities each decrease by 1/6 and the total probability remains P = 1.</p>

<pre><code>x= [... | data structures probability theory | 1 |
6,744 | Algorithms for graph generation using given properties | <p>There may be a large number of algorithms proposed for generating graphs satisfying some common properties (e.g., clustering coefficient, average shortest path length, degree distribution, etc).</p>

<p>My question concerns a specific case: I want to generate a few <em>undirected regular</em> graphs (i.e., e... | algorithms graphs sampling | 1 |
6,749 | Depth First Search to find Minimum spanning tree | <p>A depth first search produces a spanning tree. If you perform DFS using all possible orderings of the adjacency list, wouldn't you find the minimum spanning tree? In other words, there is no example of a graph where a DFS won't find the minimum spanning tree regardless of how the adjacency list is ordered. Is this c... | algorithms graphs spanning trees | 0 |
6,751 | Improving Time Bound of this Algorithm past $O(n^2)$ | <p>I recently came across the following interesting problem - one is given a sequence of <code>X</code>s and <code>Y</code>s such as <code>XXYXYXYYXYXXXYX</code>, and consider a sequence to be good if, as you start at the left and move right, the number of <code>X</code>s is greater than or equal to the number of <code... | algorithms subsequences | 0 |
6,753 | Cantor's diagonal method in simple terms? | <p>Could anyone please explain Cantor's diagonalization principle in simple terms?</p>
 | complexity theory sets uncountability | 1 |
6,755 | Voronoi diagram with given number of vertices and sites | <p>I want to draw a Voronoi diagram with 9 sites and with </p>

<ol>
<li>no vertex, </li>
<li>1 vertex, </li>
<li>4 vertices, and</li>
<li>7 vertices.</li>
</ol>

<p>How do I approach this question. The one with no vertex is easy, it can be done by collinear points. What about the ot... | computational geometry | 1 |
6,757 | Showing a partition-like problem is NP-complete | <p>Given a set $A=\{a_{1},a_{2},a_{3},\ldots,a_{n}\}$, then construct a set $P=\{p_{1}, p_{2}, p_{3}, \ldots , p_{n}\}$ such that</p>

<ol>
<li><p>$|p_{i}|=a_{i}$, and </p></li>
<li><p>$\sum_{i = 1,}^{n}p_{i} = 0$.</p></li>
</ol>

<p>This problem is NP-complete, which I want to prove.</p>&#... | np complete reductions partitions | 0 |
6,758 | How many random walks to start from each node? | <p>Assume that we are given a real life graph, DBLP network in my case, where degree distribution of nodes follows a power law (many nodes have 1, 2 neighbors, and only a few nodes have hundreds of neighbors).</p>

<p>A random walk ends when it returns to the initial node or when the walk takes 3 steps.
If ... | graphs probability theory random walks | 0 |
6,763 | Fixed-length decision-tree-like feature selection to minimize average search performance | <p>I have a complex query $Q$ used to search a dataset $S$ to find $H_\text{exact} = \{s \in S \mid \text{where $Q(s)$ is True}\}$. Each query takes on average time $t$ so the overall time in the linear search is $t\cdot |S|$. I can break a query down into simpler sub-queries q_i and find $H_\text{approx} = \{s\in S \m... | algorithms optimization machine learning greedy algorithms databases | 0 |
6,765 | Maximum feasible subsystem problem (MaxFS) in 2 variables | <p><strong>Topic:</strong><br>
The <a href="http://risorse.dei.polimi.it/maxfs/" rel="nofollow">maximum feasible subsystem problem</a>, which is generally NP-hard [1].</p>

<p><strong>Question:</strong><br>
Are there special algorithms in case of only 2 variables (2D linear constraints)? The problem see... | computational geometry linear programming linear algebra | 0 |
6,766 | Unsupervised anomaly detection: assigning the clusters to normal and anomaly | <p>Having a unsupervised algorithm done on a dataset (e.g. K-means), how can I determine which cluster is normal and which is anomalous (for 30 clusters, for example)? </p>

<p>If the dataset contains normal traffic much more than anomalies (99%), then the radius of clusters associate to normal traffic is bigge... | machine learning pattern recognition | 0 |
6,768 | How is this grammar LL(1)? | <p>This is a question from the Dragon Book. This is the grammar:</p>

<blockquote>
 <p>$S \to AaAb \mid BbBa $<br>
 $A \to \varepsilon$<br>
 $B \to \varepsilon$ </p>
</blockquote>

<p>The question asks how to show that it is LL(1) but not SLR(1). </p>

<p>To prove that it is... | formal grammars compilers parsers | 1 |
6,770 | Rechecking contiguous characters (as in run length encoding) | <p>So I have a fun little problem. It will take a minute to explain, but the situation is conceptually very simple. Suppose you have a string of characters, which is interpreted as groups of one or more contiguous characters. This is for run length encoding or something. For example:</p>

<blockquote>
 <p>... | strings substrings | 0 |
6,771 | LR(1) - Items, Look Ahead | <p>I am having diffuculties understanding the principle of lookahead in LR(1) - items. How do I compute the lookahead sets ? </p>

<p>Say for an example that I have the following grammar:</p>

<p>S -> AB
A -> aAb | b
B -> d</p>

<p>Then the first state will look like this:</p>

<... | formal languages formal grammars context free parsing | 1 |
6,773 | Finding negative cycles for cycle-canceling algorithm | <p>I am implementing the cycle-canceling algorithm to find an optimal solution for the min-cost flow problem. By finding and removing negative cost cycles in the residual network, the total cost is lowered in each round. To find a negative cycle I am using the bellman-ford algorithm.</p>

<p>My Problem is:
... | algorithms graphs shortest path network flow | 1 |
6,775 | Building probability distribution functions from observation | <p>There are N players and M objects, each of the objects has a value. Each player has a strategy in choosing an object. Each round a player will choose an object, many players can choose the same object. However the value of each object is divided evenly among every player that has chosen it. There will be 9000 rounds... | machine learning probability theory modelling | 0 |
6,776 | Find the longest repeated pattern in a string | <p>I'm looking for an efficient algorithm to find the longest repeated pattern in a string.</p>

<p>For example, consider the following string of numbers: </p>

<p><code>5431428571428571428571428571427623874534</code>.</p>

<p>As you can see, <code>142857142857</code> is the longest pattern whi... | algorithms strings subsequences | 0 |
6,778 | How to draw a Turing Machine for Even-Even | <p>A TM to accept EVEN-EVEN (a collection of all strings with an even number of a's and an even number of b's) can be based on the algorithm:</p>

<ol>
<li>Move up the string, changing a’s to A’s</li>
<li>Move down the string, changing b’s to B’s</li>
</ol>

<p>Modified algorithm: To avoid t... | turing machines | 0 |
6,781 | Difference between reductions in algebraic problems versus reductions in computational intractability | <p>When I read about NP-completeness for the first time, I really wondered why is the concept of reductions given such high emphasis, after all we have been looking at concepts such as reductions and 'special case of one another problem' in mathematics since elementary algebra. What I mean by reductions in algebra is t... | complexity theory np complete np hard | 0 |
6,782 | Inheritance, and dynamic access to members/attributes and methods in Java-like languages | <p>I have a question about inheritance in Java-like OO programming languages. It came up
in my compiler class, when I explained how to compile methods and their invocation. I was using Java as example source language to compile. </p>

<p>Now consider this Java program.</p>

<pre><code>class A {
... | programming languages semantics typing object oriented java | 0 |
6,785 | What would an exponential reduction from an NP-complete problem to P signify? | <p>Taking an NP-complete problem like vertex cover if we can find a reduction which is exponential and not polynomial and the reduction we do to a problem can be solved in polynomial time, then what would be it's implications?</p>

<p>Based on Yuval's answer, I wanted to throw this scenario into the place also.... | complexity theory np complete p vs np | 0 |
6,788 | Sketch an IP proof for minSAT | <p>I have to sketch an IP proof for the minSAT problem. The minSAT problem is define in this way:</p>

<ul>
<li>For a given formulae find a satisfying assignment with a min subset of variables assigned to True;</li>
</ul>

<p>My sketched IP protocol is:</p>

<ol>
<li><p>Prover and Ve... | satisfiability interactive proof systems | 0 |
6,790 | Chained operations on sequences with two operators | <p>Given a <a href="http://en.wikipedia.org/wiki/Binary_expression_tree" rel="nofollow noreferrer">binary expresion tree</a>, with addition and multiplication operations, how can we optimize it's evaluation?</p>

<p>Can we learn from <a href="http://en.wikipedia.org/wiki/Matrix_chain_multiplication" rel="nofoll... | optimization binary trees dynamic programming efficiency arithmetic | 0 |
6,791 | Lambda calculus outside functional programming? | <p>I'm a university student, and we're currently studying Lambda Calculus. However, I still have a hard time understanding exactly why this is useful for me. I realize if you do loads of functional programming it might be useful, however I reckon that it's not really needed for learning functional programming, what do ... | lambda calculus functional programming | 1 |
6,797 | Modifying Dijkstra's algorithm for edge weights drawn from range $[1,…,K]$ | <p>Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using <a href="http://en.wikipedia.org/wiki/Dijkstra%27s_algorithm">Dijkstra's algorithm</a>, how can I modify the algorithm / data structure and improve the time complexit... | algorithms data structures shortest path weighted graphs | 1 |
6,799 | Are degree and order the same thing when referring to a B-Tree | <p>I know the term <strong>order</strong> of a B-tree. Recently I heard a new term: <strong>B tree with minimum degree of 2.</strong> </p>

<p>We know that the degree is related to a node but what is the degree of a tree?<br>
Does degree impose any kind of a restriction on height of a B-tree? </p>
 | terminology data structures search trees dictionaries | 0 |
6,800 | How to pack polygons inside another polygon? | <p>I have ordered a few leather sheets from which I would like to build juggling balls by sewing edges together. I'm using the Platonic solids for the shape of the balls.</p>

<p>I can scan the leather sheets and generate a polygon that approximates the shape of the leather sheet (as you know, it's animal skin,... | optimization computational geometry packing | 0 |
6,801 | Every simple undirected graph with more than $(n-1)(n-2)/2$ edges is connected | <p>If a graph with $n$ vertices has more than $\frac{(n-1)(n-2)}{2}$ edges then it is connected.</p>

<p>I am a bit confused about this question, since I can always prove that for a graph to connected you need more than $|E|>n-1$ edges.</p>
 | graphs | 1 |
6,807 | Matching girls with boys without mutual attraction (variant of maximum bipartite matching) | <p>Let us say you have a group of guys and and a group of girls. Each girl is either attracted to a guy or not, and vice versa. You want to match as many people as possible to a partner they like.</p>

<p>Does this problem have a name? Is it feasibly solvable? Sounds hard to me...</p>

<p>Ps. note that ... | algorithms graphs bipartite matching | 1 |
6,808 | Example of a parsing/rewriting system? | <p>I am studying formal languages and playing with writing my own parsers for them. I have a context free grammar parser already that works well. I am wondering if anyone can point me towards actually implemented examples of rewriters. For example, suppose I had the rules</p>

<p>WORD: [A-Z]+</p>

<p>QU... | formal languages parsers term rewriting | 0 |
6,809 | LL grammars and left-recursiviity | <p>Why LL(k) and LL(∞) are incompatible with left-recursion? I understand that a LL(k) language can support left-recursivity provided that with k-overahead tokens can be resolved any ambiguity. But, with a LL(∞) grammar, which type of ambiguities can't be solved?</p>
 | formal grammars parsers left recursion | 1 |
6,812 | Who (and when) first defined interval graphs? | <p>I've been searching google scholar for references and narrowed down the first mention to somewhere around <a href="http://books.google.com/ngrams/graph?content=interval%20graph&year_start=1800&year_end=2000&corpus=15&smoothing=0&share=">1963</a> with a very weird jitter in 1949.</p>

<p>S... | graphs reference request history | 1 |
6,813 | How does increasing the page size affect the number of page faults? | <p>If we let the physical memory size remain constant,</p>

<ul>
<li>What effect does the size of the page have on the number of frames? </li>
<li>What effect does the number of frames have on the number of page faults?</li>
</ul>

<p>Also, please provide reference strings as an example. </... | operating systems memory management virtual memory paging | 1 |
6,815 | What is the TAK function for? | <p>We covered this in class today. I understand the mechanics of it, but aside from being a nice example of recursion does it serve any purpose? </p>

<p><img src="https://i.stack.imgur.com/DOcD0.png" alt="enter image description here"></p>

<p>Searching the web reveals lots of pages with the formula an... | algorithms recursion | 1 |
6,819 | A variant of the assignment problem (?) | <blockquote>
 <p><strong>Possible Duplicate:</strong><br>
 <a href="https://cs.stackexchange.com/questions/6186/a-variant-of-the-assignment-problem">A variant of the Assignment Problem</a> </p>
</blockquote>



<p>(Not a comp.scientist, but have the basic research. Please excuse me if I'v... | optimization linear programming | 0 |
6,821 | How to distribute items of varying sizes into bins of varying sizes, such that percent utilization across all bins is minimized? | <p>I have a bunch of databases, each having different access patterns, such that each puts a different amount of load on its database cluster. I would like to distribute them around my set of database clusters such that the workload for the clusters is evenly distributed. </p>

<p>I looked at the <a href="http:... | algorithms partitions | 0 |
6,823 | Why is this $f(n) \leq 6n^3 + n^2 \log n \in O(n^3)$ for all $n \geq 1$? | <p>I'm currently studying for an algorithms midterm in about 2 days and am reading from the beginning of the course, and stumbled upon this when I actually looked at the examples.</p>

<p>The question equation: $f(n) = 6n^3 + n^2\log n$</p>

<p>The exact line written for the answer is: $f(n) \leq 6n^3 +... | asymptotics landau notation | 1 |
6,825 | Recursive relation help for dynamic programming 2D plane algorithm | <p>Consider a straight highway in the plane which can be modelled by a horizontal strip in the plane. A finite set T of targets are located on the highway, and a finite set S of wireless sensors are located outside of the highway. A sensor s can monitor a target t if and only if the Euclidean distance between s and t i... | algorithms dynamic programming | 0 |
6,833 | Solving recurrence with logarithm squared $T(n)=2T(n/2) + n \log^2n$ | <p>$T(n)=2T(n/2) + n\log^2(n)$.</p>

<p>If I try to substitute $m = \log(n)$ I end up with </p>

<p>$T(2^m)=2 T(2^{m-1}) + 2^m\log^{2}(2^m)$.</p>

<p>Which isn't helpful to me. Any clues?</p>

<p>PS. hope this isn't too localized. I specified that the problem was a squared logarithm whic... | asymptotics proof techniques recurrence relation | 1 |
6,837 | Knapsack problem with multiple constraints | <p>I am unsure if I have even identified the problem correctly, but reading up on <a href="http://en.wikipedia.org/wiki/Knapsack_problem" rel="nofollow">knapsack problem</a> seems the closest to what I am trying to solve:</p>

<blockquote>
 <p>A cook has $k$ ingredients of $p$ quantities. Given a
 lis... | algorithms knapsack problems | 0 |
6,839 | Minimum cost subset of sensors covering targets | <p>I have a dynamic programming problem: </p>

<blockquote>
 <p>If I have a set of sensors covering targets (a target might be
 covered by mutiple sensors) how can I find the minimum cost subset of
 sensors covering all targets given each sensor has a cost?</p>
</blockquote>

<p>I hav... | algorithms dynamic programming | 1 |
6,840 | A programming language that can only implement computable bijective functions? | <p>Are there programming languages(or logic) that can implement(or express) a function $f:\mathbb{N}\to \mathbb{N}$ if and only if $f$ is a computable bijective functions?</p>
 | reference request programming languages logic reversible computing | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.