id
int64
1
141k
title
stringlengths
15
150
body
stringlengths
43
35.6k
tags
stringlengths
1
118
label
int64
0
1
7,419
Proving regularity via equivalence classes
<p>Given two regular languages $L_1$ and $L_2$, we define a new language </p>&#xA;&#xA;<p>$$L=\{w_1w_2\mid \text{ there exist two words } x,y \text{ such that } xw_1\in L_1, w_2y\in L2\}$$</p>&#xA;&#xA;<p>How do I show that $L$ is regular with equivalence classes?</p>&#xA;&#xA;<p>My assignment allows the use of closure...
automata regular languages finite automata proof techniques
0
7,420
Why is the clique problem NP-complete?
<blockquote>&#xA; <p><strong>Possible Duplicate:</strong><br>&#xA; <a href="https://cs.stackexchange.com/questions/6847/is-the-k-clique-problem-np-complete">Is the k-clique problem NP-complete?</a> </p>&#xA;</blockquote>&#xA;&#xA;&#xA;&#xA;<p>I've been lately reading about the <a href="http://en.wikipedia.org/wiki/C...
np complete
1
7,428
B-tree branching factor boundaries
<p>A BTree has a $k$ value that determines that every node has $k$ to $2k$ children. When a node has $2k$ keys it needs to be split into two nodes.</p>&#xA;&#xA;<p>Let's say I want to create a $k/(2k-x)$ tree. (like a 2-3 tree that follows the BTree rules, but isnt $k/2k$)</p>&#xA;&#xA;<p>What is the possible range of ...
data structures search trees
0
7,429
Does this DFA have a solution?
<p>I am trying to create a DFA that can recognize strings with alphabet $\{a,b,c\}$ where $a$ and $c$ appear even number of times and where $b$ appears odd number of times.</p>&#xA;&#xA;<p>I am wondering that this may only be expressed with other methods such as Turing machine or context-free languages.</p>&#xA;&#xA;<p...
formal languages regular languages finite automata
1
7,433
Mean number of edges between two equal partitions
<p>For a random undirected graph with $n$ nodes, where each node has $k$ incident edges ($nk/2$ edges in total), the vertex set is partitioned into two sets each having $n/2$ nodes. </p>&#xA;&#xA;<blockquote>&#xA; <p>What is the order of the number of edges that start in one partition and end in the other? </p>&#xA...
graphs random graphs
1
7,438
Implications of polynomial time reductions
<p>I'm reviewing for finals and have a sample problem that I <strong>think</strong> I understand, but would like someone to bless my understanding or smack me and tell me why I'm wrong.</p>&#xA;&#xA;<p>I'm presented with a problem $\Pi$ of unknown complexity class. If I can transform $\Pi$ to some problem $X$, where ...
complexity theory reductions complexity classes p vs np
1
7,441
Myhill-Nerode and closure properties
<p>It is well known that regular languages are characterized by the Myhill-Nerode equivalence. For language $L$ over $\Sigma^*$ define the equivalence $x\sim_L y$ over $\Sigma^*$ iff for all $z\in\Sigma^*$ we have $xz\in L \iff yz\in L$. Then $L$ is regular iff $\sim_L$ is of finite index, i.e., has a finite number of ...
regular languages closure properties
1
7,442
Are any problems in P known to have logarithmic-time-verifiable certificates?
<p>Problems in NP have certificates which can be verified in polynomial time.</p>&#xA;&#xA;<p>It seems conceivable that there could be problems in P which have certificates which can be verified in logarithmic time. (Such certificates would also have to be logarithmic in size, naturally.)</p>&#xA;&#xA;<p>However, it i...
complexity theory nondeterminism
0
7,443
How does one make an unambiguous context-free grammar for arithmetic expressions?
<p>Say I have a context-free grammar defined by the following rule.</p>&#xA;&#xA;<p>$$&#xA;\langle EXPR\rangle \rightarrow \langle EXPR\rangle + \langle EXPR\rangle~|~\langle EXPR\rangle \times \langle EXPR\rangle~|~(\langle EXPR \rangle)~|~x&#xA;$$</p>&#xA;&#xA;<p>This grammar is ambiguous since, for instance, I can g...
formal grammars context free ambiguity
0
7,444
Coloring a Unicyclic Graph
<p>I am trying to design an efficienct algorithm to color a unicyclic graph. I know if a graph does not contain any cycles (it's a tree) then it is 2-colorable. But cycles are either 2 (is even number of vertices) or 3 (is odd number of vertices) colorable. So if there contains just one cycle then the chromatic number ...
graphs
1
7,445
How to find recurrences where Master formula cannot be applied
<p>Given: $T(n) = T(\sqrt{n}) + 1$ (base case $T(x) = 1$ for $x&lt;=2$) </p>&#xA;&#xA;<p>How do you solve such a recurrence?</p>&#xA;
complexity theory algorithms
1
7,446
Running Time of Modular Exponentiation
<p>I am trying to understand why the modular exponentiation algorithm has a running time of about $\log(n)$ where $n$ is the exponent. Here is the algorithm:</p>&#xA;&#xA;<pre><code>function modular_pow(base, exponent, modulus)&#xA; result := 1&#xA; while exponent &gt; 0&#xA; if (exponent mod 2 == 1):&#xA;...
algorithms
1
7,448
Is this data structure a hypertree or they are just isomorphic trees?
<p>I have a data structure described as following:</p>&#xA;&#xA;<pre><code>- It's a collection of trees.&#xA;- Each tree has the same structure.&#xA;- Each tree has information of diferent nature.&#xA;</code></pre>&#xA;&#xA;<p>A example of this data structure:</p>&#xA;&#xA;<pre><code> 4 - - - - - - - 'a' - - - - - -...
data structures trees
0
7,453
If P = NP, why wouldn't $\emptyset$ and $\Sigma^*$ be NP-complete?
<p>Apparently, if ${\sf P}={\sf NP}$, all languages in ${\sf P}$ except for $\emptyset$ and $\Sigma^*$ would be ${\sf NP}$-complete.</p>&#xA;&#xA;<p>Why these two languages in particular? Can't we reduce any other language in ${\sf P}$ to them by outputting them when accepting or not accepting?</p>&#xA;
complexity theory np complete reductions
0
7,457
Remove minimum number of vertices to disconnect the graph
<p>Consider an undirected graph with a source and a sink vertex. We would like to remove minimum number of vertices in that graph to disconnect any path between source and sink.</p>&#xA;&#xA;<p>Can we do this using say a max-flow, min-cut algorithm?</p>&#xA;
algorithms graphs network flow
0
7,459
Distributed 6-color Vertex Coloring
<p>I am trying to understand the <a href="http://disco.ethz.ch/lectures/podc_allstars/lecture/chapter1.pdf" rel="nofollow">distributed 6-color algorithm for vertex coloring</a> (on page 10).</p>&#xA;&#xA;<p>Here is a short description</p>&#xA;&#xA;<p>Idea of the algorithm: We start with color labels that have $\log n$ ...
algorithms distributed systems colorings
1
7,463
Models of computation: the arithmetic model, Turing machine (and ...)
<ol>&#xA;<li><p>How is an arithmetic model defined? </p>&#xA;&#xA;<p>What relations are between it and Turing machine? Are they equivalent in some sense?</p>&#xA;&#xA;<p>Is it true that </p>&#xA;&#xA;<ul>&#xA;<li><p>in the arithmetic model of computation, the basic arithmetic operations (addition, subtraction, multipli...
complexity theory computation models
0
7,464
Definitions of an algorithm running in polynomial time and in strongly polynomial time
<p><a href="http://en.wikipedia.org/wiki/Time_complexity#Polynomial_time" rel="noreferrer">Wikipedia</a> defines it to be</p>&#xA;<blockquote>&#xA;<p>An algorithm is said to be of <strong>polynomial time</strong> if its running time is upper bounded by a polynomial expression in the size of the input for the algorithm,...
complexity theory
0
7,466
Are Turing-recognizable languages closed under intersection?
<p>Let $A$ and $B$ be Turing-recognizable languages. Must language $C = A \cap B$ be Turing-recognizable too?</p>&#xA;&#xA;<p>I have a hunch that it should be because we can construct an enumerator for $C$ by enumerating all the languages in $A$ and then all the languages in $B$.</p>&#xA;&#xA;<p>However, I also know th...
formal languages
1
7,467
Why does absence of strongly polynomial time algorithm for LP imply restriction to rational instances?
<p>From <a href="http://books.google.com/books?id=8535vmYbLGYC&amp;lpg=PA73&amp;dq=instances%20of%20LINEAR%20PROGRAMMING%20are%20vectors%20and%20matrices.%20Since%20no%20strongly%20polynomial-time%20algorithm%20for%20LINEAR%20PROGRAMMING%20is%20known%20we%20have%20to%20restri&amp;pg=PA73#v=onepage&amp;q=instances%20of%...
complexity theory linear programming
0
7,469
Why is $L = \{ \langle M \rangle : L(M) = \{ \langle M \rangle \} \}$ not Turing-recognizable?
<p>In other words, $L$ is the language of Turing machines that recognize the language consisting of only themselves.</p>&#xA;&#xA;<p>Why is $L$ not Turing-recognizable? $L$ is clearly not decidable by Rice's Theorem, but how do I go one step further and also prove that no machine can enumerate $L$?</p>&#xA;
formal languages
1
7,470
Greedy Optimum Dominating Set For A Tree
<p>I am trying to figure out a greedy algorithm that finds the optimum (minimum) dominating set for any tree in linear time.</p>&#xA;&#xA;<p>So a greedy algorithm to find a dominating set for a general graph is not optimum. It's an approximation of the optimum dominating set. But since this is a tree I am assuming that...
graphs greedy algorithms
0
7,472
How to explain rehosting and retargeting with T-diagrams?
<p>I'm currently learning for an exam about compilers and found the following question:</p>&#xA;&#xA;<blockquote>&#xA; <p>(3 p.) <strong>Bootstrapping</strong>: Explain the concepts of <em>rehosting</em> and <em>retargeting</em>. Use T-diagrams.</p>&#xA;</blockquote>&#xA;&#xA;<p>As far as I understand, rehosting means...
terminology compilers
0
7,473
Propositional formula in DNF can be decided in polynomial time?
<p>For a given propositional formula f in DNF, one can decide in polynomial time, if the formula is satisfiable:&#xA;Just walk through all subformulas (l_1 and ... and l_k) and check, wheter it has NO complementary pair of literals. Formula f is satisfiable iff such subformula exists.</p>&#xA;&#xA;<p>Is my approach abo...
logic polynomial time
1
7,474
Can you obtain more than two vertex covers from a bipartite graph using a max-flow algorithm?
<p>Applying a max-flow algorithm to the graph it's trivially possible to find one or two vertex covers, inverting source and sink and the directions of the flows. Is it possible to find more?</p>&#xA;
graphs
0
7,479
Summation of $O(n)$ from $1\le k\le n$
<p>Summation of $O(n)$ from $1\le k\le n$.</p>&#xA;&#xA;<p>I think it should be $O(n)$ only. Because we are addition $O(k)$ and maximum order will be $O(n)$. But answer is given as $O(n^2)$.</p>&#xA;&#xA;<p>Correct me if I'm wrong.</p>&#xA;
algorithms time complexity
1
7,480
Asymptotic Analysis for two variables?
<p>How is asymptotic analysis (big o, little o, big theta, big theta etc.) defined for functions with multiple variables?</p>&#xA;&#xA;<p>I know that the Wikipedia article has a section on it, but it uses a lot of mathematical notation which I am unfamiliar with it. I also found the following paper: <a href="http://peo...
asymptotics landau notation
1
7,484
Is there an efficient method to store large DAGs?
<p>I have a DAG representing strict partial order where each node is an assignment of variables $V$ to their values $v$. Each arc $(u,w)$ represents a change in one variable value such that $u\succ w$. </p>&#xA;&#xA;<p>So if I have $n$ binary variables, I will end up with $2^n$ nodes which is exponential to the size of...
algorithms graphs data structures partial order
0
7,486
Is this a regular grammar?
<p>I went through a question asking me to categorize the following grammar.</p>&#xA;&#xA;<p>$$S → AA, S → AB, A → a, A→BB, B → b, B → e$$</p>&#xA;&#xA;<p>From the production rules, clearly it is Context-Free. But it accepts a finite set of strings.&#xA;$\{e, a, aa, ab, abb, ba, bba, b, bb, bbb, bbbb\}$&#xA;which is reg...
regular languages formal grammars context free
1
7,488
Is the intersection of two regular languages regular?
<p>Trivially decidable problem is one in which the problem is a known property of the language/grammar. So <strong>intersection of two regular languages is regular should be trivially decidable</strong>? But it is given as not trivially decidable.</p>&#xA;
regular languages undecidability decision problem
1
7,490
Recursive function calculating number of ways to sum $a + 2 b + 3 c = x$
<p>Using python need to code a recursive function with one input and no global integers that calculates the number of options to get $x$ using $a*1+b*2+c*3$.</p>&#xA;&#xA;<p>Say $x=3$, there are four options: $\lbrace (1,1,1),(1,2),(2,1),(3)\rbrace$.</p>&#xA;
combinatorics recursion
1
7,491
Algorithm for getting the outer boundary of a large graph
<p>I am trying to create an <a href="http://en.wikipedia.org/wiki/Isochrone_map" rel="nofollow noreferrer">isochrone</a> based on the OpenStreetMap data set. Everything works fine, I extracted data, processed it into a DAG, ran a Dijkstra algorithm over it. The result is a subset of the complete graph. This is an impre...
algorithms computational geometry graph traversal
1
7,495
How to recognize a STRIPS planning problem has no solution?
<blockquote>&#xA; <p>Strips –Stands for STanford Research Institute Problem Solver (1971).</p>&#xA;</blockquote>&#xA;&#xA;<p><strong>STRIPS Pseudo code -</strong></p>&#xA;&#xA;<pre><code>STRIPS(stateListstart, stateListgoals)&#xA;1.Set state = start&#xA;2.Set plan = []&#xA;3.Set stack = goals&#xA;4.while stack is not ...
algorithms artificial intelligence
1
7,505
What is the purpose of Mark field in Fibonacci Heaps?
<p>In <a href="http://en.wikipedia.org/wiki/Fibonacci_heap" rel="noreferrer">Fibonacci heaps</a>, we keep a mark field for every node in the heap. Initially all the nodes are unmarked. Once a node is deleted, its parent is marked. If a node is deleted and its parent is already marked, the parent will be cut and inserte...
data structures heaps amortized analysis
1
7,509
Data structures for general (non-tetrahedral) cell complexes
<p>For 2D polygonal meshes, the QuadEdge and HalfEdge data structure representations are sufficient to store and enable efficient query of all topological and incidence information. Are there compact and efficient data structures for 3D polyhedral meshes? I know there has been some recent work on compact representation...
data structures computational geometry
1
7,511
Power of Double - Logarithmic Space
<p>I try to solve exercise "on the power of double - logarithmic space" from the great textbook <a href="http://books.google.com/books?id=EuguvA-w5OEC&amp;pg=PA176&amp;lpg=PA176&amp;redir_esc=y#v=onepage&amp;q&amp;f=false" rel="nofollow">Computational Complexity by Oded Goldreich. </a>&#xA;The goal is to show that the ...
complexity theory space complexity
1
7,512
Looking for some more details on "Turing" devices
<p>I've been reading a lot of computer science literature in the recent past but haven't ran across an explanation of Turing machines, the different types, and why they seem to come up so often (I understand they are a sort of a basis for CS topics). </p>&#xA;&#xA;<p>I've also seen comments by some members mentioning ...
terminology turing machines computation models turing completeness
1
7,518
How to show that given language is unambiguous
<p>Given following grammar:</p>&#xA;&#xA;<p>$$&#xA;\begin{align}&#xA;S \rightarrow &amp;A1B \\&#xA;A \rightarrow &amp; 0A \mid \varepsilon \\&#xA;B \rightarrow &amp; 0B \mid 1B \mid \varepsilon \\&#xA;\end{align}&#xA;$$</p>&#xA;&#xA;<p>How can I show that this grammar is unambiguous? I need to find a grammar for the sa...
formal languages formal grammars context free proof techniques ambiguity
1
7,521
Single machine job scheduling to minimize weighted sum of completion time
<p>Given $n$ jobs, schedule them such that the weighted sum is minimum.</p>&#xA;&#xA;<p>weighted minimum sum S for the schedule $\sigma = \{ J_1, J_2, ... J_n \}$ is given by :</p>&#xA;&#xA;<p>$S = \sum_{1\leqq i \leqq n} w_i C_i$ where $C_i\ = \sum_{1\leqq j \leqq i} t_j$ and $w_i$ is the weight of job $J_i$, $t_i$ ...
algorithms greedy algorithms scheduling
0
7,523
Find $\epsilon'$ s.t $L_\epsilon$ is $\mathsf{NP}$-hard for any $\epsilon<\epsilon'$
<p>Let $L_\epsilon$ be the language of all $2$-CNF formulas $\varphi$, such that at least $(\frac{1}{2}+\epsilon)$ of $\varphi$'s clauses can be satisfied.</p>&#xA;&#xA;<p>I need to prove that there exists $\epsilon'$ s.t $L_\epsilon$ is $\mathsf{NP}$-hard for any $\epsilon&lt;\epsilon'$.</p>&#xA;&#xA;<p>We know that $...
complexity theory satisfiability approximation
1
7,525
Number of digits in a binary product
<p>Assume i have 2 numbers in binary form (or, more precisely, assume to know the number of their digits, DF1, DF2):</p>&#xA;&#xA;<p>101010101001010101010101010111111111111111111111010101&#xA;10101111111111111111010101</p>&#xA;&#xA;<p>Is there a formula for the exact number of binary digits (DP) of the product?</p>&#xA...
factoring
1
7,526
Maximum weight matching
<p>There are polynomial time algorithms to find maximum weighted matching in a general graph. Is there any algorithm that also handles negative weights in the general graph and find maximum weighted matching for that graph with negative weights ?</p>&#xA;
algorithms graphs matching
0
7,531
No compression algorithm can compress all input messages?
<p>I just started reading a book called Introduction to Data Compression, by Guy E. Blelloch. On page one, he states:</p>&#xA;<blockquote>&#xA;<p>The truth is that if any one message is shortened by an algorithm, then some other message needs to be lengthened. You can verify this in practice by running GZIP on a GIF fi...
data compression coding theory
1
7,535
Characteristic path length
<p>I am unable to understand that what the characteristic path length (CPL) of a graph is.</p>&#xA;&#xA;<p>In one of its definitions, it is written that</p>&#xA;&#xA;<blockquote>&#xA; <p>it is defined as the median of the means&#xA; of the shortest path lengths connecting each vertex to all other vertices.</p>&#xA;</...
graphs
1
7,543
Are there strongly-polynomial algorithms that take more than polynomial time?
<p>In [1] <em>strongly-polynomial</em> is defined as either:</p>&#xA;&#xA;<ul>&#xA;<li>The algorithm runs in strongly polynomial time if the algorithm is a polynmomial space algorithm and performs a number of elementary arithmetic operations which is bounded by a polynomial in the number of input numbers.</li>&#xA;<li>...
complexity theory time complexity space complexity
0
7,545
The stable marriage algorithm with asymmetric arrays
<p>I have a question about the stable marriage algorithm, for what I know it can only be used when I have arrays with the same number of elements for building the preference and the ranking matrices.</p>&#xA;&#xA;<p>For example if we have 10 students that should be assigned to 10 dorms, then I can build the preference ...
algorithms optimization bipartite matching matching
1
7,550
Prove given equality check function works for all subset of integers
<p>I wrote a function to check equality between integers <code>a</code> and <code>b</code> using bitwise shift operators. Return value of <code>1</code> means both are Equal and <code>0</code> means unequal inputs.</p>&#xA;&#xA;<pre><code>int foo(int a, int b)&#xA;{&#xA; return ((a&gt;&gt;= b&lt;&lt;= a) ? 1 : 0...
complexity theory algorithms
0
7,559
Logarithmic space difference between deterministic and non-deterministic algorithms
<p>I had an interview today, and the interviewer has told me about a theorem (of someone called Hill- or Hell-something) which states that for a non-deterministic algorithm there exists a deterministic algorithm of some time complexity and a space complexity of no more than the original space complexity times log(n).</...
algorithms space complexity nondeterminism
0
7,560
Is this grammar really LL(1) while not being LR(1)?
<p>$S \rightarrow S$, $L(G) = \{\}$</p>&#xA;&#xA;<p><strong>LL(1) analysis:</strong></p>&#xA;&#xA;<p>We estabilish $FIRST(S)$ to be empty and $FOLLOW(S)$ to be $\{\$\}$.&#xA;$FIRST(S)$ doesn't contain &epsilon;, so the parse table looks like this:</p>&#xA;&#xA;<pre><code>+---+---+&#xA;| | $ |&#xA;+---+---+&#xA;| S | ...
formal grammars context free parsers
1
7,561
About complexity of a language
<p>I have a language which is made out of and has a grammar only operating on well parenthesized words or words of one symbol. I want to know if the problem of belonging to this language is decidable.</p>&#xA;&#xA;<p><strong>Example.</strong> Consider the following grammar:&#xA;$$a \to a(aa) \\ a \to b \\a (a(a(ab))) \...
formal languages computability
1
7,564
What is the state of the art in encapsulated search in functional logic programming?
<p>I am particularly interested in solutions to the problem that encapsulated search can depend on the order of evaluation.</p>&#xA;&#xA;<p>According to [1], encapsulated search in PAKCS depends on the order of evaluation, while in MCC, it does not, but using it requires knowledge of the compiler implementation and it ...
reference request functional programming nondeterminism logic programming
0
7,565
Bellman-Ford algorthm and negative cycle proof
<p>I found the algorithm for finding the negative cycle in a graph after running <a href="http://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="nofollow">Bellman-Ford algorithm</a>.</p>&#xA;&#xA;<p>The algorithm is to perform another relax iteration over all the edges. Than if we find an edge to relax we s...
algorithms graphs
0
7,566
Finding the grammar type of the programming language
<p>How can someone find what type of grammar for a given programming language?</p>&#xA;&#xA;<p>Formerly I'm looking for a grammar type for most popular programming languages: C, C++, C#, Java, List, OCaml, Haskell etc.</p>&#xA;
formal grammars programming languages
1
7,568
Bipartite Problem is Log-Space Reducible To $s$-$t$ Undirected Connectivity
<p>Prove that the problem of determining if graph is bipartite is computationally equivalent under log-space reductions to $s$-$t$ undirected connectivity. </p>&#xA;&#xA;<p>Problem of $s$-$t$ undirected connectivity is the following given an undirected graph $G = (V, E)$ and two designated vertices, $s$ and $t$, determ...
complexity theory space complexity
0
7,569
Shortest paths graph
<p>Given a directed graph $G$, edge weights for each edge, source vertex $s$ and $d[v]$ for each vertex in the graph (the distance from $s$ to $v$), I need to find an algorithm that builds the shortest paths graph.</p>&#xA;&#xA;<p>I was thinking of going on edges by BFS, but then how can I know which edge should be in ...
algorithms
0
7,574
Which languages are recognized by one-counter machines?
<p><strong><a href="http://en.wikipedia.org/wiki/Counter_machine">Counter machines</a></strong> with two or more counters are typically shown to be equivalent to Turing machines in courses on the theory of computation. However, I have not seen a formal analysis of which languages can be recognized by a one-counter mac...
computability automata
1
7,578
Multisets of a given set
<p>A multiset is an unordered collection of elements where elements may repeat any&#xA;number of times. The size of a multiset is the number of elements in it counting&#xA;repetitions.</p>&#xA;&#xA;<p>(a) What is the number of multisets of size $4$ that can be constructed from $n$&#xA;distinct elements so that at least...
combinatorics sets
1
7,582
What is the advantage of Randomized Quicksort?
<p>In their book <a href="http://www.amazon.co.uk/Randomized-Algorithms-Cambridge-International-Computation/dp/0521474655/ref=sr_1_1?ie=UTF8&amp;qid=1356380410&amp;sr=8-1"><em>Randomized Algorithms</em>,</a> Motwani and Raghavan open the introduction with a description of their RandQS function -- Randomized quicksort -...
algorithm analysis sorting randomized algorithms
1
7,585
Recursive and recursively enumerable language definition for a layman
<p>I've come across many definitions of recursive and recursively enumerable languages. But I couldn't quite understand what they are .</p>&#xA;&#xA;<p>Can some one please tell me what they are in simple words?</p>&#xA;
formal languages computability turing machines
1
7,587
What are handles in parsing?
<p>I have read a few algorithms for $LR(k)$ parser, in which there is a frequent mention of selecting a handle from the grammar given.&#xA;For example, one document said - <em>"the essence of LR parsing is identifying the handle on top of stack"</em></p>&#xA;&#xA;<p>Please help me understand, what are handles in parsi...
compilers parsers
1
7,588
Regularity of “middles” of words from regular language
<p>I need some help with the following problem. Let $L \subseteq \Sigma^*$ be a regular language. I have to prove that the language $P = \{\alpha \mid \beta\alpha\gamma \in L, \beta,\gamma \in \Sigma^*\}$ is regular, where $\Sigma$ is the alphabet. In other words $P$ is the language of all substrings of words from $L$....
formal languages regular languages closure properties
1
7,594
Maximizing a convex function with a linear constraint
<p>$$\text{maximize } f(\mathbf{x}) \quad\text{subject to } \mathbf{Ax} = \mathbf{b}$$</p>&#xA;&#xA;<p>where</p>&#xA;&#xA;<p>$$f(\mathbf{x}) = \sum_{i=1}^N\sqrt{1+\frac{x_i^4}{\left(\sum_{i=1}^{N}x_i^2\right)^2}},$$</p>&#xA;&#xA;<p>$\mathbf{x} = [x_1,x_2,...,x_N]^T \in \mathbb{R}^{N\times 1}$ and $\mathbf{A} \in \mat...
optimization
0
7,595
Prove that $\text{EXACT-TRIPLE}$ is not in NP
<p>I received the following assignment:</p>&#xA;&#xA;<p>$\text{EXACT-TRIPLE} = \{ \phi \mid \phi \text{ is a boolean formula that has exactly 3 satisfying assignments} \}$.</p>&#xA;&#xA;<p>I need to decide whether this problem belongs to NP or not. I assume it does not. How do I prove that?</p>&#xA;
complexity theory np complete satisfiability np
0
7,598
Proof of message complexity on the network
<p>I try to provide a strict and mathematical rigorous proof to the following problem in Distributed Algorithms. </p>&#xA;&#xA;<p>Prove or make a contradiction: if to vertices $a$ and $b$ on the network $G$ are located on the distance $k$ from each other, and there are $k^2$ different paths on different edges, so it is...
proof techniques distributed systems
0
7,600
Discrepancy between heads and tails
<p>Consider a sequence of $n$ flips of an unbiased coin. Let $H_i$ denote the absolute value of the excess of the number of heads over tails seen in the first $i$ flips. Define $H=\text{max}_i H_i$. Show that $E[H_i]=\Theta ( \sqrt{i} )$ and $E[H]=\Theta( \sqrt{n} )$. </p>&#xA;&#xA;<p>This problem appears in the first ...
probability theory randomized algorithms
1
7,602
k-armed bandit - index policies vs. Q-learning
<p>I am interested in the stateless k-armed bandit problem, where an agent repeatedly chooses one of k independent arms, each with a different distribution of rewards, and tries to maximize its total reward.</p>&#xA;&#xA;<p>I read many papers about this subject, but I am still confused, as there are two types of soluti...
machine learning
1
7,603
Label Assignment Problem
<p>I try to solve an exercise in <strong>Distributed Algorithm</strong> described as follow.</p>&#xA;&#xA;<p>Let's define a <em>label assignment problem</em> as follow. There is a anonymous network (vertices don't have unique ID's , nodes don't have any clue about $n$ - number of vertices nor about network topology ). ...
algorithms time complexity distributed systems
0
7,604
What can be said about Θ-classes in m and n if we know that m < n?
<p>A function in $\Theta(m + n^2)$ and $0 &lt; m &lt; n^2$, is in $\Theta(n^2)$. Does a function in $\Theta(m\log n)$ and $0 &lt; m &lt; n^2$, imply that it is $\Theta(n^2\log n)$?</p>&#xA;
asymptotics landau notation
1
7,607
alphabet of a single tape turing machine that simulates a multitape TM
<p>First of all sorry, if this question already exists, in that case, pointing to the right direction will be appreciated.</p>&#xA;&#xA;<p>Secondly, sorry, if the question is below the expected level of Niveau, but all help appreciated.</p>&#xA;&#xA;<p>In the textbook by J. Hromkovic, named "Theoretical Computer Scienc...
turing machines
1
7,610
XOR-like behavior in flow networks
<p><em>XOR is not the correct name, but I am looking for some kind of exclusive behavior.</em></p>&#xA;&#xA;<p>I am currently solving a set of different (assignment) problems by modeling flow networks and running a min-cost-max-flow algorithm. Flow networks are quite handy because a lot of problems can be reduced to th...
algorithms graphs network flow assignment problem
1
7,613
Derive some strings
<p>G=({S,A,B},{0,1},P,S)</p>&#xA;&#xA;<p>Where P:</p>&#xA;&#xA;<ul>&#xA;<li>S→A1B</li>&#xA;<li>A→0A|ε </li>&#xA;<li>B→0B|1B|ε</li>&#xA;</ul>&#xA;&#xA;<p>I have to list the first 25 strings from L(G). So far I've made the tree, but I'm not sure that it's correct. </p>&#xA;&#xA;<p><img src="https://i.stack.imgur.co...
context free
1
7,617
LU decomposition with pivoting
<p>I have to solve system of linear algebraic equations $AX=B$, where $A$ is a two-dimensional matrix with all elements of main diagonal equal to zero.</p>&#xA;&#xA;<p>How to solve this problem? Iterational methods are not applied in this case.</p>&#xA;&#xA;<p>One way is <a href="http://en.wikipedia.org/wiki/LU_decompo...
matrices linear algebra
1
7,618
Data structures and algorithms for bridge game play?
<p>In a bridge game, a deck of 52 cards (13 spades , 13 clubs, 13 diamonds, 13 spades) are dealt to 4 players (13 cards each) then game starts.Game session ends after 13 tricks each having 4 cards.There are 28561 possible non repeated 4 card groups.</p>&#xA;&#xA;<p>What is the best method of generating and storing all ...
algorithms data structures combinatorics board games
0
7,622
Finding maximum and minimum of consecutive XOR values
<p>Given an integer array (maximum size 50000), I have to find the minimum and maximum $X$ such that $X = a_p \oplus a_{p+1} \oplus \dots \oplus a_q$ for some $p$, $q$ with $p \leq q$.</p>&#xA;&#xA;<p>I have tried this process: $\text{sum}_i = a_0 \oplus a_1 \oplus \dots \oplus a_i$ for all $i$. I pre-calculated it in...
algorithms algorithm analysis performance binary arithmetic arithmetic
1
7,624
Computing the clustering coefficient
<p>I saw in <a href="http://www.youtube.com/watch?v=7ayAEHS1-F8" rel="nofollow">this</a> video that computing clustering coefficient of central node of a star graph using the following algorithm is $\Theta(n^2)$ and for a clique it is $\Theta(n^3)$. is that correct?</p>&#xA;&#xA;<pre><code>def clustering_coefficient(G...
graphs algorithm analysis runtime analysis
1
7,625
SSTF disk scheduling algorithm? What if lowest seek times are equal in either direction?
<p>Using the Shortest-Seek-Time-First (SSTF) disk scheduling algorithm (where we select a request with a minimum seek time from the current head position), what happens if the requests in both directions from the current head position are equal? </p>&#xA;&#xA;<p>For example, if the head position is at 25, and the neare...
algorithms operating systems storage
1
7,628
Bellman-Ford: shortest path
<p>my assumption:<br/>&#xA;- we have an undirected graph with only positive edges<br/>&#xA;- the edges are sorted alphabetically: <br/>&#xA;&nbsp;&nbsp;&nbsp;&nbsp;e.g A-B, A-C, B-D <br/>&#xA;&nbsp;&nbsp;&nbsp;&nbsp;and e.g not C-A, D-B, A-B </p>&#xA;&#xA;<p>I do not understand, why we need the first loop (line 1) here...
algorithms graphs shortest path
1
7,629
Random graph model
<p>When we say that in random graph we add an edge with a certain fixed probability, what do we actually mean?</p>&#xA;&#xA;<p>For example if probability is 0.5, does that mean that we can just add two edges in a graph because 0.5+0.5=1.</p>&#xA;
graphs probability theory
1
7,637
Is it possible to use plants as a medium to store data? By what data structure?
<p>my question is simple.&#xA;Is it possible to use plants as a medium to store data?</p>&#xA;&#xA;<p>My opinion is: Possible, but we need to solve, how to distinguish 2 states. &#xA;Duplication and CRC of stored DATA is quiet simple. Growing new plants is easiest possibility, but we need to create unit, which will tak...
data structures graphs
1
7,641
randomized algorithm for checking the satisfiability of s-formulas, that outputs the correct answer with probability at least $\frac{2}{3}$
<p>I'm trying to practice myself with random algorithms.</p>&#xA;&#xA;<p>Lets call a CNF formula over n variables s-formula if it is either unsatisable or it has at&#xA;least $\frac{2^n}{n^{10}}$ satisfying assignments.</p>&#xA;&#xA;<p>I would like your help with show a randomized algorithm for checking the&#xA;satisfi...
complexity theory time complexity randomized algorithms
1
7,644
What is the fastest algorithm for finding all shortest paths in a sparse graph?
<p>In an unweighted, undirected graph with $V$ vertices and $E$ edges such that $2V \gt E$, what is the fastest way to find all shortest paths in a graph? Can it be done in faster than Floyd-Warshall which is $O(V^3)$ but very fast per iteration?</p>&#xA;&#xA;<p>How about if the graph is weighted?</p>&#xA;
algorithms graphs shortest path
1
7,647
RDT2.1 - does the Sender listener to "ack" even though state=ready?
<blockquote>&#xA; <p>Computer Networking:&#xA; A Top Down Approach&#xA; Featuring the Internet,&#xA; Jim Kurose, Keith Ross&#xA; Addison-Wesley 4nd edition , page -223.</p>&#xA;</blockquote>&#xA;&#xA;<p>Also <a href="https://sites.google.com/site/amirherzberg/introductiontocommunicationnetworks89-35/89-350-introdu...
computer networks
1
7,649
Dijkstra's algorithm for undirected graphs with negative edges
<p>INPUT: "an undirected, weighted graph (negative weights allowed)"</p>&#xA;&#xA;<p>Could someone give an example for an undirected graph with negative edges where Dijkstra's algorithm doesn't work?&#xA;As far as i understood it only fails by directed graphs in case of negative edges.<br/>&#xA;Am i right ?</p>&#xA;
graphs shortest path
1
7,651
What Properties Matter For the Bound on Generalization Error of Hypothesis Set?
<p>As I know, there are several upper bounds on the generalization error of hypothesis set with respect to sample complexity. For hypothesis space $V$, if the learning algorithm output the set of hypotheses that are consistent with the training data, i.e., $\sum\limits_{1 \leq i \leq n}{\frac{I[h(x_i) \not= y_i]}{n}} =...
machine learning artificial intelligence
0
7,654
Why are computable numbers (in Turing's sense) enumerable?
<p>Why are computable numbers (in Turing's sense) enumerable?&#xA;It must be very obvious, but I'm currently just not seeing it.</p>&#xA;
computability turing machines enumeration
0
7,665
Does $\mathsf{P} \ne \mathsf{NP}$ imply that $|\mathsf{NP}| > |\mathsf{P}|$?
<p>Is it possible that $\mathsf{P} \not = \mathsf{NP}$ and the cardinality of $\mathsf{P}$ is the same as the cardinality of $\mathsf{NP}$? Or does $\mathsf{P} \not = \mathsf{NP}$ mean that $\mathsf{P}$ and $\mathsf{NP}$ must have different cardinalities?</p>&#xA;
complexity classes p vs np
0
7,668
Find all increasing/decreasing sub array
<p>I have a question that I still struggle with.&#xA;It would be really appreciated if you guys could give me some hints.</p>&#xA;&#xA;<p>Here is the problem : &#xA;Assume that $a[1\dots n]$ is an array of $n$ positive real numbers.&#xA;Let $\alpha &gt;0$ and $\beta &gt;0$</p>&#xA;&#xA;<ul>&#xA;<li><p>a subarray $a_1$ ...
algorithms substrings
0
7,671
How to understand the reduction from 3-Coloring problem to general $k$-Coloring problem?
<p>3-Coloring problem can be proved NP-Complete making use of the reduction from 3SAT <a href="http://www.ic.unicamp.br/~rezende/ensino/mo417/2010s2/notas/16-nphard.pdf" rel="nofollow">Graph Coloring (from 3SAT)</a>. As a consequence, 4-Coloring problem is NP-Complete using the reduction from 3-Coloring:</p>&#xA;&#xA;<...
complexity theory graphs terminology np complete
1
7,674
terminology for grouping words in a string?
<p>We commonly create sub-groups of strings in one particular algorithm implementation. I just want to know in CS literature is there any standard name for such kind of grouping. For e.g.</p>&#xA;&#xA;<pre><code>Hello World! This is May from the dairy farm.&#xA;</code></pre>&#xA;&#xA;<p>Strings with sub-groups of two:<...
terminology strings substrings
1
7,676
Is undecidable(complement of R) a subset of NP-hard?
<p>Is there an undecidable problem which is not NP-hard?</p>&#xA;
complexity theory undecidability
0
7,679
Names of Softwares used for modeling
<p>Which tools or softwares are mostly used for the purpose of modeling a computer network?</p>&#xA;
computer networks
1
7,682
Formal Languages - Expressive power of Formalisms
<p>I need help with the following question:</p>&#xA;&#xA;<p>Order the following formalisms according to their expressive power:&#xA;placing A before B means that any language definable by A is definable&#xA;by B. Also state which, if any, of them are equivalent.</p>&#xA;&#xA;<pre><code>• Turing Machines (TM)&#xA;• Regu...
formal languages regular languages context free regular expressions pushdown automata
1
7,685
What is prefix monotonicity?
<p>I have a background in computer architecture and only cursory understanding of process networks. For a paper I am writing I need to understand prefix monotonicity properly. </p>&#xA;&#xA;<p>For now I have "a stream transformer is prefix monotonic if its output for a given input record r is dependent only on the inpu...
reference request terminology nondeterminism
0
7,687
Standard notation for the language of the universal Turing machine?
<p>The <a href="http://en.wikipedia.org/wiki/Universal_Turing_machine" rel="nofollow">universal Turing machine</a> $U_{TM}$ is a TM that takes in as input an encoding of a TM and a string, then runs the TM on the string and does whatever the simulated TM does. The language of the universal TM is the set of all encodin...
computability terminology turing machines
1
7,690
Why we do isomorphism, automorphism and homomorphism?
<p>What are the key differences between these three terms isomorphism, automorphism and homomorphism in simple layman language and why we do isomorphism, automorphism and homomorphism ?</p>&#xA;
graphs
1
7,691
Simplify complexity of n multichoose k
<p>I have a recursive algorithm with time complexity equivalent to choosing k elements from n with repetition, and I was wondering whether I could get a more simplified big-O expression. In my case, <span class="math-container">$k$</span> may be greater than <span class="math-container">$n$</span> and they grow indepe...
asymptotics combinatorics runtime analysis
1
7,698
An online parallel algorithm for finding top K elements
<p>Suppose we have a function on GPU which calculates elements of array from which we need to select top K elements. The number of elements can be quite big so we can't store them in memory and our algorithm should be online. Another requirement for algorithm is its good parallelization so it could be effectively run o...
algorithms parallel computing
0
7,699
Compare vectors, photo mosaic
<p>I’m trying to make a photo mosaic web application. I split the main picture in to a number of squares. I split this square up in to 9 squares.</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/AZ6vc.jpg" alt="See picture"> </p>&#xA;&#xA;<p>Then I calculate the mean color (RGB) of the entire square and the mean col...
algorithms image processing
0
7,701
Finding containing sets in a set of sets
<p>Suppose I have a set of sets of integers <span class="math-container">$A$</span>, is there an efficient algorithm/data structure that will allow me to query for all sets of integers that include a given input set? That is, given input <span class="math-container">$I\subset \mathbb Z$</span>, find <span class="math-c...
algorithms sets
0
7,702
"Applicative order" and "Normal order" in lambda-calculus
<blockquote>&#xA; <p><strong>Applicative order:</strong> Always fully evaluate the arguments of a function&#xA; before evaluating the function itself , like -</p>&#xA; &#xA; <p>$(\lambda x. x^2(\lambda x.(x+1) \ \ 2))) \rightarrow (\lambda x.&#xA; x^2(2+1))\rightarrow \ (\lambda x. x^2(3)) \rightarrow \ 3^2 \&#xA...
logic lambda calculus normal forms
1