id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
4,711
Unique path in a directed graph
<p>I'm designing an algorithm for a class that will determine if a directed graph is unique with respect to a vertex $v$ such that for any $u \ne v$ there is at most one path from $v$ to $u$. I've started by using BFS (breadth-first search) to find the shortest path from v to another vertex u, and then running BFS agai...
graphs shortest path graph traversal
1
4,716
Understanding LEADING and TRAILING operations of an operator precedence grammar
<p>I want to understand what the <code>LEADING</code> and <code>TRAILING</code> of non-terminal in an operator precedence grammar physically mean.</p>&#xA;&#xA;<p>I am confused by the various definitions I have read on them. <br>&#xA;I understand that the <code>LEADING</code> of a non-terminal is the first terminal whi...
terminology formal grammars parsing
1
4,717
Is an oracle ever useful if you can't control the input instances?
<p>Let's say $F$ is an oracle for a problem in $\mathbb{NP}$, but I cannot call this oracle with any input instance. Instead, whenever I call $F$ I get returned a random instance and solution. Thus, I know that $F$ is in fact capable of solving arbitrary $\mathbb{NP}$-hard problems, I just can't specify which one I ...
complexity theory np complete
1
4,719
How to prove that the pre-order tree traversal algorithm terminates?
<p>I see <strong>structural induction</strong> the usual way for proving an algorithm's <strong>termination</strong> property, but it's not that easy to prove by means of induction on a <strong>tree</strong> algorithm. Now I am struggling on proving that the pre-order tree traversal algorithm is terminable:</p>&#xA;&#x...
algorithms data structures algorithm analysis correctness proof induction
1
4,720
Decomposition of a relation to 3NF
<p>Given a relation $R(A, B, C, D, E, F)$, with the following functional dependencies:&#xA;$\{A \rightarrow BC, CD \rightarrow E, B \rightarrow D, E \rightarrow A\}$.</p>&#xA;&#xA;<p>The objective is to decompose $R$ into 3NF relations.</p>&#xA;&#xA;<p>So far, I have determined that the following candidate keys are pre...
database theory
0
4,721
IDS algorithm optimality for grid?
<p>My homework is implementing algorithms BFS, DFS, depth-limited and IDS for the map as a 2D grid with 8 directions of movement. &#xA;I read that the IDS algorithm is optimal, but in my case is not optimal paths.</p>&#xA;&#xA;<p>Is the IDS algorithm optimal for graphs (e.g. map as a grid), or does optimality only appl...
graphs graph traversal
0
4,723
Best-Case Running Time For Binary Search Tree Insertion
<p>The notion of best-case running time is kind of ambiguous for me. According to wikipedia, the definition of best case running time is:</p>&#xA;&#xA;<blockquote>&#xA; <p>The term best-case performance is used in computer science to describe the way of an algorithm behaves under optimal conditions. For example, the b...
terminology data structures runtime analysis binary trees
1
4,724
How to reduce MaxUNSAT to MaxSAT in a (almost) direct way?
<p>In question <a href="https://cs.stackexchange.com/questions/4625/how-to-reduce-maxunsat-to-maxsat">How to reduce MaxUNSAT to MaxSAT?</a> I was asking, how to reduce the MaxUNSAT problem to MaxSAT. With help of the given answer I could give a polynomial reduction : $MaxUNSAT \leq decisionProblemMaxUNSAT \leq SAT \leq...
complexity theory optimization reductions satisfiability
0
4,727
definition of formula validity
<p>I read in some sources that valid formulas are tautologies (valid under every evaluation). In the others, I read that these are formulas that have conclusions true when premises are true. Are these just equivalent definitions because ⊨ P → Q is equivalent to P ⊨ Q?</p>&#xA;
terminology logic logical validity
1
4,729
How many possible assignments does a CNF sentence have?
<p>I'm having some trouble understanding the following:</p>&#xA;&#xA;<p>When we look at satisfiability problems in conjunctive normal form, an underconstrained problem is one with relatively few clauses constraining the variables. For eg. here is a randomly generated 3-CNF sentence with five symbols and five clauses. (...
logic combinatorics satisfiability
1
4,734
Turing complete and computational power
<p>In a lecture a professor mentioned that modern computers don't have as much computational power as a Turing machine because they don't have infinite memory, and since no computer can have infinite memory the Turing machine is therefore unattainable and simply represents the upper limit of computing. Is there a measu...
computability
1
4,742
Collisions of prefixes of MD5 hashes in some fixed interval
<p>I was wondering, if there is an MD5 hash collision in the UNSIGNED MEDIUMINT Range (0 - 16777215). Sadly, I'm unable to run a script to check this myself, due to Memory (RAM) limitations. The answer is probably no; the next step would be - how many characters are even needed, until the first collision is found? </p>...
cryptography hash
0
4,746
How to prove that BFS directed-graph traversal algorithm terminates?
<p>How to prove that BFS directed-graph traversal algorithm terminates?&#xA;(I copy the pseudocode from <a href="http://en.wikipedia.org/wiki/Breadth-first_search" rel="nofollow">here</a>) Input: A graph G and a root v of G.</p>&#xA;&#xA;<pre><code> procedure BFS(G,v):&#xA; create a queue Q&#xA; enqueue v on...
algorithms algorithm analysis correctness proof
1
4,750
Machine Learning - Support Vector Machines
<p>I'm looking for good resources regarding <strong>Support Vector Machines</strong>, or suggestions where to start learning SVM.</p>&#xA;&#xA;<p>Already used references: </p>&#xA;&#xA;<ul>&#xA;<li><p><a href="http://dde.binghamton.edu/kodovsky/svm/index.php?content=Material" rel="nofollow">Stanford ML course by Andrew...
reference request machine learning data mining
0
4,752
Prove that the complement of $\{0^n1^n \mid n \geq{} 0\}$ is not regular using closure properties
<p>I want to prove that the complement of $\{0^n1^n \mid n \geq{} 0\}$ is not regular using closure properties.</p>&#xA;&#xA;<p>I understand pumping lemma can be used to prove that $\{0^n1^n \mid n \geq{} 0\}$ is not a regular language. I also understand regular languages are closed under complement operation. However,...
formal languages regular languages closure properties
0
4,754
Rigorous proof against pseudorandom generator
<p>I am trying to teach myself the principles of cryptograhpy, and want to solve the following question:</p>&#xA;<blockquote>&#xA;<p>Let G be the algorithm that takes an input x = (x1, . . . , xn) from&#xA;{0, 1} n (so each xi ∈ {0, 1}) and outputs the string G(x1, . . . ,&#xA;xn) = (x1, . . . , xn, x1 ⊕ x2) in {0, 1} ...
correctness proof pseudo random generators
1
4,758
Chromatic polynomial of a square
<p>Consider a square, ABCD. Intuitively it seemed to me that its chromatic polynomial is $\lambda(\lambda - 1)(\lambda - 1)(\lambda - 2)$ where there are $\lambda$ colours available..</p>&#xA;&#xA;<p>That is there are $\lambda$ ways in which a colour for A can be picked, there are $\lambda - 1$ ways for colours for B a...
graphs colorings
1
4,760
What's the highest 'order' data structure
<p>Not sure exactly how to define this but here's the basis of the question (very loosely)</p>&#xA;&#xA;<ul>&#xA;<li>All lists can be contained in tree's</li>&#xA;<li>all trees can be contained in a graph</li>&#xA;<li>all graphs can be contained in a multi graph, </li>&#xA;<li>and all multigraphs can be contained in a ...
data structures
0
4,761
Difference between regular expressions: $(0^*1^*)^*$ and $(0+1)^*$
<p>Can anyone tell me what is the difference between the following regular expressions: $(0^*1^*)^*$ and $(0+1)^*$ ? To me they look like generating the same string.</p>&#xA;
formal languages regular languages regular expressions
1
4,768
References on collective intelligence with respect to CS applications
<p>In recent years the field of "collective intelligence" sometimes known as <a href="http://en.wikipedia.org/wiki/Web_2.0" rel="nofollow">Web 2.0</a> has had a big impact on computer science, software engineering, and software development. Stackexchange software itself is a large scale evolving application or implemen...
reference request education software engineering books
1
4,771
How to find the vertices on simple path between two given vertices in a directed graph
<p>Given a directed graph and two distinct vertices S and T, is there a polynomial-time algorithm which finds every vertex which is on at least one simple path from S to T?</p>&#xA;&#xA;<p>It is not difficult to find all vertices that are both successors of S and predecessors of T but this is only a superset of the set...
algorithms graphs
0
4,777
On "The Average Height of Planted Plane Trees" by Knuth, de Bruijn and Rice (1972)
<p>I am trying to derive the <a href="http://alexandria.tue.nl/repository/freearticles/597601.pdf">classic paper</a> in the title only by elementary means (no generating functions, no complex analysis, no Fourier analysis) although with much less precision. In short, I "only" want to prove that the average height $h_n$...
combinatorics discrete mathematics trees average case random walks
1
4,779
How is the rule 110 Turing complete?
<p>I've read the wikipedia page for <a href="http://en.wikipedia.org/wiki/Rule_110">rule 110</a> in cellular automata, and I more or less know how they work (a set of rules decides where to draw the next 1 or 0).</p>&#xA;&#xA;<p>I've just read they're Turing complete, but I can't even fathom how would you 'program' in...
computability automata turing completeness cellular automata
1
4,784
Reconstructing a data table from cross-tabulation frequencies
<p>Say there is a data table $D$ that we cannot see, with $M$ columns. We are given exact <a href="https://en.wikipedia.org/wiki/Cross_tabulation" rel="nofollow">cross-tabulation</a> frequencies for all ${M \choose 2}$ pairs of columns, that is how often each combination of two values occurs.</p>&#xA;&#xA;<p>From the c...
algorithms complexity theory combinatorics statistics
1
4,787
Chromatic polynomial of a cycle - Interpreting its terms
<p>I am learning about graph coloring. One of the exercise problems(grimaldi) led me to derive the chromatic polynomial for any cycle($C_n, n \ge 3$).</p>&#xA;&#xA;<p>$P(C_n, \lambda) = (\lambda - 1)^n + (-1)^n(\lambda - 1)$, where $\lambda$ is the number of colours available</p>&#xA;&#xA;<p>Is it possible to interpret...
graphs
0
4,789
Fastest square root method with exact integer result?
<p>I am dealing with the problem of computing $ s = \lfloor sqrt(x)\rfloor$ with $x \in [0,30000^2]$. The common <code>sqrtf(x)</code> on C language is too slow for this case, however it always gives me the correct result. I've tried with the Newton's method but I get very small errors when the square root of a number ...
algorithms integers discrete mathematics
1
4,790
Hiring one person out of n -- rank and probablity
<p>I am studying algorithms from CLRS book. I try to understand the difference between </p>&#xA;&#xA;<ul>&#xA;<li>probability of hiring the $i$th person out of $n$ and</li>&#xA;<li>probability of hiring the $i$th person out of $n$ persons based on ranks.</li>&#xA;</ul>&#xA;&#xA;<p>Using the normal probability, we know ...
probability theory
1
4,793
Start learning about Theory of Distributed Systems?
<p>What's the best way that anyone can do to have a good introduction to the theory of distributed system, any books or references, and topics should be covered first and requirements to start learning in this topic.</p>&#xA;
reference request education distributed systems
1
4,794
Time complexity of an enumeration of SUBSET SUM instances
<p>An instance of the <strong><a href="http://en.wikipedia.org/wiki/Subset_sum_problem" rel="nofollow">SUBSET SUM</a></strong> problem (given $y$ and $A = \{x_1,...,x_n\}$ is there a non-empty subset of $A$ whose sum is $y$) can be represented on a one-tape Turing Machine with a list of comma separated numbers in binar...
algorithms formal languages turing machines enumeration
1
4,796
Why bound of linear function is same as that of quadratic equation
<p>I am learning algorithms. So, I came along with something very interesting.</p>&#xA;&#xA;<p>The asymptotic bound of linear function $an+b$ is $O(n^2)$ for all $a&gt;0$.</p>&#xA;&#xA;<p>This is same as for $an^2 + bn + c$. But shouldn't it be different?</p>&#xA;
algorithms asymptotics
0
4,797
Fast k mismatch string matching algorithm
<p>I am looking for a fast k-mismatch string matching algorithm. Given a pattern string P of length m, and a text string T of length n, I need a fast (linear time) algorithm to find all positions where P matches a substring of T with at most k mismatches. This is different from the k-differences problem (edit distance)...
algorithms reference request strings string metrics substrings
1
4,800
The order of growth analysis for simple loop
<p>What would the order of growth for this loop be:</p>&#xA;&#xA;<pre><code>int sum = 0;&#xA;for (int n = N; n &gt; 0; n /= 2)&#xA; for(int i = 0; i &lt; n; i++)&#xA; sum++;&#xA;</code></pre>&#xA;&#xA;<p>The first loop seems to run for $\log N + 1$ times and the second loop runs $n$ times.</p>&#xA;&#xA;<p>So ...
algorithm analysis asymptotics
0
4,801
How to calculate the number of states in designing a Turing machine?
<p>I would like to ask how to determine the number of states when designing a Turing machine from the description for a language? For example:</p>&#xA;&#xA;<p>$\qquad \displaystyle L = \{wcw \mid w \in \{0,1\}^*\}.$</p>&#xA;&#xA;<p>I mean how to know how many states are there in the set $Q$, with the information from t...
formal languages turing machines descriptive complexity
0
4,805
Sorting as a linear program
<p>A surprising number of problems have fairly natural reductions to linear programming (LP). See <a href="http://www.cs.berkeley.edu/~vazirani/algorithms/chap7.pdf" rel="noreferrer">Chapter 7</a> of [1] for examples such as network flows, bipartite matching, zero-sum games, shortest paths, a form of linear regression,...
algorithms reductions sorting linear programming
1
4,806
Using Funk SVD with SGD?
<p>I work on a recommender system framework which is implemented with a variant on Funk SVD (See his explanation of his algorithm <a href="http://sifter.org/~simon/journal/20061211.html" rel="nofollow" title="here">here</a>). </p>&#xA;&#xA;<p>However the framework that we are trying to integrate doesn't support Funk SV...
algorithms machine learning matrices
1
4,812
What is the difference between a module in a monolithic kernel and a server in a microkernel?
<p>I´m not exactly sure what kind of impact these two things have on kernel design. Are servers more flexible because of running in user space, for instance, and does adding a module require a new build of a kernel?</p>&#xA;
operating systems os kernel
1
4,818
Definition of $\Theta$ for negative functions
<p>I'm working out of the 3rd edition CLRS Algorithms textbook and in Chapter 3 a discussion begins about asymptotic notation which starts with $\Theta$ notation. I understood the beginning definition of:</p>&#xA;&#xA;<p>$$\Theta(g(n)) = \{ f(n)\,|\, \exists\, c_1, c_2 &gt; 0, n_0 \in \mathbb{N}: 0 \leq c_1 g(n) \leq f...
terminology asymptotics
1
4,821
A text for virtual environments seminar
<p>What is a good textbook for a seminar about </p>&#xA;&#xA;<ul>&#xA;<li>virtual environments, virtual worlds, augmented reality and&#xA;similar topics?</li>&#xA;</ul>&#xA;&#xA;<p>The seminar is at the graduate studies level and is supposed to give introduction to virtual environments, technologies and applications...
reference request books graphics computer games hci
0
4,826
Planarity conditions for Planar 1-in-3 SAT
<p><strong>Planar 3SAT</strong> is NP-complete. A planar 3SAT instance is a 3SAT instance for which the graph built using the following rules is planar:</p>&#xA;&#xA;<ol>&#xA;<li>add a vertex for every $x_i$ and $\bar{x_i}$</li>&#xA;<li>add a vertex for every clause $C_j$</li>&#xA;<li>add an edge for every $(x_i,\bar{x...
np complete reductions satisfiability 3 sat
1
4,835
Hardness and directions of reductions
<p>Let us say we know that problem A is hard, then we reduce A to the unknown problem B to prove B is also hard.</p>&#xA;&#xA;<p>As an example: we know 3-coloring is hard. Then we reduce 3-coloring to 4-coloring. By conflating one of the colors in the 3-coloring you have a 4-coloring, ergo 4-coloring is hard.</p>&#xA;&...
complexity theory np complete reductions
1
4,837
Is $(a^nb^m)^r$ regular?
<p>I took my theory of computation exams a few weeks ago, and this was one of the questions:</p>&#xA;<blockquote>&#xA;<p>Assume language <span class="math-container">$L=\{(a^nb^m)^r \mid n,m,r\ge 0\}$</span></p>&#xA;<p>Is L regular? If yes provide a regular expression or an automaton for it.</p>&#xA;</blockquote>&#xA;<...
formal languages regular languages regular expressions
1
4,839
Which languages do Perl-compatible regular expressions recognize?
<p>As the title says, I spent a couple of hours last weekend trying to wrap up my mind about the class of languages matched by Perl-compatible regular expressions, <em>excluding any matching operator that allows to execute arbitrary code inside the pattern</em>.</p>&#xA;&#xA;<p>If you don't know what PCREs are, please ...
formal languages regular expressions
0
4,840
Proving $\Omega(cf) = \Omega(f)$
<p>I'm trying to prove the following lemma:</p>&#xA;&#xA;<p>$c$ is a positive real number and $f, g$ are functions from natural numbers to non-negative real numbers. I'm trying to prove rigorously that:</p>&#xA;&#xA;<p>$\Omega(cf(n))$ = $\Omega(f(n))$.</p>&#xA;&#xA;<p>I know that it is obvious but I'm trying to constru...
asymptotics proof techniques check my proof
0
4,843
Problems for which algorithms based on partition refinement run faster than in loglinear time
<p><a href="http://en.wikipedia.org/wiki/Partition_refinement">Partition refinement</a> is a technique in which you start with a finite set of objects and progressively split the set. Some problems, like DFA minimization, can be solved using partition refinement quite efficiently. I don't know of any other problems tha...
algorithms reference request data structures partitions sets
0
4,845
How do you prove that two languages are equivalent?
<p>How can you show that the Language accepted by an NFA and the reverse NFA is the same?</p>&#xA;&#xA;<p>For a language $L$, there is an $L^R=\{ w^R \mid w \in L\}$</p>&#xA;&#xA;<p>Let's say that $w^R$ is the string obtained by reversing the string $w$.</p>&#xA;&#xA;<p>I know that it involves using induction on the le...
formal languages regular languages finite automata
0
4,848
If I have sources and sinks of a DAG can I find the minimum number of edges to be added to make it Strongly Connected?
<p>I am trying to create an algorithm in linear time where if given a directed acyclic graph I can add edges to make it strongly connected components.</p>&#xA;&#xA;<p>I believe I have an algorithm to identify sources and sinks in the input list of edges in form</p>&#xA;&#xA;<pre><code>1 2&#xA;2 5&#xA;3 1 &#xA;etc&#xA;<...
algorithms graphs
0
4,850
Understanding the definition of reduction
<p>From <a href="http://en.wikipedia.org/wiki/Reduction_%28complexity%29" rel="nofollow">Wikipedia</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given two subsets A and B of N and a set of functions F from N to N&#xA; which is closed under composition, A is called reducible to B under F&#xA; if $$&#xA; \exists f \in F ...
complexity theory terminology reductions
1
4,852
What is an example for which the purely functional programming approach gives better results than imperative style?
<p><em>I</em> have seen some questions related to functional programming on stackexchange sites which suggests it has significant popularity. <em>I</em> have some experience with it from many <em>years</em> ago in Lisp/Scheme and have seen commentary on the difference between functional and imperative/mutable approache...
programming languages functional programming
0
4,854
Why is there the regularity condition in the master theorem?
<p>I have been reading <a href="http://en.wikipedia.org/wiki/Introduction_to_Algorithms" rel="noreferrer"><em>Introduction to Algorithms</em> by Cormen et al.</a> and I'm reading <a href="http://books.google.co.uk/books?id=NLngYyWFl_YC&amp;pg=PA73" rel="noreferrer">the statement of the Master theorem starting on page 7...
algorithms asymptotics mathematical analysis landau notation master theorem
0
4,856
Algorithm to solve Turing's "Halting problem‍​"
<blockquote>&#xA; <p>"Alan Turing proved in 1936 that a general algorithm to solve the&#xA; halting problem for <em>all</em> possible program-input pairs cannot exist"</p>&#xA;</blockquote>&#xA;&#xA;<p>Can I find a general algorithm to solve the halting problem for <em>some</em> possible program input pairs? </p>&#xA...
computability formal methods halting problem software verification
0
4,862
Left-Factoring a grammar into LL(1)
<p>I have a homework assignment where I need to convert a grammar into LL(1). I've already removed the left recursion, but I'm having trouble doing left-factoring. All of the examples I've found are simple, and look something like this:</p>&#xA;&#xA;<p><code>A -&gt; aX | aY</code><br>&#xA;becomes:<br>&#xA;<code>A -&gt;...
formal languages formal grammars parsers left recursion
1
4,865
Recursive complexity with change of variable
<p>I face a problem with computing a complexity. &#xA;I have this equality : $P(u) = (\sqrt{u}+1)P(\sqrt{u}) + \theta(\sqrt{u})$</p>&#xA;&#xA;<p>And I want to prove that $P(u) = O(u)$</p>&#xA;&#xA;<p>This is how I process :</p>&#xA;&#xA;<p>I put $m = \lg\lg u \implies P(u) = P(2^{2^{m}}) = (2^{2^{m-1}}+1)P(2^{2^{m-1}})...
asymptotics recurrence relation
1
4,867
What helpful solution does the Halting Problem give to computing?
<p>What problem does the halting problem solve in computing, whether theoretical or practical?</p>&#xA;&#xA;<p>It is very easy to debug code which loops forever, just signal the debugger to break if the program is running for too long? What purpose / good is the halting problem? Why was Turing praised for it?</p>&#xA;
computability terminology halting problem
1
4,872
An Alternative Hanoi Tower problem
<p>We got tower $T_1$ with $n$ odd disks (1,3,5,...) and tower $T_2$ with $n$ even disks (2,4,6,...).&#xA;Now we want to move all $2n$ disks to tower $T_3$.&#xA;If $T(p,q)$ is a recurrence relation of minimum number of moves we make to move $p$ disks from $T_1$ and $q$ disks from $T_2$ to $T_3$, we must find $T(n,n)$.<...
algorithms recurrence relation board games towers of hanoi
0
4,874
Why are decision problems commonly used in complexity theory?
<p>From <a href="http://en.wikipedia.org/wiki/Computational_complexity_theory#Complexity_classes">Wikipedia</a>:</p>&#xA;&#xA;<blockquote>&#xA; <p>The type of computational problem: <strong>The most commonly used problems are&#xA; decision problems</strong>. However, complexity classes can be defined based on&#xA; f...
complexity theory terminology
1
4,880
Relation between problems and algorithms
<p>From <a href="http://en.wikipedia.org/wiki/Computational_complexity_theory" rel="nofollow">Wikipedia</a></p>&#xA;&#xA;<blockquote>&#xA; <p><strong>a computational problem</strong> is understood to be a task that is in principle amenable to being solved by a computer (i.e. the problem can&#xA; be stated by a set of...
algorithms complexity theory terminology
1
4,883
The path between any two nodes in cyclic directed graph
<p>G{V, E} is directed, <strong>cyclic</strong>, weighted graph. What is the algorithm of finding all paths between any given two nodes?<br>&#xA;Can you suggest any good reading?</p>&#xA;
algorithms graphs
0
4,884
Meaning of complexity of a computational problem
<p>If I understand correctly, the complexity of solving a computational problem is defined in terms of which instance $I$ of the problem, what size $n$ of the problem instance, and what algorithm $A$ for solving the problem instance.</p>&#xA;&#xA;<p>Is the complexity of the problem at a given size $n$ of the problem in...
complexity theory terminology
1
4,887
Dijkstra to favor solution with smallest number of edges if several paths have same weight
<p>You can modify any graph $G$ so that Dijkstra's finds the solution with the minimal number of edges thusly:</p>&#xA;&#xA;<p>Multiply every edge weight with a number $a$, then add $1$ to the weight to penalize each additional edge in the solution, i.e. </p>&#xA;&#xA;<p>$w'(u,v)=a*w(u,v)+1$</p>&#xA;&#xA;<p>This does n...
algorithms graphs shortest path
1
4,888
Is there any way to distinguish between LL(k) and LR(k) grammar?
<p>I am recently studying about Compilers designing. I came to know about two types of grammar one is LL grammar and other is LR grammar.</p>&#xA;&#xA;<p>We also know the facts that every LL grammar is LR that is LL grammar is a proper subset of LR grammar. First one is used in top-down parsing and the second one is us...
formal grammars compilers parsers lr k ll k
1
4,896
"Essential" problem for MA
<p>I am trying to understand different interactive proof systems, in particular <a href="https://complexityzoo.uwaterloo.ca/Complexity_Zoo:A#am" rel="nofollow">AM</a> and <a href="https://complexityzoo.uwaterloo.ca/Complexity_Zoo:M#ma" rel="nofollow">MA</a>.</p>&#xA;&#xA;<p>Is there a typical problem for the complexity...
complexity theory interactive proof systems
0
4,898
Separate all leaves of a weighted tree with minimum weight cuts
<p>This is part of a larger problem, which I believe I have reduced to this. Given a tree $T$ having positive edge weights, and $k$ leaves (nodes which have exactly one connected node), I need to delete some edges in the tree so that no two leaves in the original tree are connected (by a path) in the newly formed fores...
algorithms graphs trees
1
4,899
Expected gain of a game of chance with differently-priced tokens
<p>Foo and Bar are playing a game of strategy. At the start of the game, there are $N$ apples, placed in a row (in straight line). The apples are numbered from $1$ to $N$. Each apple has a particular price value.</p>&#xA;&#xA;<p>The price of $i$th apple is $p_i$.</p>&#xA;&#xA;<p>In this game, the players Foo and bar ma...
algorithms game theory
1
4,905
How do I write a proof using induction on the length of the input string?
<p>In my Computing Theory course, a lot of our problems involve using induction on the length of the input string to prove statements about finite automata. I understand mathematical induction, however when strings come into play I get real tripped up. I'd really appreciate it if someone would go through the process ...
automata finite automata proof techniques reference question induction
1
4,906
Numeral systems other than unary used in nature or in animal and human behaviours
<p>Representing numeric values using <a href="http://en.wikipedia.org/wiki/Positional_notation">positional notation</a> is one of the milestones in the history of arithmetic. Babylons used a base 60 system, Maya a base 20 system; base 10 system became "the standard" used by modern civilizations; digital computers use t...
integers notation numeral representations
0
4,913
Nested Big O-notation
<p>Let's say I have a graph $|G|$ with $|E|=O(V^2)$ edges. I want to run BFS on $G$ which has a running time of $O(V+E)$.</p>&#xA;&#xA;<p>It feels natural to write that the running time on this graph would be $O(O(V^2)+V)$ and then simplify to $O(V^2)$.</p>&#xA;&#xA;<p>Are there any pitfalls to using such a "remove-the...
terminology asymptotics landau notation
1
4,914
Why can't DFS be used to find shortest paths in unweighted graphs?
<p>I understand that using DFS "as is" will not find a shortest path in an unweighted graph. </p>&#xA;&#xA;<p>But why is tweaking DFS to allow it to find shortest paths in unweighted graphs such a hopeless prospect? All texts on the subject simply state that it cannot be done. I'm unconvinced (without having tried it m...
algorithms graphs shortest path
1
4,915
Complexity of optimized bubblesort
<p>What is the runtime complexity of the following implementation of Bubblesort (for integers)?</p>&#xA;&#xA;<pre><code> #define SWAP(a,b) { int t; t=a; a=b; b=t; }&#xA;&#xA; void bubble( int a[], int n )&#xA; /* Pre-condition: a contains n items to be sorted */&#xA; {&#xA; int i, j;&#xA; /* Ma...
algorithms algorithm analysis runtime analysis sorting
0
4,918
How to make a parse tree for the following propositional logic formula?
<p>I have a formula $ \neg((q \implies \neg q) \vee p \vee (\neg q \implies (r \wedge p))) $.</p>&#xA;&#xA;<p>As it contains 3 subformulas between the $\vee$'s, how can i put it into a parse tree, as a parse tree contains 2 branches from each node.</p>&#xA;
formal languages logic binary trees parsing
1
4,923
Meaning of the adjacency matrix product
<p>Let $A$ be an adjacency matrix of a directed graph. What's the meaning of the $(i,j)-$entry of the matrix $((A^T)^{7} \cdot (A^{7}))$ ? </p>&#xA;&#xA;<p>My initial interpretation is that $(i,j)$ of this matrix is zero whenever nodes $i$ and $j$ have no 7-length in-coming paths from a common source. Is that right? An...
algorithms graphs
0
4,924
Closure of Deterministic context-free languages under prefix
<p>For a formal language $L \subseteq \Sigma^{*}$ I define the set Pref(L) to be:</p>&#xA;&#xA;<p>$\text{pref}(L) = \{\alpha \in \Sigma^{*} : \exists \beta \in \Sigma^{*} \text{ such that } \alpha \beta \in L\}$</p>&#xA;&#xA;<p>ie. the set of all (not necessarily proper) prefixes of words in $L$. I know that if $L$ is ...
formal languages context free closure properties
1
4,935
Shannon's entropy for an image
<p>Shannon's entropy [plog(1/p)] for an image is a probabilistic method for comparing two pixels or a group of pixels.Suppose an image with a matrix of 3x3 has pixel intensity values</p>&#xA;&#xA;<pre><code>1 1 2&#xA;2 3 3&#xA;4 4 5&#xA;</code></pre>&#xA;&#xA;<p>and another image with 3x3 matrix has group of pixels ha...
pattern recognition image processing entropy computer vision
0
4,941
Dynamic programming with large number of subproblems
<p>Dynamic programming with large number of subproblems. So I'm trying to solve this problem from Interview Street:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Grid Walking</strong> (Score 50 points)<br>&#xA; You are situated in an $N$-dimensional grid at position $(x_1,x_2,\dots,x_N)$. The dimensions of the grid are $...
algorithms efficiency dynamic programming
1
4,942
Finding paths with smallest maximum edge weight
<p>I need to find the easiest cost path between two vertices of a graph. Easiest here means the path with the smallest maximum-weigth edge. </p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/WWszV.png" alt="enter image description here"></p>&#xA;&#xA;<p>In the above graph, the easiest path from 1 to 2 is: </p>&#xA;&#...
algorithms graphs shortest path
1
4,945
Problems showing the constraint of master theorem case three holds
<p>Prove or disprove the following statements:</p>&#xA;&#xA;<ol>&#xA;<li><p>$T\left( n \right) = 2T\left( {\frac{n}{2}} \right) + f\left( n \right),f\left( n \right) = \theta \left( {{n^2}} \right) $ then $ {\rm{ }}T\left( n \right) = \theta \left( {f\left( n \right)} \right) $ for all $ {\rm{ n = }}{{\rm{2}}^k}$</p></...
asymptotics recurrence relation master theorem
0
4,947
Flow of control? or Control of flow?
<p>In most PL textbooks (even in language specifications) statments like <strong>if, while, for, break</strong> are categorized as <em>flow of control</em> statements. <br/>&#xA;However, it is not consistent; i.e. sometimes the same text uses <em>control-flow statement</em> (note the dash), or <em>control flow statment...
terminology programming languages
0
4,960
Clarifications on polynomial reducibility for problems in P and NP-complete
<p><strong>Can I always increase the complexity of a problem via polynomial reduction?</strong> (in which case '<em>reduction</em>' is really a misnomer) For example, if I have a classic P problem (say, finding the smallest element in an array, by iterating through and making comparisons with the smallest value found t...
complexity theory time complexity
1
4,962
Describing Strings
<p>Im trying to figure out how to describe fifty-six strings to test if a three state FA over the alphabet $\{a,b\}$ has a finite language.</p>&#xA;&#xA;<p>The number fifty-six comes from a theorem that states if a machine has $N$ states and an alphabet has $m$ letters, then in total there are $m^N + m^{N + 1} + m^{N +...
automata finite automata
0
4,968
Are $\log_{10}(x)$ and $\log_2(x)$ in the same big-O class of functions?
<p>Are $\log_{10}(x)$ and $\log_{2}(x)$ in the same big-O class of functions? In other words, can one say that $\log_{10}(x)=O(\log x)$ and $\log_{2}(x)=O(\log x)$?</p>&#xA;
landau notation
1
4,970
Algorithm to find the probability of a given text to be about a large topic
<p>I want the conditional probability for each topic (being the word that we give as input). For example, the text being</p>&#xA;&#xA;<blockquote>&#xA; <p>have seen and reviewed your requirements you posted here. If you can&#xA; give me the fix criteria/category of your data mining then I can do&#xA; this job. If y...
machine learning natural language processing
0
4,972
What's the difference between a rule based system and an artificial neural network?
<p>I'm currently doing some reading into AI and up to this point couldn't find a satisfying answer to this question: what's the difference between a rule based system and an artificial neural network?</p>&#xA;&#xA;<p>From my understanding both are trying to do inference based on a variety of different inputs.</p>&#xA;
artificial intelligence neural networks
1
4,973
Does a weighted Breadth First search have "memory" when moving to the next vertex?
<p>I'm in a programming course and one Problem given to us is to mark the order in which BFS visits nodes in a weighted graph.</p>&#xA;&#xA;<p>My question is whether BFS adds the distance of the previous path while adding a new vertex, as that will definitely change the order in which the vertices are added?</p>&#xA;
graphs
0
4,984
Prove that the language of non-prime numbers written in unary is not regular
<p>Im trying to prove that the following language is not regular.&#xA;$$\text{Notprime} = \{a^n \text{where \(n\) isn't prime}\}&#xA; = \{\epsilon, a, aaaa, aaaaaa, aaaaaaaa, \ldots\}$$</p>&#xA;&#xA;<p>Heres what I have:</p>&#xA;&#xA;<p>"If Notprime were regular, then its complement would be regular also. However, the...
regular languages finite automata
1
4,985
Longest Increasing Subsequence
<p>I got no responses on stackoverflow, so I'm asking here:</p>&#xA;&#xA;<p>How useful is the LIS (<a href="http://www.geeksforgeeks.org/archives/9591" rel="nofollow noreferrer">Longest Increasing Subsequence</a>) problem in tackling other CS problems? There are a few algorithms, using patience sorting, dynamic progra...
algorithms arrays subsequences
0
4,987
Program that generates a regular expression from an FA
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/2016/how-to-convert-finite-automata-to-regular-expressions">How to convert finite automata to regular expressions?</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>Im curious if anyone knows if its poss...
automata finite automata regular expressions
0
4,989
Why does it take $O(f(n)^2)$ to simulate a 3-tape $O(f(n))$-time TM on a 1-tape TM?
<p>This looks like a fundamental result but I can't find a resource online that gives an intuitive interpretation of this complexity. Any basic explanation is appreciated.</p>&#xA;
turing machines tape complexity
1
4,990
Lambda Calculus simplification
<p>Below is the lambda expression which I am finding difficult to reduce i.e. I am not able to understand how to go about this problem.</p>&#xA;&#xA;<p>$$(\lambda mn.(\lambda sz.ms(nsz)))(\lambda sz.sz)(\lambda sz.sz)$$</p>&#xA;&#xA;<p>I am lost with this.</p>&#xA;&#xA;<p>if anyone could lead me in the right direction ...
logic lambda calculus
0
4,992
Which properties of context sensitive languages are decidable?
<p>There are two context-sensitive languages, $L_1$ and $L_2$. Which of the following statements about them are decidable respectively undecidable?</p>&#xA;&#xA;<ol>&#xA;<li>$L_1 = \emptyset$</li>&#xA;<li>$L_1 = \Sigma^*$</li>&#xA;<li>$L_1 \cap L_2 = \emptyset$</li>&#xA;<li>$\overline{L_1}$ is also a context-sensitive ...
formal languages undecidability context sensitive
1
4,993
How to go about working the average case run time of this trivial algorithm (and other algorithms)?
<p>This is a similar algorithm to one I used in a previous question, but I'm trying to illustrate a different problem here.</p>&#xA;&#xA;<pre><code>for (int i = 0; i &lt; numbers.length - 1; i++) {&#xA; for (int j = i + 1; j &lt; numbers.length; j++) {&#xA; if (numbers[i] + numbers[j] == 10) {&#xA; ...
algorithms algorithm analysis runtime analysis average case
0
4,994
Dynamic programming table for finding similar substrings is too large
<blockquote>&#xA; <p><strong>Substring Diff</strong><br>&#xA; Given two strings of length $n$, $P = p_1\dots p_n$ and $Q = q_1 \dots q_n$, we define $M(i, j, L)$ as the number of&#xA; mismatches between $p_i \dots p_{i+L-1}$ and $q_j \dots q_{j+L-1}$. In set&#xA; notation, $M(i, j, L)$ refers to the size of the set...
strings dynamic programming substrings
1
4,998
Is there a O(log n) algorithm for matrix exponentiation?
<p>Is there an algorithm to raise a matrix to the <span class="math-container">$n$</span>th power in <span class="math-container">$O(\log n)$</span> time? </p>&#xA;&#xA;<p>I have been searching online, but have been unsuccessful thus far.</p>&#xA;
algorithms time complexity matrices
1
5,006
What's an intuitive distinction between semi-computable problems and noncomputable problems/functions?
<p>The definitions I've found were highly technical and using terms I've never seen before. </p>&#xA;&#xA;<p>Say, I have a certain irrational number <em>e</em> that I get get closer and closer to with a computer and I want to determine if there is a particular digit <em>d</em> appearing after a certain position. Or wha...
computability terminology
1
5,008
Differences and relationships between randomized and nondeterministic algorithms?
<p>What differences and relationships are between randomized algorithms and nondeterministic algorithms?</p>&#xA;&#xA;<p>From Wikipedia</p>&#xA;&#xA;<blockquote>&#xA; <p>A <strong>randomized algorithm</strong> is an algorithm which employs a degree of&#xA; randomness as part of its logic. The algorithm typically uses...
algorithms terminology computation models nondeterminism randomness
0
5,009
What is the relationship between NP/NP-Complete/NP-Hard to time complexity?
<p>I'm familiar with a few problems of each class and even though the definitions are based on sets and polynomial reducibility, I see a pattern with time complexity. NP problems appear to be $O(2^n)$ (minus the P problems of course), and NP-hard problems seem to be worse: $n^n$ or $n!$ (Chess, TSP). Is this a misleadi...
complexity theory terminology time complexity np hard
1
5,010
Finding an isomorphism between finite automata
<p>Im having trouble figuring out how to determine if two finite automata are the same apart from renumbered states. </p>&#xA;&#xA;<p>More specifically, heres an example:&#xA;<img src="https://i.stack.imgur.com/EPdpg.jpg" alt="example"> </p>&#xA;&#xA;<p>It's easy to generate a regular expression by hand and see that b...
automata finite automata graph isomorphism
1
5,018
Optimize a linear recurrence
<p>$$\begin{align*}&#xA; T[1] &amp;= 1 \\&#xA; T[2] &amp;= 2 \\&#xA; T[i] &amp;= T[i-1] + T[i-3] + T[i-4] &amp; \text{for \(i \gt 2\)} \\&#xA;\end{align*}$$</p>&#xA;&#xA;<p>I have to calculate $T[N]$, but $N$ is too big ($\approx 10^9$), how can I optimize it?</p>&#xA;
algorithms dynamic programming recursion
0
5,021
Arc-Length parameterization of a cubic bezier curve
<p>I like to implement an arc-length Parameterization of a cubic bezier curve. So far I have implemented the method of calculating the arc length of the curve and now I'm stuck at calculating the times to divide the original curve into equal arc length segments.</p>&#xA;&#xA;<p>What i have:</p>&#xA;&#xA;<ul>&#xA;<li>$m...
algorithms computational geometry numerical analysis
0
5,027
Finding the height of all nodes in a forest
<p>I have a forest, i.e., nodes with directed edges and no cycles (directed or undirected). I define the height of a vertex $v$ as 0 if it does not have any incoming edges, or the maximum number of edges to traverse in reverse to reach a vertex of height 0. &#xA;<img src="https://i.stack.imgur.com/WzfAx.png" alt="enter...
algorithms trees graph traversal
0
5,030
Why is Radix Sort $O(n)$?
<p>In radix sort we first sort by least significant digit then we sort by second least significant digit and so on and end up with sorted list. </p>&#xA;&#xA;<p>Now if we have list of $n$ numbers we need $\log n$ bits to distinguish between those number. So number of radix sort passes we make will be $\log n$. Each pas...
algorithms sorting
0
5,032
Calculate storage requirements for a data set
<p>I have a simple problem. I can't seem to even find the right search terms to get me pointed in the direction I need to be heading.</p>&#xA;&#xA;<p>I'm writing a bunch of integers to disk. Lot's of them.</p>&#xA;&#xA;<p>Starting with the integer 2, I add it to another integer, write the result to disk, and start the ...
integers efficiency storage
0