id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
3,433
Are compilers able to detect alternating accesses to arrays and interleave them in memory?
<p>Is it possible to design a compiler which optimizes a loop in which arrays are accessed in alternate fashion? For example like this:</p>&#xA;&#xA;<pre><code>// int[] a,b&#xA;int sum = 0;&#xA;for(int i = 0; i &lt; n; i++)&#xA;{&#xA; sum += a[i] + b[i];&#xA;}&#xA;</code></pre>&#xA;&#xA;<p>With the usual sequential ar...
compilers arrays program optimization memory management
1
3,435
The meaning of modulo in “formula modulo a background theory”
<p>I have been reading some papers where I keep reading stuff like “first-order formula modulo a background theory”. Does anyone know what modulo means in this case ? Is it something like “with respect to”?</p>&#xA;
terminology logic term rewriting
1
3,439
How to reduce to an NP-hard problem?
<p>For an assignment I have to program an application to schedule conversations. &#xA;There is an event where representatives of the elementary schools talks with the representatives of high schools. They will talk about the students that will be transferred to the highschool. There are approximately 200 elementary sch...
complexity theory reductions np hard
0
3,449
Benefit of Backward Pass at compile time
<p>We collect most of the information about possible compiler optimizations during forward pass. Is it possible to utilize the information collected in forward pass in a backward pass so as to perform better optimizations ?</p>&#xA;&#xA;<p>Note: I have been going through the patent <a href="http://www.google.com/patent...
compilers program optimization
1
3,454
Using Loop Dependence analysis for vectorization
<p>How exactly <a href="http://en.wikipedia.org/wiki/Loop_dependence_analysis" rel="nofollow noreferrer">Loop Dependence Analysis</a> helps in <a href="http://en.wikipedia.org/wiki/Vectorization_(parallel_computing)" rel="nofollow noreferrer">vectorization</a> ? Are there any standard rules of safety criterias for para...
compilers parallel computing program optimization
1
3,455
References on teaching introductory programming courses
<p>As the new semester starts soon, I am interested in research regarding the teaching of introductory programming courses. I would like to improve my university course and I am looking for scientific papers on that topic.</p>&#xA;&#xA;<p>One trend I have seen is that some students (a smaller group) are interested in c...
reference request education
1
3,457
Math for TCS major
<p>I'm looking for a major in Theoretical Computer Science; specifically, I'm interested on complexity theory and probabilistic automata theory. As I'm graduating in one year, what advanced courses in math (like Galois theory or Harmonic analysis, for example) do you think would be useful to take over the next two seme...
complexity theory automata education
0
3,458
Unambiguity of Reverse Polish Notation
<p>Lets say I have given following grammar which generates arithmetic expressions in reverse polish notation:</p>&#xA;&#xA;<p>$G=({E},{a,+,*},P,E)$<br>&#xA;$P={ E \rightarrow EE+ | EE* | a }$ </p>&#xA;&#xA;<p>I know this grammar is unambiguous. </p>&#xA;&#xA;<p>What I do not understand is how I can prove this.</p>&#xA...
formal languages formal grammars
1
3,461
What is an IELR(1)-parser?
<p>I try to teach myself the usage of bison. The manpage bison(1) says about bison:</p>&#xA;&#xA;<blockquote>&#xA; <p>Generate a deterministic LR or generalized LR (GLR) parser employing LALR(1), IELR(1), or canonical LR(1) parser tables.</p>&#xA;</blockquote>&#xA;&#xA;<p>What is an IELR-parser? All relevant articles ...
formal languages terminology formal grammars parsers
1
3,462
Polynomially related lengths under two different encodings
<p>I'm reading through <code>"Computers and Intractability: A guide to the Theory of NP-Completeness" by Michael R. Garey and David S. Johnson, p. 20</code> and I came across this concept of a function that is polynomially related to input lengths obtained using some encoding scheme. Let $$Len:D_{\Pi}\rightarrow \mathb...
complexity theory polynomial time encoding scheme
1
3,463
Negation of nested quantifiers
<p>The problem is:</p>&#xA;&#xA;<p>$$\exists x \forall y (x \ge y)$$</p>&#xA;&#xA;<p>With a domain of all real positive integers.</p>&#xA;&#xA;<p>The negation is:</p>&#xA;&#xA;<p>$$\forall x \exists y (x &lt; y)$$</p>&#xA;&#xA;<p>so, if $y = x + 1$, the negation is true.</p>&#xA;&#xA;<p>That means the negation of the n...
logic first order logic
1
3,466
Fixed point, what does it mean in the world of computer science
<p>I keep coming across references to <a href="http://en.wikipedia.org/wiki/Fixed_point_%28mathematics%29" rel="nofollow noreferrer">fixed point</a> in questions and answers at stackexchange and I look up the meaning on the web obviously finding reference at sites such as Wikipedia. However none of the references reall...
terminology
1
3,469
What does "dummy argument" mean?
<p>What is does it mean when an argument to a function is called a <strong>dummy argument</strong>? I have not encountered this term outside Fortran, is it a general term in computer science? What would be examples of arguments passed as dummy and not passed as dummy?</p>&#xA;&#xA;<p>I found <a href="http://encyclopedi...
terminology programming languages functional programming
1
3,470
Value of constants in Big Theta notation
<p>In Big Theta notation used for defining the running time of an algorithm, are the constants $c_1$ and $c_2$ <em>different</em> for every value of $n$?</p>&#xA;&#xA;<p>Definition:</p>&#xA;&#xA;<p>$\qquad \displaystyle \Theta (g(n)) = \{ f(n): \exists\, c_1,c_2,n_0&gt;0. \forall n \geq n_0.\ \ c_1g(n) \leq f(n) \leq c...
terminology asymptotics mathematical analysis landau notation
0
3,474
Predicate Logic Paradox
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/3463/negation-of-nested-quantifiers">Negation of nested quantifiers</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>The problem is:</p>&#xA;&#xA;<p>∃x∀y(x ≥ y)</p>&#xA;&#xA;<p>With a domain of all real...
logic discrete mathematics
0
3,480
Algorithm that hashes a collection of sets following their disjointness relation
<p>I wonder whether there is a simple algorithm to do this work:</p>&#xA;&#xA;<p>Say I have a collection of objects $C$, and a binary relation $R: C\times C$ that is auto-reflective ($\forall c\in C: c R c$) , and symmetric ($\forall b,c\in C: b R c \implies c R b$). The relation is not necessarily transitive. </p>...
algorithms hash
0
3,482
Changing variables in recurrence relations
<p>Currently, I am self-studying Intro to Algorithms (CLRS) and there is one particular method they outline in the book to solve recurrence relations. </p>&#xA;&#xA;<p>The following method can be illustrated with this example. Suppose we have the recurrence</p>&#xA;&#xA;<p>$$T(n) = 2T(\sqrt n) + \log n$$</p>&#xA;&#xA;<...
asymptotics recurrence relation mathematical analysis landau notation
0
3,484
Converting function to bitwise only?
<p>I have a function to count upper bits of a 32 bit value. So if a number is 11100011111..., the result is 3 as there are 3 ones in the most significant place before a 0 is hit.</p>&#xA;&#xA;<p>I need to convert the function to use only bitwise operations (no if statements or while loops) and the total number of opera...
algorithms integers binary arithmetic
0
3,485
Successful applications of fuzzy logic to reasoning in AI?
<p>I've done some searching and it seems that fuzzy logic is used in (electronic) controllers. I'm interested in seeing how well it fares as a tool for reasoning. Are there any robots or programs that do clever things with it?</p>&#xA;
reference request artificial intelligence reasoning
0
3,486
Minimum vertex-weight directed spanning tree where the weight function depends on the tree
<p>Given a directed graph $G=(V,E)$ and a node $r\in V$, I need to grow a tree $T$ rooted at $r$ that has a minimum weight and spans all reachable nodes in $G$.</p>&#xA;&#xA;<p>The weight function assigns a non-negative weight to each node, which depends on the node's ancestors in $T$. Specifically, for some fixed set...
algorithms graphs optimization spanning trees
0
3,487
Using a step-counting function in a Turing Machine construction
<p>I have an question relating to the elementary foundations of Turing Machine theory. I would like to have a clarification of the status of a function $\phi$ (a mapping between TM indexes) I shall introduce in the formal question after the preamble. First to the preamble.</p>&#xA;&#xA;<p>Let us assume that we have a f...
complexity theory computability turing machines
1
3,489
Impossibility condition in the Byzantine Generals problem
<p>I am unable to understand why there is a requirement of 3m+1 generals overall given m traitors. As per my understanding, the steps are as follows:</p>&#xA;&#xA;<ol>&#xA;<li>Each general decides a strategy and forwards their strategy to all the other ($3m$) generals.</li>&#xA;<li>Each general forwards a vector contai...
distributed systems fault tolerance
0
3,494
Length of the certificate in complexity classes
<blockquote>&#xA; <p>A nondeterministic machine trying to decide membership in a language&#xA; is presented with a hint (called a "witness" or "certificate") which&#xA; proves membership (no such witness is provided for elements outside&#xA; the language; the definition is asymmetric).</p>&#xA;</blockquote>&#xA;&#x...
complexity theory terminology nondeterminism
0
3,495
Complexity inversely propotional to $n$
<p>Is it possible an algorithm complexity decreases by input size? Simply $O(1/n)$ possible?</p>&#xA;
algorithms time complexity asymptotics landau notation
1
3,501
Approximating the Kolmogorov complexity
<p>I've studied something about the <a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity">Kolmogorov Complexity</a>, read some articles and books from <a href="http://homepages.cwi.nl/~paulv/kolmogorov.html">Vitanyi and Li</a> and used the concept of <a href="http://complearn.org/ncd.html">Normalized Compression...
computability approximation data compression kolmogorov complexity
1
3,503
Reduction from knapsack problem to Integer relation that equals one
<p>My question is related to the <a href="http://en.wikipedia.org/wiki/Integer_relation_algorithm" rel="nofollow noreferrer">Integer Relation Detection Problem</a> which can be formulated as:</p>&#xA;&#xA;<p>$\qquad a_1x_1 + a_2x_2 + \cdots + a_nx_n = 0$</p>&#xA;&#xA;<p>Where $\forall i. a_i\in\mathbb{Z} \land a_i&lt;c...
algorithms complexity theory np hard number theory knapsack problems
0
3,504
Solving $T(n)= 3T(\frac{n}{4}) + n\cdot \lg(n)$ using the master theorem
<p><em>Introduction to Algorithms</em>, 3rd edition (p.95) has an example of how to solve the recurrence</p>&#xA;&#xA;<p>$$\displaystyle T(n)= 3T\left(\frac{n}{4}\right) + n\cdot \log(n)$$</p>&#xA;&#xA;<p>by applying the Master Theorem.</p>&#xA;&#xA;<p>I am very confused by how it is done. So, $a=3, b=4, f(n) = n\cdot ...
asymptotics recurrence relation landau notation mathematical analysis master theorem
1
3,509
NP-complete proof from Dasgupta problem on Kite
<p>I am trying to understand this problem from <a href="https://docs.google.com/viewer?a=v&amp;q=cache%3azCRhhxjqT5cJ%3awww.cs.berkeley.edu/~vazirani/algorithms/chap8.pdf%20&amp;hl=en&amp;gl=us&amp;pid=bl&amp;srcid=ADGEEShy1bvJEehdocFNfXKJs7p_TSog4n_ktXYth1MI0n1aUBo_L5Wbd-gzn5OH3QMnAv8mHqNKXJ8t1CXv3rle7avzGFVFN7DliQEAS...
complexity theory np complete reductions
1
3,510
What are the mathematical prerequisites for adaptive machine learning algorithms?
<p>I am a PhD student in Computer Science who switched his PhD a little bit towards ML algorithms combined with something else... I am an expert in that something else, say image processing, but not an expert in Machine Learning. What should I read/learn to get the ML mathematics right? Especially for adaptive learning...
reference request machine learning education learning theory
1
3,512
Given an LR grammar G and a string w, is it possible to quickly find all substrings in w that are in L(G)?
<p>Say I have an LR grammar <em>G</em> and a string <em>w</em>. I know that I can check if <em>w</em> is in the language of <em>G</em> in linear time. But what if <em>w</em> itself is not in the language of <em>G</em>, but I want to find all substrings of <em>w</em> that are in the language of <em>G</em>? And can I get...
formal grammars parsing substrings
0
3,513
Proving that the conversion from CNF to DNF is NP-Hard
<p>How can I prove that the conversion from CNF to DNF is NP-Hard?</p>&#xA;&#xA;<p>I'm not asking for an answer, just some suggestions about how to go about proving it.</p>&#xA;
complexity theory np hard satisfiability sat solvers normal forms
0
3,515
Two definitions of balanced binary trees
<p>I have seen two definitions of balanced binary trees, which look different to me.</p>&#xA;&#xA;<ol>&#xA;<li><p>A binary tree is balanced if for each node it holds that the number of inner nodes in the left subtree and the number of inner nodes in the right subtree differ by at most 1.</p></li>&#xA;<li><p>A binary tr...
data structures binary trees
0
3,516
A tentative satisfiability algorithm
<p>General satisfiability (with a few exceptions such as Horn Clauses) is not believed to have an algorithmic solution. However, the following algorithm appears to be a solution for general satisfiability. What exactly is the flaw with the following algorithm? </p>&#xA;&#xA;<ol>&#xA;<li>Let $W$ be an empty set whi...
algorithms logic satisfiability constraint programming
0
3,517
Finding odd directed circuit
<p>I want to write an algorithm to find whether a directed circuit whose length is odd exists in a strongly connected digraph.</p>&#xA;&#xA;<p>Can anyone help me how to proceed with this problem???</p>&#xA;
algorithms graphs
0
3,519
Can all languages have semantic and logical errors?
<p>I have been reading about PHP and many authors mention semantic and logical errors separately. As an example of a semantic error, they give a function called with incorrect number of parameters: this will not be caught by the parser, but will throw an error when run.</p>&#xA;&#xA;<p>Yet in languages such as C++, thi...
terminology programming languages compilers program correctness
0
3,523
Explaining the relevance of asymptotic complexity of algorithms to practice of designing algorithms
<p>In algorithms and complexity we focus on the asymptotic complexity of algorithms, i.e. the amount of resources an algorithm uses as the size of the input goes to infinity. </p>&#xA;&#xA;<p>In practice, what is needed is an algorithm that would work fast on a finite (although possibly very large) number of instances....
algorithms complexity theory education
0
3,526
On-line simulation of a two-head tape Turing machine using single-head tape(s)
<p>I have a question and I haven't been able to figure out the answer yet. I need to do the on-line simulation of a two-head tape Turing machine using single-head tape(s). I've found some online articles for the fact that one single-head tape doesn't suffice for this problem and the simulation should be done using two ...
computability turing machines machine models simulation
0
3,529
How does a single-track Turing machine simulate a multi-track Turing machine?
<p>It's easy to see how a multi-track Turing machine can simulate a single-track Turing machine; it does so by ignoring all but the first track. But how does it work the other way? I need a specification of a transition function that does the job. If there are $k$ tracks, then we can think of symbols as being vectors a...
computability turing machines simulation
1
3,532
Help Finding Loop Invariant From For Loop
<p>I have created the algorithm below...</p>&#xA;&#xA;<pre><code> String A = v[0];&#xA; int val = 1;&#xA;&#xA; for (int i = 1; i &lt; v.length; i++) {&#xA; if (val == 0) {&#xA; A = v[i];&#xA; val++;&#xA; } else if (v[i].equals(A))&#xA; ...
algorithms loop invariants correctness proof
0
3,533
Infinite alphabet Turing Machine
<p>Is a Turing Machine that is allowed to read and write symbols from an infinite alphabet more powerful than a regular TM (that is the only difference, the machine still has a finite number of states)?</p>&#xA;&#xA;<p>Intuition tells me not, since you need an infinite number of states to differentiate each symbol. So ...
computability turing machines reductions simulation
1
3,537
Is a single symbol, not in a set, a language?
<p>I was reading about Turing machines and realized I'm not sure about the difference between the following scenario. Given the alphabet $\Sigma = \{a, b \}$, we have the following assertions:</p>&#xA;&#xA;<ol>&#xA;<li>$a \in R $</li>&#xA;<li>$\{a\} \in R$</li>&#xA;</ol>&#xA;&#xA;<p>I think that assertion $1$ is incorr...
formal languages terminology computability
1
3,539
Recommended Reading for non-CS undergraduate student doing a research Project on Travelling Salesman Problem
<p>I am an undergraduate student in Industrial Engineering. I have taken the topic of Travelling Salesman Problem as a Research Project for my final year. More specifically, I am focusing on <strong>Convex Hulls for solving the Euclidean TSP</strong>.</p>&#xA;&#xA;<p>I have gone through the published literature and hav...
reference request optimization books traveling salesman
0
3,542
What if a formal grammar cannot be terminated?
<p>I'm currently in a class on Computability and we just finished looking at formal grammars before moving onto finite automata. We were given an several examples of a formal grammar, and one stuck out in particular:</p>&#xA;&#xA;<pre><code>V: { S, A, B, C }&#xA;T: { a, b, c }&#xA;P: {&#xA; S -&gt; aA | λ | ASA&#xA;...
formal grammars
1
3,545
Self-Study of Computer Science
<p>I am a 16 year old male who has recently been gifted a big encyclopedia on computer science by a friend of mine. I am usually not that interested in computers and technology, but computer science has started to fascinate me. I do however intend to study Physics and/or Mathematics and not CS, so my question is, would...
reference request education
0
3,550
Is there any research to indicate programmers are/are not moving to a hybrid of functional and object-oriented?
<p>I am converting the OCaml <a href="http://caml.inria.fr/pub/docs/manual-ocaml/libref/Format.html" rel="nofollow">Format</a> module which does I/O and maintains state in a record with mutable values. As such it is a good candidate for me to convert to pure <a href="http://en.wikipedia.org/wiki/F_Sharp_%28programming_...
reference request programming languages functional programming object oriented
0
3,554
What is the difference between halting, accepting, and deciding in the context of Turing machines?
<p>Does accepting mean that the TM will read and recognize a char from the cell it's currently reading from? And is it the case that a TM halts iff the input is decidable?</p>&#xA;
terminology turing machines undecidability
1
3,555
What is the difference between decidability and computability?
<p>If they are different, what are the typical problems in each that do not fall on the other category? Or are the mutually exclusive or does one completely capture the other?</p>&#xA;
computability terminology
1
3,557
What constitutes one operation/cycle/move in the RAM model?
<p>I saw a RAM model diagram that displayed an input tape, output tape, the program (read-only), the instruction pointer, and the memory registers. However, when I look at questions of time complexity, it is relevant how much time the program needs to spend on one action. Say you want to read one integer symbol from th...
algorithms time complexity algorithm analysis machine models
1
3,559
Is star closure of reverse of language equivalent to reverse of closure of that language
<p>is the following true &#xA;$ (L^R)^* = (L^*)^R $ </p>&#xA;&#xA;<p>I tried the following to prove it true.&#xA;let u,v belong to L then $ L^* = \{ u,v, uu, vv, uv, vu ... \} $&#xA;and $ (L^*)^R = \{ u^R, v^R, u^Ru^R, v^Rv^R, v^Ru^R, u^Rv^R ... \} $</p>&#xA;&#xA;<p>now $ L^R = \{ u^R, v^R \} $ so &#xA;$(L^R)^* = \{ u^...
formal languages automata
1
3,562
Variation of the dining philosophers: is the standard solution still valid?
<p>I have a problem that is almost equal to the standard one of the dining philosophers, but has a quirk: while a philosopher thinks, he still holds the fork on his left.</p>&#xA;&#xA;<p>If after the period of thinking (which isn't infinite), I release the fork on the left and then apply the normal solution (that is, a...
operating systems concurrency synchronization
0
3,563
n*log n and n/log n against polynomial running time
<p>I understand that $\Theta(n)$ is faster than $\Theta(n\log n)$ and slower than $\Theta(n/\log n)$. What is difficult for me to understand is how to actually compare $\Theta(n \log n)$ and $\Theta(n/\log n)$ with $\Theta(n^f)$ where $0 &lt; f &lt; 1$.</p>&#xA;&#xA;<p>For example, how do we decide $\Theta(n/\log n)$ v...
asymptotics mathematical analysis landau notation
1
3,570
How to generate inputs to evaluate the performance of an implementation?
<p>How can we assert that the performance of an implementation matches the expected performance defined in terms of Big-$\mathcal{O}$ and friends by generating best/worst case inputs? I'm thinking of a table whose columns are <strong>input length</strong>, <strong>expected running time</strong>, <strong>actual running ...
performance benchmarking
0
4,570
Kolmogorov complexity of string concatenation
<p>If $K(s)$ is the <a href="http://en.wikipedia.org/wiki/Kolmogorov_complexity" rel="noreferrer">Kolmogorov complexity</a> of the string $s \in \{0,1\}^*$,</p>&#xA;&#xA;<blockquote>&#xA;Can we prove (or disprove) the following statement:&#xA;<br><br>&#xA;"Every string $s$ is a prefix of an incompressible string; i.e. ...
computability kolmogorov complexity
1
4,571
What is the probability of friendship conditioned on the number of mutual friends
<p>Let Alice and Bob be two users chosen uniformly at random from a social network (e.g. Facebook). What is the probability that they are friends assuming that they share $k$ mutual friends?</p>&#xA;&#xA;<p>I am interested both in the experimental values (or estimates) from currently existing social networks (e.g. Face...
graphs combinatorics social networks random graphs
0
4,572
Why isn't converting from an NFA to a DFA working?
<p>I am just beginning to learn computation theory. I wrote up a non-deterministic finite automata that accepts strings that contain the substring "abba":</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/jZx92.jpg" alt="My NFA"></p>&#xA;&#xA;<p>I tried to convert it to a DFA by putting together sets of states in the...
automata finite automata
1
4,577
What approaches are most useful when proving uncomputability of a given function?
<p>I'd like to understand what approaches should one adopt when deciding/proving that a given function <em>F</em> is uncomputable, by any Turing Machine (TM). The ones I've tried so far are as follows:</p>&#xA;<ul>&#xA;<li>Reduction, from a known uncomputable function (such as <span class="math-container">$UC(\alpha)$<...
computability turing machines proof techniques undecidability
0
4,578
Why does heapsort run in $\Theta(n \log n)$ instead of $\Theta(n^2 \log n)$ time?
<p>I am reading section 6.4 on Heapsort algorithm in CLRS, page 160.</p>&#xA;&#xA;<pre><code>HEAPSORT(A) &#xA;1 BUILD-MAX-HEAP(A) &#xA;2 for i to A.length downto 2 &#xA;3 exchange A[i] with A[i]&#xA;4 A.heap-size = A.heap-size-1 &#xA;5 MAX-HEAPIFY(A,1)&#xA;</code></pre>&#xA;&#xA;<p>Why is the running time, ac...
algorithms algorithm analysis landau notation sorting
1
4,583
Doubt with a problem of grown functions and recursion tree
<p>I'm confused to conclude the recursion tree method a guess for the next recurrence:&#xA;$$T(n)=3T\left (\left\lfloor \frac{n}{2}\right \rfloor\right) +n$$&#xA;I write some costs for the levels of tree, you can see, but I'm confusing in the final guess. I know for the master theorem that the answer for the guess is l...
algorithms asymptotics runtime analysis recurrence relation
0
4,584
Computing the running time of a divide-by-4-and-conquer algorithm
<p>I write this code in python:</p>&#xA;&#xA;<pre><code>def sub(ma):&#xA; n = len(ma); m = len(ma[0])&#xA; if n != m : return&#xA; n2 = int(ceil(n/2))&#xA; a = []; b = []; c = []; d = [] &#xA; for i in range(n2):&#xA; a.append(ma[i][0:n2])&#xA; b.append(ma[i][n2:n])&#xA; c.append(ma[...
algorithms algorithm analysis runtime analysis recurrence relation
1
4,590
Big O: Nested For Loop With Dependence
<p>I was given a homework assignment with Big O. I'm stuck with nested for loops that are dependent on the previous loop. Here is a changed up version of my homework question, since I really do want to understand it:</p>&#xA;&#xA;<pre><code>sum = 0;&#xA;for (i = 0; i &lt; n; i++ &#xA; for (j = 0; j &lt; i; j++) &#xA...
algorithms algorithm analysis runtime analysis landau notation
0
4,592
Creating artificial NP-Complete problems
<p>Stephen Cook's proof of the NP-completeness of SAT is constructive. Given a Turing machine $M$, one can create a logical formula that is satisfiable if and only if $M$'s computation halts in an accepting state. This suggests that we could take a logical formula and create a Turing machine $M'$ whose computation is d...
algorithms np complete
1
4,593
Banker's Algorithm and deadlocks
<p>So we have the following table of processes , where A, B and $\Gamma$ are the resources.</p>&#xA;&#xA;<p>Here is a pic that i drew with the processes and the resources.</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/MzpAz.jpg" alt="Table"></p>&#xA;&#xA;<p>So the exact question is this: Using banker's algorithm,...
algorithms reference request concurrency
0
4,600
Given a fast and a slow computer, at what sizes does the fast computer running a slow algorithm beat the slow computer running a fast algorithm?
<p>The source of this question comes from an undergraduate course I am taking, which covers an introduction to the analysis of algorithms. This is not for homework, but rather a question asked in CLRS.</p>&#xA;&#xA;<p>You have a slow machine running at $x$ MIPS, and a fast machine running at $y$ MIPS. You also have two...
algorithms algorithm analysis runtime analysis mathematical analysis
0
4,603
When should I learn artificial intelligence?
<p>Straight to the point: I would really like to learn AI.</p>&#xA;&#xA;<p>But I want some advice from experienced CS guys as to when I should jump into Artificial Intelligence.</p>&#xA;&#xA;<p>What prerequisites are needed in order for me to better grasp the AI concepts?</p>&#xA;
artificial intelligence
1
4,607
Are there grammar classes between Chomsky level 1 and 2?
<p>Are there any grammar classes which are true subsets of Chomsky level 2 but not equal to level 1?</p>&#xA;
formal languages formal grammars
0
4,611
Anonymization of dataset preserving unique identities
<p>The $k$-anonymization paradigm (and its refinements) means to create datasets where every tuple is identical with $k-1$ others.</p>&#xA;&#xA;<p>However I'm in a situation where people are in the dataset many times. And I want to follow their progress through the health care system, so I need to know who is who. If I...
algorithms security databases
1
4,612
Subtracting lower-order term to prove subtitution method works
<p>Substation method fails to prove that $T(n)=\Theta(n^2) $ for the recursion $T(n)=4T(n/2) + n^2$, since you end up with $T(n) &lt; cn^2 \leq cn^2 + n^2$.</p>&#xA;&#xA;<p>I don't understand how to subtract off lower-order term to prove that substitution works. </p>&#xA;&#xA;<p>Came up with: $T(n) \leq cn^2 - bn^2$</...
asymptotics recurrence relation landau notation
1
4,614
Why do the swap step in Prim's algorithm for minimum spanning trees?
<p>I was watching the <a href="http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/lecture-16-greedy-algorithms-minimum-spanning-trees/" rel="nofollow">video lecture from MIT on Prim's algorithm for minimum spanning trees</a>.&#xA;Wh...
algorithms graphs algorithm analysis greedy algorithms spanning trees
1
4,616
Bloom Filter for 208 million URLs
<p>I need to create a bloom filter of 208 million URLs. What would be a good choice of bit vector size and number of hash functions? I tried a bit vector of size 1 GB and 4 hash functions, but it resulted in too many false positives while reading.</p>&#xA;&#xA;<p>I have a huge web corpus containing web content of billi...
data structures probabilistic algorithms searching big data bloom filters
0
4,617
How to efficiently determine whether a given ladder is valid?
<p>At my local squash club, there is a <a href="http://en.wikipedia.org/wiki/Ladder_tournament">ladder</a> which works as follows.</p>&#xA;&#xA;<ol>&#xA;<li>At the beginning of the season we construct a table with the name of each&#xA;member of the club on a separate line.</li>&#xA;<li>We then write the number&#xA;of g...
algorithms graphs
0
4,618
What piece am I missing to turn this idea into a programming language?
<p>I've been doing some reading (I'll name drop along the way) and have selected a few scattered ideas that I think could be cobbled together into a nifty esoteric programming language. But I'm having some difficulty assembling the parts.</p>&#xA;&#xA;<p>Kleene's Theorem states: Any Regular Set can be recognized by som...
programming languages finite automata arrays neural networks machine models
1
4,619
Are there any problems that are easy to compute but hard to verify?
<p>Assuming P $\neq$ NP, NP-complete problems are "hard to solve, but have answers that are easy to check." Does it make any sense to consider the opposite, that is, problems for which it's easy to compute a correct answer, but hard to verify an arbitrary purported solution?</p>&#xA;&#xA;<p>I think such a problem woul...
complexity theory
1
4,625
How to reduce MaxUNSAT to MaxSAT?
<p>Is it possible to reduce MaxUNSAT to <a href="http://en.wikipedia.org/wiki/Maximum_satisfiability_problem" rel="nofollow noreferrer">MaxSAT</a> in a polynomial way ?</p>&#xA;<p>When considering the MaxSAT problem, one often considers also the <code>MinUNSAT</code> problem, which is almost the same. And for a proposi...
complexity theory optimization reductions satisfiability
0
4,627
Looking for a simple example of Transition Semantics
<p>I want to define a semantics of a DSL through transition semantics. For my DSL I defined the syntax and implemented a code generator. Although I can provide a demo by giving examples, I want to write the semantics of my DSL to provide a formal specification of it. </p>&#xA;&#xA;<p>However I don't know how to do it!....
formal languages semantics
0
4,629
Finding the Shortest path in undirected weighted graph
<p>Is there an algorithm for finding the shortest path in an undirected weighted graph?</p>&#xA;
algorithms graphs shortest path
0
4,630
Can an LL(k) parser parse any grammar without left recursion or common prefixes?
<p>I'm being asked to create a "top down grammar" for a certain language (I'm pretty sure there's no such thing as a "top down grammar" but I think it means write a grammar that an LL(k) parser can parse).</p>&#xA;&#xA;<p>I'm pretty sure the language is not LL(1), but I can remove left-recursion and common prefixes fro...
formal languages compilers parsers ll k
0
4,631
Heuristically determine a value f such that a probability d/f approaches 1/2
<p>We have a set X of N elements. We want to get a new set X' having a size M &lt; N.</p>&#xA;&#xA;<pre><code>Choose a first element x from X and put it in X'&#xA;for each element x in (X - X')&#xA; Let x' the element from X' which is the closest to x (that is x' = argmin distance(x, x') for all x' in X')&#xA; d = di...
probability theory mathematical analysis heuristics statistics
0
4,635
Minimal Spanning Tree With Double Weight Parameters
<p>Consider a graph $G(V,E)$. Each edge $e$ has two weights $A_e$ and $B_e$. Find a spanning tree that minimizes the product $\left(\sum_{e \in T}{A_e}\right)\left(\sum_{e \in T}{B_e}\right)$. The algorithm should run in polynomial time with respect to $|V|, |E|$.</p>&#xA;&#xA;<p>I find it difficult to adapt any of the...
algorithms graphs spanning trees
0
4,639
Compression of sequence with Direct Access
<p>I have a sequence of $n$ integers in a small range $[0, k)$ and all the integers have the same frequency $f$ (so the size of the sequence is $n = f * k$). What I'm trying to do now is to compress this sequence while providing random access (what is the $i$-th integer). I'm more interested in achieving high compressi...
algorithms data compression
1
4,643
Get specified bit in addition of two large binary numbers
<p>I am performing an addition operation on two large binary numbers that have an equal number of bits. Both numbers are stored in an array of length $N$, which is rather large.</p>&#xA;&#xA;<p>At first I tried running a loop over them and keeping track of carry bits. This wasted time, because the aim is to get the bit...
arrays integers binary arithmetic
0
4,650
Unification vs. SAT solver
<p>I read on Wikipedia that <a href="http://en.wikipedia.org/wiki/Unification_%28computer_science%29">unification</a> is a process of solving the satisfability problem.</p>&#xA;&#xA;<p>At the same time, I know that such solvers are called "SAT solvers" or "SMT solvers". So, are they different names for the same thing?<...
terminology sat solvers unification
1
4,653
Redundancy elimination in the superposition calculus
<p>When proving theorems with the superposition calculus, we deal with three kinds of rules:</p>&#xA;&#xA;<ol>&#xA;<li><p>Generating rules: from pair of clauses A and B, generate new clause C while keeping the original pair, e.g. superposition in the general case.</p></li>&#xA;<li><p>Rewriting rules: from clause A gene...
logic automated theorem proving
1
4,654
Converting a context free grammar to a PDA -- is my solution correct?
<p>I'm reviewing for my midterm and wanted to post this to see if anyone can spot any errors. Im supposed to make a PDA that recognizes this CFG:</p>&#xA;&#xA;<p>$\qquad\begin{align}&#xA; S &amp;\to R1R1R1 \\&#xA; R &amp;\to 0R \mid 1R \mid \varepsilon&#xA;\end{align}$</p>&#xA;&#xA;<p>Here is my solution; I'm aware t...
formal languages automata context free pushdown automata
0
4,656
Finding the number of leaves in a imbalanced recursion tree
<p>I'm going through the MIT Online Course Videos on Intro. to Algorithms at <a href="http://video.google.com/videoplay?docid=-3860843648161712896" rel="nofollow">here</a> at around 38:00.</p>&#xA;&#xA;<p>So we have a recursion formula</p>&#xA;&#xA;<p>$\qquad T(n) = T(n/10) + T(9n/10) + O(n)$</p>&#xA;&#xA;<p>If we buil...
algorithm analysis asymptotics recurrence relation
1
4,659
Some questions on parallel computing and the class NC
<p>I have a number of related questions about these two topics.</p>&#xA;&#xA;<p>First, most complexity texts only gloss over the class $\mathbb{NC}$. Is there a good resource that covers the research more in depth? For example, something that discusses all of my questions below. Also, I'm assuming that $\mathbb{NC}$...
complexity theory reference request parallel computing complexity classes
0
4,660
Difference between multimethods and overloading
<h2>Context</h2>&#xA;&#xA;<p>I've been programming in java for a few years now. And atm i'm learning something totally different: Clojure.&#xA;There the expression problem can be solved by using multimethods whereas in java you will need something like the visitor pattern or something alike.</p>&#xA;&#xA;<h2>The questi...
programming languages semantics functional programming object oriented
1
4,666
What is the significance of reverse polish notation?
<p>I teach computing to 18 year olds. After having reverse polish notation (RPN) explained to them, one asked why is it significant enough to be in the public exam. I explained the historical significance of '70s calculators, but this failed to really address the issue.</p>&#xA;<p>So, are there any modern practical or ...
terminology education
0
4,667
complexity of decision problems vs computing functions
<p>This is an area that admittedly I've always found subtle about CS and occasionally trips me up, and clearly others. recently on <a href="http://www.tcs.se" rel="nofollow noreferrer">tcs.se</a> a user asked an apparently innocuous question about <a href="https://cstheory.stackexchange.com/questions/12682/is-the-n-que...
algorithms complexity theory reference request time complexity np complete
1
4,670
When are Dynamic and Lexical Scoping equivalent?
<p>I am designing a small DSL and I know that implementing dynamic scoping (with a simple global stack) is easier then using full lexical scoping (each function needs its own scope/closure). What kind of features can be added that do not care how scope is implemented and what features would require a particular kind of...
programming languages semantics
1
4,671
If the “is P equals to NP?” is a NP-COMPLETE, what does it tell us?. Some conclusions?
<p>If there is someone can prove that the problem "is P equals to NP?" is a NP-COMPLETE problem, what we can conclude from this?</p>&#xA;
complexity theory p vs np
0
4,672
Büchi automaton with modified acceptance condition
<p>Consider a Büchi automaton $\mathcal{A}$ with the modified acceptance condition, that an $\omega$-word $\mathcal{w}$ is accepted by $\mathcal{A}$ iff every run $\rho$ of $\mathcal{A}$ on $\mathcal{w}$ is accepting (rather than at least one run being accepting). I need to show that this automaton also accepts only $\...
formal languages automata buchi automata
1
4,673
Difference between HSI and YCbCr for pattern recognition by color
<p>I am doing a project on face detection in C#. I want to find the skin area by using skin color segmentation. For that purpose, I have to extract the skin area.</p>&#xA;&#xA;<p>I know I can use <a href="http://en.wikipedia.org/wiki/HSI_color_space" rel="nofollow">HSI</a> or <a href="http://en.wikipedia.org/wiki/YCbCr...
pattern recognition image processing
0
4,675
Size of Maximum Matching in Bipartite Graph
<p>Am I correct in my observation that the cardinality of the maximum matching $M$ of a bipartite graph $G(U, V, E)$ is always equal to $\min(|U|, |V|)$?</p>&#xA;
graphs bipartite matching
1
4,678
Is busy beaver the fastest growing function known to man?
<p>I just had this interesting question. What is the fastest growing function known to man? Is it <a href="http://en.wikipedia.org/wiki/Busy_beaver">busy beaver</a>?</p>&#xA;&#xA;<p>We know functions such as $x^2$, but this function grows slower than $2^x$, which in turn grows slower than $x!$, which in turn grows slow...
computability
0
4,681
Double-nested loop with bitwise operation
<p>I have this little exercise:</p>&#xA;&#xA;<pre><code>for ( i = 0; i &lt; 2 * n; i += 2 )&#xA; for ( j = 1; j &lt;= n; j &lt;&lt;= 1 )&#xA; if ( j &amp; i )&#xA; foo ();&#xA;</code></pre>&#xA;&#xA;<p>(<code>j &lt;&lt;= 1</code> means <code>j = (j &lt;&lt; 1)</code>, where <code>&lt;&lt;</code> is the bitwise...
time complexity imperative programming binary arithmetic
0
4,683
Simple Task-Assignment Problem
<p>I have this simple 'assignment' problem:</p>&#xA;&#xA;<p>We have a set of agents $A = \{a_1, a_2, \dotso, a_n\}$ and set of tasks $T= \{t_1, t_2, \dotso, t_m\}$. Note that $m$ is not necessarily equal to $n$. Unlike the general assignment formulation in Wikipedia, a task $t_c$ can only be assigned to an agent based ...
algorithms graphs proof techniques assignment problem
1
4,692
Phrase generators for use with testing grammars that don't use a seed
<p>In helping someone understand phrase generators for use with testing grammars, think compiler test cases, I noted that I have never found a phrase generator that is knowledgeable of the grammar, and is deterministic. The phrase generators I am talking about rely on the grammar of the language as input so that the us...
reference request formal grammars context free parsing software testing
1
4,700
Upper-bounding the number of comparisons for Sorting to $\Theta(n)$ using a physically big number like Number of Particles in the Universe
<p>I recently read an article <a href="http://www.scottaaronson.com/writings/bignumbers.html" rel="noreferrer">Scott Aaronson - Big Numbers</a> . That has made me think about the effective upper-bound for sorting.</p>&#xA;&#xA;<p>According to the article, some of the big numbers like the number of particles in the univ...
algorithm analysis sorting
1
4,705
Euler cycles in biconnected components
<p>If a graph has a Euler cycle, do the biconnected components have Euler cycles as well?</p>&#xA;
graphs eulerian paths
1
4,707
Can two neighbors in a graph be at the same depth in a DFS tree?
<p>In an undirected graph, can two nodes at an identical distance n from the root of a <a href="http://en.wikipedia.org/wiki/Depth-first_search">DFS</a> tree be neighbors in the original graph? I'm thinking no, but I'm not sure (because of back edges)</p>&#xA;
graphs graph traversal
1