id int64 1 141k | title stringlengths 15 150 | body stringlengths 45 28.5k | tags stringlengths 1 102 | label int64 1 1 | text stringlengths 128 28.6k | source stringclasses 1
value |
|---|---|---|---|---|---|---|
105,500 | Unifying Accept States in NFA | <p>I recently read the first question and answer in this homework solution <a href="https://cseweb.ucsd.edu/classes/sp08/cse105/hw2s.pdf" rel="nofollow noreferrer">https://cseweb.ucsd.edu/classes/sp08/cse105/hw2s.pdf</a> However, I am not sure if for example, you have two accepting states originally, one in which you l... | finite automata | 1 | Unifying Accept States in NFA -- (finite automata)
<p>I recently read the first question and answer in this homework solution <a href="https://cseweb.ucsd.edu/classes/sp08/cse105/hw2s.pdf" rel="nofollow noreferrer">https://cseweb.ucsd.edu/classes/sp08/cse105/hw2s.pdf</a> However, I am not sure if for example, you have ... | habedi/stack-exchange-dataset |
105,513 | Min-cut in a network with zero flow from source to sink | <p>The max-flow min-cut theorem guarantees that the min-cut of a directed network equals the maximum flow. And we can compute <span class="math-container">$S$</span> and <span class="math-container">$T$</span>, are disjoint subsets containing source node and sink node respectively from the residual graph.</p>

... | network flow ford fulkerson | 1 | Min-cut in a network with zero flow from source to sink -- (network flow ford fulkerson)
<p>The max-flow min-cut theorem guarantees that the min-cut of a directed network equals the maximum flow. And we can compute <span class="math-container">$S$</span> and <span class="math-container">$T$</span>, are disjoint subsets... | habedi/stack-exchange-dataset |
105,515 | Edit Distance Algorithm (variant of longest common sub-sequence) | <p>I'm working on a school assignment which is defined as a variant of the longest common subsequence problem and which is presented in the context of dynamic programming.</p>

<p>The problem is defined as follows:</p>

<p>suppose that you are making a spell-checker with suggestions for misspelled words... | dynamic programming edit distance | 1 | Edit Distance Algorithm (variant of longest common sub-sequence) -- (dynamic programming edit distance)
<p>I'm working on a school assignment which is defined as a variant of the longest common subsequence problem and which is presented in the context of dynamic programming.</p>

<p>The problem is defined as fo... | habedi/stack-exchange-dataset |
105,516 | amortized analysis of max heap | <p>Q) Consider an ordinary binary max-heap data structure with n elements that supports insert and extract-max in <span class="math-container">$O(log(n))$</span> worst-case time. Give a potential function <span class="math-container">$\Phi$</span> such that the amortized cost of insert is <span class="math-container">$... | amortized analysis | 1 | amortized analysis of max heap -- (amortized analysis)
<p>Q) Consider an ordinary binary max-heap data structure with n elements that supports insert and extract-max in <span class="math-container">$O(log(n))$</span> worst-case time. Give a potential function <span class="math-container">$\Phi$</span> such that the amo... | habedi/stack-exchange-dataset |
105,527 | Prove that $I(A;B|C)=0$ given $I(A;B)=0$ | <p>Let <span class="math-container">$A$</span>, <span class="math-container">$B$</span> and <span class="math-container">$C$</span> be 3 discrete random variables. If <span class="math-container">$A$</span> and <span class="math-container">$B$</span> are independent (<span class="math-container">$I(A;B) = 0$</span>, wh... | information theory | 1 | Prove that $I(A;B|C)=0$ given $I(A;B)=0$ -- (information theory)
<p>Let <span class="math-container">$A$</span>, <span class="math-container">$B$</span> and <span class="math-container">$C$</span> be 3 discrete random variables. If <span class="math-container">$A$</span> and <span class="math-container">$B$</span> are ... | habedi/stack-exchange-dataset |
105,528 | Are there decision problems outside of NP? | <p>Consider any problem in NP-hard, then it has a polynomial reduction from a problem in NP in polynomial time. Though, it isn't clear by this definition whether there are decision problems in NP-hard that are not in NP.</p>

<p>Are there any known ones?</p>
 | computability time complexity | 1 | Are there decision problems outside of NP? -- (computability time complexity)
<p>Consider any problem in NP-hard, then it has a polynomial reduction from a problem in NP in polynomial time. Though, it isn't clear by this definition whether there are decision problems in NP-hard that are not in NP.</p>

<p>Are t... | habedi/stack-exchange-dataset |
105,529 | Rooted Tree Isomorphism Algorithm | <p>I have developed an algorithm to determine if two rooted trees are isomorphic, which is based on the following conjecture:</p>

<p>Let <span class="math-container">$S_{u}$</span> be the number of vertices in the rooted subtree of vertex <span class="math-container">$u$</span>.
Namely, the size of the sub... | trees graph isomorphism | 1 | Rooted Tree Isomorphism Algorithm -- (trees graph isomorphism)
<p>I have developed an algorithm to determine if two rooted trees are isomorphic, which is based on the following conjecture:</p>

<p>Let <span class="math-container">$S_{u}$</span> be the number of vertices in the rooted subtree of vertex <span cla... | habedi/stack-exchange-dataset |
105,534 | Prove that the total distance is minimised (when travelling across the longest path) | <p>Here is the problem: Given a tree <span class="math-container">$T$</span>, I need to visit every node in the tree once. I can start and end anywhere I want. I would like to travel the least distance possible when doing so. I don't have to return where I started.</p>

<p>As my specification is not really clea... | graphs trees correctness proof | 1 | Prove that the total distance is minimised (when travelling across the longest path) -- (graphs trees correctness proof)
<p>Here is the problem: Given a tree <span class="math-container">$T$</span>, I need to visit every node in the tree once. I can start and end anywhere I want. I would like to travel the least distan... | habedi/stack-exchange-dataset |
105,536 | Smallest convex set containing given point | <p>Given a set <span class="math-container">$M$</span> of <span class="math-container">$m$</span> points in <span class="math-container">$R^n$</span>, where the number of points <span class="math-container">$m$</span> is much larger than the dimension <span class="math-container">$n$</span>, and given a point <span cla... | computational geometry | 1 | Smallest convex set containing given point -- (computational geometry)
<p>Given a set <span class="math-container">$M$</span> of <span class="math-container">$m$</span> points in <span class="math-container">$R^n$</span>, where the number of points <span class="math-container">$m$</span> is much larger than the dimensi... | habedi/stack-exchange-dataset |
105,554 | Amortized analysis of max-heap | <p>Consider an ordinary binary max-heap data structure with <span class="math-container">$n$</span> elements that supports insert and extract-max in <span class="math-container">$O(\log n)$</span> worst-case time.</p>

<blockquote>
 <p>Question: If extract max is <span class="math-container">$O(1)$</span> ... | amortized analysis | 1 | Amortized analysis of max-heap -- (amortized analysis)
<p>Consider an ordinary binary max-heap data structure with <span class="math-container">$n$</span> elements that supports insert and extract-max in <span class="math-container">$O(\log n)$</span> worst-case time.</p>

<blockquote>
 <p>Question: If ext... | habedi/stack-exchange-dataset |
105,560 | Communication complexity: fooling set bound for inner product function | <p>I am trying to prove that the fooling set method does not give a good lower bound for the communication complexity of the inner product function. Specifically, I am trying to show that the best bound we get using the fooling set method is <span class="math-container">$$D(IP) \geq \Omega(\log n) $$</span></p>
&#x... | communication complexity | 1 | Communication complexity: fooling set bound for inner product function -- (communication complexity)
<p>I am trying to prove that the fooling set method does not give a good lower bound for the communication complexity of the inner product function. Specifically, I am trying to show that the best bound we get using the... | habedi/stack-exchange-dataset |
105,563 | Expected value of the distance between nodes in a binary tree | <p>If there are 16 leaves in a full binary tree and two nodes <span class="math-container">$a$</span> and <span class="math-container">$b$</span> chosen at random, then what is the expected value of the distance between <span class="math-container">$a$</span> and <span class="math-container">$b$</span> in T?</p>
&#... | algorithms | 1 | Expected value of the distance between nodes in a binary tree -- (algorithms)
<p>If there are 16 leaves in a full binary tree and two nodes <span class="math-container">$a$</span> and <span class="math-container">$b$</span> chosen at random, then what is the expected value of the distance between <span class="math-cont... | habedi/stack-exchange-dataset |
105,574 | Proof of Brzozowski's algorithm for DFA minimization? | <p>Brzozowki's algorithm is cited widely. Several questions here give examples or discuss its complexity. But I haven't been able to find a proof of correctness for the algorithm. How do we prove it correct?
Any proof accessible to CS undergraduates would be very welcome.</p>
 | formal languages automata finite automata | 1 | Proof of Brzozowski's algorithm for DFA minimization? -- (formal languages automata finite automata)
<p>Brzozowki's algorithm is cited widely. Several questions here give examples or discuss its complexity. But I haven't been able to find a proof of correctness for the algorithm. How do we prove it correct?
Any pr... | habedi/stack-exchange-dataset |
105,579 | How to find the big o running time if the recursion function have different cases of recursion with different fraction of n? | <p>How to find the big o running time if the recursion function have different cases of recursion with different fraction of n?</p>

<p>If I have a recursive function like this for example (This is just an example, its not a real thing, it just demonstrates my question):</p>

<pre><code>someFunction(n){... | runtime analysis recurrence relation big o notation | 1 | How to find the big o running time if the recursion function have different cases of recursion with different fraction of n? -- (runtime analysis recurrence relation big o notation)
<p>How to find the big o running time if the recursion function have different cases of recursion with different fraction of n?</p>
&#... | habedi/stack-exchange-dataset |
105,602 | Combinatorial Optimization: Shortest distance given sets of drivers and riders | <p><strong>Problem:</strong></p>

<p>I have 2 sets, one of <strong><em>drivers</em></strong> and one of <strong><em>riders</em></strong>. All my participants need to reach one common <strong><em>destination</em></strong>. I wish to calculate the <strong><em>shortest combined distance</em></strong> in order for ... | shortest path minimum spanning tree routing | 1 | Combinatorial Optimization: Shortest distance given sets of drivers and riders -- (shortest path minimum spanning tree routing)
<p><strong>Problem:</strong></p>

<p>I have 2 sets, one of <strong><em>drivers</em></strong> and one of <strong><em>riders</em></strong>. All my participants need to reach one common <... | habedi/stack-exchange-dataset |
105,606 | Why object non-optional ignore its weak property? [Swift] | <p>I have 2 classes <strong>Car</strong> and <strong>Owner</strong>, they have weak preference to each other. After I assign nil to one object. That object is still not deallocated. Like code bellow, as far as I understand object <strong>vinfast (Car)</strong> must be deallocated because its reference count equal zero.... | memory management | 1 | Why object non-optional ignore its weak property? [Swift] -- (memory management)
<p>I have 2 classes <strong>Car</strong> and <strong>Owner</strong>, they have weak preference to each other. After I assign nil to one object. That object is still not deallocated. Like code bellow, as far as I understand object <strong>v... | habedi/stack-exchange-dataset |
105,609 | How to partition a set in order to minimize the number of the elements and their interactions? | <p>Given two sets <span class="math-container">$S_1$</span> and <span class="math-container">$S_2$</span> of <span class="math-container">$n$</span> elements each. Each set <span class="math-container">$S_1$</span> (resp. <span class="math-container">$S_2$</span>) has a revenue <span class="math-container">$R_1$</span>... | algorithms np complete np hard knapsack problems | 1 | How to partition a set in order to minimize the number of the elements and their interactions? -- (algorithms np complete np hard knapsack problems)
<p>Given two sets <span class="math-container">$S_1$</span> and <span class="math-container">$S_2$</span> of <span class="math-container">$n$</span> elements each. Each se... | habedi/stack-exchange-dataset |
105,618 | If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how? | <p>Let us say there is a program such that if you give a partially filled Sudoku of any size it gives you corresponding completed Sudoku.</p>

<p>Can you treat this program as a <strong>black box</strong> and use this to solve TSP? I mean is there a way to represent TSP problem as partially filled Sudoku, so th... | algorithms np complete reductions traveling salesman sudoku | 1 | If I can solve Sudoku, can I solve the Travelling Salesman Problem (TSP)? If so, how? -- (algorithms np complete reductions traveling salesman sudoku)
<p>Let us say there is a program such that if you give a partially filled Sudoku of any size it gives you corresponding completed Sudoku.</p>

<p>Can you treat t... | habedi/stack-exchange-dataset |
105,621 | Can all $O(n)$ problems be solved without nested loops? | <p>There are examples of algorithm implementations that contain nested loops but are of complexity O(n), and some of them have corresponding implementations that contain no nested loops. So here comes a question, can all such implementations be simplified or converted to an implementation with only top layer loops? Nam... | algorithms complexity theory time complexity asymptotics | 1 | Can all $O(n)$ problems be solved without nested loops? -- (algorithms complexity theory time complexity asymptotics)
<p>There are examples of algorithm implementations that contain nested loops but are of complexity O(n), and some of them have corresponding implementations that contain no nested loops. So here comes a... | habedi/stack-exchange-dataset |
105,628 | NP-hard in what parameter? | <p>I often read statements such as "the run-time of algorithm X is polynomial <strong>in m and n</strong>". Indeed, when a problem has two parameters, it is possible that the run-time of an algorithm is polynomial in one parameter but not the other one, so if this is not the case, it is important to emphasize that it i... | terminology | 1 | NP-hard in what parameter? -- (terminology)
<p>I often read statements such as "the run-time of algorithm X is polynomial <strong>in m and n</strong>". Indeed, when a problem has two parameters, it is possible that the run-time of an algorithm is polynomial in one parameter but not the other one, so if this is not the ... | habedi/stack-exchange-dataset |
105,632 | Complexity of an encoded turing machine | <p>This is an example of an assignment question, there are 3 of them so I created my own in order to better understand it.</p>

<p>First, we have the variable <code>m</code> which is a binary encoding such as <code>100#001#010</code> which is translated to <code>[4, 1, 2]</code></p>

<p>Next is the vari... | complexity theory turing machines polynomial time | 1 | Complexity of an encoded turing machine -- (complexity theory turing machines polynomial time)
<p>This is an example of an assignment question, there are 3 of them so I created my own in order to better understand it.</p>

<p>First, we have the variable <code>m</code> which is a binary encoding such as <code>10... | habedi/stack-exchange-dataset |
105,634 | Solving recurrence equation $T(n)=T(n^{2/3})+17$ | <p>How can the following recurrence equation be solved by one of three main ways:</p>

<p><span class="math-container">$$T(n)=T(n^{2/3})+17$$</span></p>

<p>I have tried solving it by the iteration way. However it does not work for me since I can't find the equation with <span class="math-container">$i$... | recurrence relation | 1 | Solving recurrence equation $T(n)=T(n^{2/3})+17$ -- (recurrence relation)
<p>How can the following recurrence equation be solved by one of three main ways:</p>

<p><span class="math-container">$$T(n)=T(n^{2/3})+17$$</span></p>

<p>I have tried solving it by the iteration way. However it does not work fo... | habedi/stack-exchange-dataset |
105,638 | Prove that the next multiple of 4 is obtained using the next formula | <p>I was reading an assembly procedure that needed to align addresses on 4 bytes boundary for performance reasons so it has used the next statement that i formulated as a theorem to be proven.</p>

<p>Let <span class="math-container">$s$</span> be an integer that is not a multiple of 4 (<span class="math-contai... | arithmetic binary assembly | 1 | Prove that the next multiple of 4 is obtained using the next formula -- (arithmetic binary assembly)
<p>I was reading an assembly procedure that needed to align addresses on 4 bytes boundary for performance reasons so it has used the next statement that i formulated as a theorem to be proven.</p>

<p>Let <span ... | habedi/stack-exchange-dataset |
105,644 | Constructing a minimum spanning tree from an all-shortest path graph? | <p>Given an <span class="math-container">$n \times n$</span> shortest path distance matrix <span class="math-container">$D$</span>. And a complete graph <span class="math-container">$G(D)$</span> on <span class="math-container">$n$</span> nodes, where edge <span class="math-container">$(i, j)$</span> has weight <span c... | graphs shortest path weighted graphs minimum spanning tree | 1 | Constructing a minimum spanning tree from an all-shortest path graph? -- (graphs shortest path weighted graphs minimum spanning tree)
<p>Given an <span class="math-container">$n \times n$</span> shortest path distance matrix <span class="math-container">$D$</span>. And a complete graph <span class="math-container">$G(D... | habedi/stack-exchange-dataset |
105,649 | Help with understanding why we need an expectation in the loss | <p>I am reading the paper SV2P - Stochastic Varaiational Video Prediction (<a href="https://arxiv.org/abs/1710.11252" rel="nofollow noreferrer">https://arxiv.org/abs/1710.11252</a>). In it the authors use the loss shown in the image:
<a href="https://i.stack.imgur.com/JiQI3.png" rel="nofollow noreferrer"><img src="... | machine learning research | 1 | Help with understanding why we need an expectation in the loss -- (machine learning research)
<p>I am reading the paper SV2P - Stochastic Varaiational Video Prediction (<a href="https://arxiv.org/abs/1710.11252" rel="nofollow noreferrer">https://arxiv.org/abs/1710.11252</a>). In it the authors use the loss shown in the... | habedi/stack-exchange-dataset |
105,652 | What does $O(\alpha(n))$ amortized time mean? | <p>DELETE(S, i): Delete integer <span class="math-container">$i$</span> from the set <span class="math-container">$S$</span>. if <span class="math-container">$i \notin S$</span>, there is no effect.</p>

<p>from a set of consectutive integers like <span class="math-container">$S = \{1,2,3,5,6\}$</span></p>
... | data structures time complexity amortized analysis | 1 | What does $O(\alpha(n))$ amortized time mean? -- (data structures time complexity amortized analysis)
<p>DELETE(S, i): Delete integer <span class="math-container">$i$</span> from the set <span class="math-container">$S$</span>. if <span class="math-container">$i \notin S$</span>, there is no effect.</p>

<p>fro... | habedi/stack-exchange-dataset |
105,659 | Efficient data structure for storing integers in a range? | <p>Say I'm constantly given integers from the range <span class="math-container">$[1,2^{32}]$</span> in a random order and have to store these so that when a duplicate arrives I can deal with it. By the end of this algorithm all <span class="math-container">$2^{32}$</span> values will have been treated.</p>

<p... | data structures search algorithms integers | 1 | Efficient data structure for storing integers in a range? -- (data structures search algorithms integers)
<p>Say I'm constantly given integers from the range <span class="math-container">$[1,2^{32}]$</span> in a random order and have to store these so that when a duplicate arrives I can deal with it. By the end of this... | habedi/stack-exchange-dataset |
105,669 | Does increasing k in a k-way set-associative cache always lead to a better miss rate? | <p>As far as I know a 2-way set-associative cache works better than a one-way one considerably but going to 4 and 8-way caches leads to a marginal improvement. My question is: does increasing K (going more than 8) lead to better miss rate although marginal?</p>
 | computer architecture cache | 1 | Does increasing k in a k-way set-associative cache always lead to a better miss rate? -- (computer architecture cache)
<p>As far as I know a 2-way set-associative cache works better than a one-way one considerably but going to 4 and 8-way caches leads to a marginal improvement. My question is: does increasing K (going ... | habedi/stack-exchange-dataset |
105,674 | Counting models satisfying a boolean formula | <p>I'm trying to implement the #2-SAT algorithm from the paper "<a href="https://www.ida.liu.se/~petjo00/Research/Papers/Conference/C24/C24.ps" rel="nofollow noreferrer">Counting Satisfying Assignments in 2-SAT and 3-SAT</a>" (Dahllöf, Jonsson and Wahlström, <em>Theor. Comput. Sci.</em> 332(1–3):265&nda... | combinatorics satisfiability 2 sat | 1 | Counting models satisfying a boolean formula -- (combinatorics satisfiability 2 sat)
<p>I'm trying to implement the #2-SAT algorithm from the paper "<a href="https://www.ida.liu.se/~petjo00/Research/Papers/Conference/C24/C24.ps" rel="nofollow noreferrer">Counting Satisfying Assignments in 2-SAT and 3-SAT</a>" (Dahll&ou... | habedi/stack-exchange-dataset |
105,679 | What are the k-collections described in ch. 8 of "An Introduction to the Analysis of Algorithms" by Sedgewick | <p>In chapter eight of "An Introduction to the Analysis of Algorithms" by Sedgewick (1996 edition) the coupon collector problem is introduced on page 425.</p>

<p>My confusion is how to identify the k-collections. A k-collection is defined as:
"<em>to be a word that consists of k different letters with the ... | algorithm analysis hashing | 1 | What are the k-collections described in ch. 8 of "An Introduction to the Analysis of Algorithms" by Sedgewick -- (algorithm analysis hashing)
<p>In chapter eight of "An Introduction to the Analysis of Algorithms" by Sedgewick (1996 edition) the coupon collector problem is introduced on page 425.</p>

<p>My conf... | habedi/stack-exchange-dataset |
105,684 | what is meant by support of a filter? | <p>what is meant by support of a filter in context of image processing?
In the attached link of a short tutorial for detecting bar in an image by gabor filter,it is said that γ=1 helps in finding the support of the filter.
link<a href="http://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/AV0405/SIKLOSSY/bars... | image processing filtering problem | 1 | what is meant by support of a filter? -- (image processing filtering problem)
<p>what is meant by support of a filter in context of image processing?
In the attached link of a short tutorial for detecting bar in an image by gabor filter,it is said that γ=1 helps in finding the support of the filter.
link<a href... | habedi/stack-exchange-dataset |
105,685 | Image convolution - image darkens | <p><a href="https://i.stack.imgur.com/QXylS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QXylS.jpg" alt="enter image description here"></a>I'm using kernel convolution in python to blur an image, but in addition to blurring it also turns the image darker. Could someone explain why it happens?</p>&... | image processing matrices | 1 | Image convolution - image darkens -- (image processing matrices)
<p><a href="https://i.stack.imgur.com/QXylS.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/QXylS.jpg" alt="enter image description here"></a>I'm using kernel convolution in python to blur an image, but in addition to blurring it also t... | habedi/stack-exchange-dataset |
105,689 | Are regular expressions a*a and aa* equivalent? | <p>Let <span class="math-container">$\Sigma = \{a, b\}$</span> an alphabet. Are the regular expressions <span class="math-container">$a^*a$</span> and <span class="math-container">$aa^*$</span> over <span class="math-container">$\Sigma$</span> equivalent? Even though concatenation is not commutative, in this case it se... | regular expressions | 1 | Are regular expressions a*a and aa* equivalent? -- (regular expressions)
<p>Let <span class="math-container">$\Sigma = \{a, b\}$</span> an alphabet. Are the regular expressions <span class="math-container">$a^*a$</span> and <span class="math-container">$aa^*$</span> over <span class="math-container">$\Sigma$</span> equ... | habedi/stack-exchange-dataset |
105,692 | Do I need to consider instance restrictions when showing a language is in P? | <p>I have already shown that 3-colorable for an unrestricted graph is in NP, but I was thinking about the similar language defined as the set of all acyclic <span class="math-container">$G$</span>, where <span class="math-container">$G$</span> such that <span class="math-container">$G$</span> is 3-colorable. In my prop... | turing machines time complexity terminology | 1 | Do I need to consider instance restrictions when showing a language is in P? -- (turing machines time complexity terminology)
<p>I have already shown that 3-colorable for an unrestricted graph is in NP, but I was thinking about the similar language defined as the set of all acyclic <span class="math-container">$G$</spa... | habedi/stack-exchange-dataset |
105,697 | Maximum subarray of bounded length | <p>I'm giving an array <span class="math-container">$A[0..n-1]$</span> and an integer <span class="math-container">$w$</span>. The goal is to find indices <span class="math-container">$i,j$</span> that maximize</p>

<p><span class="math-container">$$\Phi(i,j) = A[i] + A[i+1] + \dots + A[j-1],$$</span></p>
... | algorithms arrays maximum subarray | 1 | Maximum subarray of bounded length -- (algorithms arrays maximum subarray)
<p>I'm giving an array <span class="math-container">$A[0..n-1]$</span> and an integer <span class="math-container">$w$</span>. The goal is to find indices <span class="math-container">$i,j$</span> that maximize</p>

<p><span class="math... | habedi/stack-exchange-dataset |
105,699 | Reduction to a vertex cover problem-like with weighted vertices and edges | <h3>Description</h3>

<p>Let us define a new problem with an instance <span class="math-container">$I = (G = (V, E), K, L)$</span>, whereas:</p>

<ul>
<li><span class="math-container">$G$</span> is an undirected graph</li>
<li><span class="math-container">$K \le |V|$</span></li>
<li><span cl... | complexity theory graphs np complete np | 1 | Reduction to a vertex cover problem-like with weighted vertices and edges -- (complexity theory graphs np complete np)
<h3>Description</h3>

<p>Let us define a new problem with an instance <span class="math-container">$I = (G = (V, E), K, L)$</span>, whereas:</p>

<ul>
<li><span class="math-containe... | habedi/stack-exchange-dataset |
105,716 | What is the difference between Consensus and Leader Election problems? | <p>According to <a href="https://www.microsoft.com/en-us/research/uploads/prod/2004/01/twophase-revised.pdf" rel="nofollow noreferrer">this</a> paper written by Lamport, `<strong><em>selecting a unique leader is equivalent to solving the consensus problem'.</em></strong></p>

<p>Based on the above quote, <stron... | distributed systems parallel computing | 1 | What is the difference between Consensus and Leader Election problems? -- (distributed systems parallel computing)
<p>According to <a href="https://www.microsoft.com/en-us/research/uploads/prod/2004/01/twophase-revised.pdf" rel="nofollow noreferrer">this</a> paper written by Lamport, `<strong><em>selecting a unique lea... | habedi/stack-exchange-dataset |
105,717 | Virtual address translation | <p>I'm in an OS class now. I've been wrestling this problem for a while and can't convince myself of a solution. My professor is very busy and hasn't made time to help. Also, <strong>this question is from an example exam, not something I would be graded on.</strong></p>
<p>In this question, we're given a virtual ad... | virtual memory | 1 | Virtual address translation -- (virtual memory)
<p>I'm in an OS class now. I've been wrestling this problem for a while and can't convince myself of a solution. My professor is very busy and hasn't made time to help. Also, <strong>this question is from an example exam, not something I would be graded on.</strong></p>&#... | habedi/stack-exchange-dataset |
105,718 | An algorithm to maximize the number of parallel tasks | <p>I have a set of compute tasks I want to schedule, these tasks have dependencies and a task may not be executed until all its dependencies are executed.</p>

<p>The problem can be represented as a directed acyclic graph:</p>

<p><a href="https://i.stack.imgur.com/S3NFZ.png" rel="nofollow noreferrer"><... | graphs | 1 | An algorithm to maximize the number of parallel tasks -- (graphs)
<p>I have a set of compute tasks I want to schedule, these tasks have dependencies and a task may not be executed until all its dependencies are executed.</p>

<p>The problem can be represented as a directed acyclic graph:</p>

<p><a href... | habedi/stack-exchange-dataset |
105,722 | How do I prove that SPACE($n^{555}$) $\neq$ NP? | <p>I thought about finding a language with a polynomial verificator "larger" than <span class="math-container">$n^{555}$</span>, but then I realized it would not imply the space needed for computation is the size of the verificator. </p>
 | complexity theory space complexity | 1 | How do I prove that SPACE($n^{555}$) $\neq$ NP? -- (complexity theory space complexity)
<p>I thought about finding a language with a polynomial verificator "larger" than <span class="math-container">$n^{555}$</span>, but then I realized it would not imply the space needed for computation is the size of the verificator.... | habedi/stack-exchange-dataset |
105,727 | How does the bitlength of the divisor affect the running-time complexity of division algorithms? | <p><a href="https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations" rel="nofollow noreferrer">Wikipedia lists</a> <span class="math-container">$O(M(n))$</span> as the best complexity (out of the algorithms listed) for division on two <span class="math-container">$n$</span>-digit numbers, wher... | complexity theory time complexity arithmetic number theory | 1 | How does the bitlength of the divisor affect the running-time complexity of division algorithms? -- (complexity theory time complexity arithmetic number theory)
<p><a href="https://en.wikipedia.org/wiki/Computational_complexity_of_mathematical_operations" rel="nofollow noreferrer">Wikipedia lists</a> <span class="math-... | habedi/stack-exchange-dataset |
105,729 | Finding a negative cycle in a bipartite graph | <p>The <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="noreferrer">Bellman-Ford algorithm</a> can be used to find a negative cycle in a general graph, in time <span class="math-container">$O(|V||E|)$</span>. Is there a faster algorithm for finding a negative cycle in a bipartite directed gra... | algorithms graphs shortest path | 1 | Finding a negative cycle in a bipartite graph -- (algorithms graphs shortest path)
<p>The <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="noreferrer">Bellman-Ford algorithm</a> can be used to find a negative cycle in a general graph, in time <span class="math-container">$O(|V||E|)$</span>. I... | habedi/stack-exchange-dataset |
105,736 | Term for the tree of all paths starting from a given vertex in a graph | <p>What is the term for the tree (or a part of the tree) of all possible paths in a graph that start from a given (source) vertex?</p>

<p>This is the tree that is implicitly or explicitly constructed when doing shortest path search. It appears, for example, in a <a href="https://youtu.be/j1H3jAAGlEA?t=4m25s" ... | terminology trees search algorithms | 1 | Term for the tree of all paths starting from a given vertex in a graph -- (terminology trees search algorithms)
<p>What is the term for the tree (or a part of the tree) of all possible paths in a graph that start from a given (source) vertex?</p>

<p>This is the tree that is implicitly or explicitly constructed... | habedi/stack-exchange-dataset |
105,750 | Implementation-level of a Turing machine that accepts a specific language | <p>I'm trying to figure out a way to implement this kind of a Turing machine that accept the following language: </p>

<p><span class="math-container">$$\Sigma = \{ 0,1,2 \}, \quad\quad
L(A) = \{ abc \mid a=b \land c = a^R \}$$</span></p>

<p>I was thinking of a 3-tape Turing machine or using <span ... | turing machines | 1 | Implementation-level of a Turing machine that accepts a specific language -- (turing machines)
<p>I'm trying to figure out a way to implement this kind of a Turing machine that accept the following language: </p>

<p><span class="math-container">$$\Sigma = \{ 0,1,2 \}, \quad\quad
L(A) = \{ abc \mid a=b \lan... | habedi/stack-exchange-dataset |
105,752 | Variable Capturing With Repetition of Variable Name | <p>I am very confused as to which variables are captured by which λ in the example below:</p>

<pre><code>(λa.λb.(λa.a)aba)(ab)
</code></pre>

<p>I am new to lambda calculus and the repetition of variables makes this example hard for me to understand and reduce. Any help would be appreciated!</p>&#x... | lambda calculus | 1 | Variable Capturing With Repetition of Variable Name -- (lambda calculus)
<p>I am very confused as to which variables are captured by which λ in the example below:</p>

<pre><code>(λa.λb.(λa.a)aba)(ab)
</code></pre>

<p>I am new to lambda calculus and the repetition of variables makes this example ha... | habedi/stack-exchange-dataset |
105,755 | Polynomial Time reducible explanation | <p>Have a set of examples given to me, but I'm pretty sure they're all wrong. Can someone verify that my understanding of them is correct?</p>

<blockquote>
 <p>If set <span class="math-container">$Y$</span> can be solved in <span class="math-container">$O(2^n)$</span> and <span class="math-container">$Y \... | formal languages reductions polynomial time | 1 | Polynomial Time reducible explanation -- (formal languages reductions polynomial time)
<p>Have a set of examples given to me, but I'm pretty sure they're all wrong. Can someone verify that my understanding of them is correct?</p>

<blockquote>
 <p>If set <span class="math-container">$Y$</span> can be solve... | habedi/stack-exchange-dataset |
105,760 | What is a search problem? | <p>I'm looking for a formal and broad definition.</p>

<p>Intuitively, I would say that a problem where various checks have to be done is a search problem. Is this the only criteria? How can we know that a problem requires multiple checks?</p>

<p>Alternatively, I also think intuitively of problems with... | search algorithms search | 1 | What is a search problem? -- (search algorithms search)
<p>I'm looking for a formal and broad definition.</p>

<p>Intuitively, I would say that a problem where various checks have to be done is a search problem. Is this the only criteria? How can we know that a problem requires multiple checks?</p>

<p>... | habedi/stack-exchange-dataset |
105,763 | Enumerate over all halting Turing Machines? | <p>I understand that it is possible to enumerate over all Turing Machines. My understanding of how this works is by fixing an encoding of natural numbers to TM descriptions, and then enumerating the natural numbers and checking whether each number describes a syntactically well-defined TM.</p>

<p>I am wonderin... | turing machines halting problem enumeration | 1 | Enumerate over all halting Turing Machines? -- (turing machines halting problem enumeration)
<p>I understand that it is possible to enumerate over all Turing Machines. My understanding of how this works is by fixing an encoding of natural numbers to TM descriptions, and then enumerating the natural numbers and checking... | habedi/stack-exchange-dataset |
105,773 | Find a point shared by maximum segments | <p>Given: <span class="math-container">$N$</span> segments (arrays) of ordered integers, integers could be from <span class="math-container">$-K$</span> to <span class="math-container">$K$</span>.</p>

<p>Example:</p>

<pre><code>Segment 1: [-2,-1,0,1,2,3]
Segment 2: [1,2,3,4,5]
Segment 3: [-3,-... | algorithms time complexity arrays | 1 | Find a point shared by maximum segments -- (algorithms time complexity arrays)
<p>Given: <span class="math-container">$N$</span> segments (arrays) of ordered integers, integers could be from <span class="math-container">$-K$</span> to <span class="math-container">$K$</span>.</p>

<p>Example:</p>

<pre><... | habedi/stack-exchange-dataset |
105,792 | Show $\{1^n0^m |\space n \neq 2^m\}$ not regular using pumping lemma | <p>Showing that the language <span class="math-container">$L$</span> with <span class="math-container">$\{1^n0^m |\space n \neq 2^m\}$</span> is not regular using Myhill-Nerode is easy: Let <span class="math-container">$i, j\in \mathbb{N}.i\neq j.$</span> It follows <span class="math-container">$1^{2^i}\nsim 1^{2^j}$<... | regular languages | 1 | Show $\{1^n0^m |\space n \neq 2^m\}$ not regular using pumping lemma -- (regular languages)
<p>Showing that the language <span class="math-container">$L$</span> with <span class="math-container">$\{1^n0^m |\space n \neq 2^m\}$</span> is not regular using Myhill-Nerode is easy: Let <span class="math-container">$i, j\in... | habedi/stack-exchange-dataset |
105,796 | Solving a in/equality constraint problem with graph search | <p>You are given a list of m constraints over n distinct variables x1, ..., xn. Each constraint is of one of the following two types.</p>

<ol>
<li>An equality constraint of the form xi = xj for some i!=j.</li>
<li>An inequality constraint of the form xi!= xj for some i!=j.</li>
</ol>

<p>I ... | graphs graph traversal constraint satisfaction | 1 | Solving a in/equality constraint problem with graph search -- (graphs graph traversal constraint satisfaction)
<p>You are given a list of m constraints over n distinct variables x1, ..., xn. Each constraint is of one of the following two types.</p>

<ol>
<li>An equality constraint of the form xi = xj for so... | habedi/stack-exchange-dataset |
105,805 | Constructing a reduction between two languages about pairs of Turing machines | <p>I'm curious about a potential relation between the following two languages.</p>

<p><span class="math-container">$L_1 := \{\langle M_1, M_2 \rangle : L(M_1) \cap L(M_2) \ne \emptyset \}$</span>.</p>

<p><span class="math-container">$L_2 := \{\langle M_1, M_2 \rangle : L(M_1) \ne L(M_2) \}$</span>.</... | turing machines computability reductions | 1 | Constructing a reduction between two languages about pairs of Turing machines -- (turing machines computability reductions)
<p>I'm curious about a potential relation between the following two languages.</p>

<p><span class="math-container">$L_1 := \{\langle M_1, M_2 \rangle : L(M_1) \cap L(M_2) \ne \emptyset \}... | habedi/stack-exchange-dataset |
105,808 | Index matching algorithm without hash-based data structures? | <p>I am programming in C, so I do not want to implement a hash-based datastructure such as a hashset or hashmap/dictionary. However, I need to solve the following task in linear time.</p>

<p>Given two arrays <span class="math-container">$a$</span> and <span class="math-container">$b$</span> which contain the s... | search algorithms hash tables permutations | 1 | Index matching algorithm without hash-based data structures? -- (search algorithms hash tables permutations)
<p>I am programming in C, so I do not want to implement a hash-based datastructure such as a hashset or hashmap/dictionary. However, I need to solve the following task in linear time.</p>

<p>Given two a... | habedi/stack-exchange-dataset |
105,813 | How does a Turing machine compute when its head is at the right-hand end of its configuration? | <p>I'm reading Sipser's <em>Introduction to the Theory of Computation</em> (2nd ed.), and I am having trouble understanding one of the cases of Turing machine computation. Sipser describes the cases in terms of how one configuration yields another after a step of computation. For example, if the head is not at either e... | turing machines | 1 | How does a Turing machine compute when its head is at the right-hand end of its configuration? -- (turing machines)
<p>I'm reading Sipser's <em>Introduction to the Theory of Computation</em> (2nd ed.), and I am having trouble understanding one of the cases of Turing machine computation. Sipser describes the cases in te... | habedi/stack-exchange-dataset |
105,818 | NP-Completeness and commutative property | <p>If <span class="math-container">$X$</span> is NP-complete and for some <span class="math-container">$Y, X\leq_p Y$</span> and <span class="math-container">$Y\leq_p X$</span> what can we say about <span class="math-container">$Y$</span>?</p>

<p>My intuition says that this is only the case when <span class="m... | complexity theory np complete reductions | 1 | NP-Completeness and commutative property -- (complexity theory np complete reductions)
<p>If <span class="math-container">$X$</span> is NP-complete and for some <span class="math-container">$Y, X\leq_p Y$</span> and <span class="math-container">$Y\leq_p X$</span> what can we say about <span class="math-container">$Y$</... | habedi/stack-exchange-dataset |
105,826 | Asymptotic complexity of function with two Input variables | <p>Suppose I have a function with two input below.</p>

<p><span class="math-container">$f(m,n) = \log {n^m} + 100n \log \log {m^5} + 150m + 4n^2 + 1000$</span>.</p>

<p>Is it safe to say that <span class="math-container">$f(m,n)$</span> is <span class="math-container">$\mathcal{O}(m \log n)$</span>, or... | asymptotics | 1 | Asymptotic complexity of function with two Input variables -- (asymptotics)
<p>Suppose I have a function with two input below.</p>

<p><span class="math-container">$f(m,n) = \log {n^m} + 100n \log \log {m^5} + 150m + 4n^2 + 1000$</span>.</p>

<p>Is it safe to say that <span class="math-container">$f(m,n... | habedi/stack-exchange-dataset |
105,828 | Using Union find to check whether there is a cycle in a graph | <p>I'm trying to learn about DSU, and I came across a point stating if two vertices belong to the same sub-set, then a cycle exists. In terms of implementation of DSU, I'm unable to make sense of this. Could you share a proof or explain this? </p>
 | data structures union find | 1 | Using Union find to check whether there is a cycle in a graph -- (data structures union find)
<p>I'm trying to learn about DSU, and I came across a point stating if two vertices belong to the same sub-set, then a cycle exists. In terms of implementation of DSU, I'm unable to make sense of this. Could you share a proof ... | habedi/stack-exchange-dataset |
105,836 | Language involving irrational number is not a CFL | <p>I am working through a hard exercise in a textbook, and I just can't figure out how to proceed. Here is the problem. Suppose we have the language <span class="math-container">$L = \{a^ib^j: i \leq j \gamma, i\geq 0, j\geq 1\}$</span> where <span class="math-container">$\gamma$</span> is some irrational number. How w... | formal languages automata context free | 1 | Language involving irrational number is not a CFL -- (formal languages automata context free)
<p>I am working through a hard exercise in a textbook, and I just can't figure out how to proceed. Here is the problem. Suppose we have the language <span class="math-container">$L = \{a^ib^j: i \leq j \gamma, i\geq 0, j\geq 1... | habedi/stack-exchange-dataset |
105,844 | Mergable heap with no key knowledge cannot EXTRACT-MIN in $o(\log n)$ amortized time | <p>We are looking into Fibonacci heaps in class at the moment, but I am stuck with this problem. Let <span class="math-container">$H$</span> be a mergable heap structure, by which is meant a data structure, where each element has a key, and that supports the following five operations (taken from CLRS):</p>

<p>... | data structures runtime analysis heaps | 1 | Mergable heap with no key knowledge cannot EXTRACT-MIN in $o(\log n)$ amortized time -- (data structures runtime analysis heaps)
<p>We are looking into Fibonacci heaps in class at the moment, but I am stuck with this problem. Let <span class="math-container">$H$</span> be a mergable heap structure, by which is meant a ... | habedi/stack-exchange-dataset |
105,853 | Longest common sequence matrix giving wrong answer | <p>I am trying to find longest common sequence for these two strings</p>

<pre><code>SHINCHAN
NOHARAAA
</code></pre>

<p>The common sequence is <code>NHA</code> of length 3</p>

<p>But when I am trying to find out this through LCS matrix which I learnt from this link 
<a href="https:... | algorithms longest common substring | 1 | Longest common sequence matrix giving wrong answer -- (algorithms longest common substring)
<p>I am trying to find longest common sequence for these two strings</p>

<pre><code>SHINCHAN
NOHARAAA
</code></pre>

<p>The common sequence is <code>NHA</code> of length 3</p>

<p>But when I am t... | habedi/stack-exchange-dataset |
105,855 | checking whether a language is turing recognizable | <p>After reading about it in the textbook and in the web, i was wondering about the "turing recognizable" concept.</p>

<p>so for instance, if i take a simple language like:"L = {< M > | M ACCEPTS < M >}", then it should be a turing recognizable language since there can be a turing machine that halts and ... | complexity theory turing machines computability | 1 | checking whether a language is turing recognizable -- (complexity theory turing machines computability)
<p>After reading about it in the textbook and in the web, i was wondering about the "turing recognizable" concept.</p>

<p>so for instance, if i take a simple language like:"L = {< M > | M ACCEPTS < M >... | habedi/stack-exchange-dataset |
105,863 | What is wrong with this solution for $\mathcal{O}({\log({n \choose \frac{n}{2}})})$? | <p>In <a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/recitation-videos/recitation-1-asymptotic-complexity-peak-finding/" rel="nofollow noreferrer">this recitation</a> on MIT OCW, the instructor uses Stirling's approximation to calculate that</... | complexity theory asymptotics landau notation | 1 | What is wrong with this solution for $\mathcal{O}({\log({n \choose \frac{n}{2}})})$? -- (complexity theory asymptotics landau notation)
<p>In <a href="https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/recitation-videos/recitation-1-asymptotic-complexity-p... | habedi/stack-exchange-dataset |
105,867 | Time complexity of recurrence function with if statement | <p>Given the following code.</p>

<pre><code>public static int fc(int n, int p) {
 if (p == 0) {
 return 1;
 } if (p % 2 == 0) {
 int a = fc(n, p / 2);
 return a * a;
 } return n * fc(n, p - 1);
}
</code></pre>

<p>How to calculate the time c... | asymptotics | 1 | Time complexity of recurrence function with if statement -- (asymptotics)
<p>Given the following code.</p>

<pre><code>public static int fc(int n, int p) {
 if (p == 0) {
 return 1;
 } if (p % 2 == 0) {
 int a = fc(n, p / 2);
 return a * a;
 } return n * fc(... | habedi/stack-exchange-dataset |
105,870 | Overlaying Two Matrices So That Sum Of Squared Differences Is Minimized | <p>I have a question about my solution to a <a href="https://www.hackerrank.com/challenges/best-spot/problem" rel="nofollow noreferrer">problem</a> from Hackerrank. The problem is, given <span class="math-container">$R,C,H,W$</span> with</p>

<ul>
<li><span class="math-container">$1\le R,C\le 100$</span>,<... | algorithms algorithm analysis matrices | 1 | Overlaying Two Matrices So That Sum Of Squared Differences Is Minimized -- (algorithms algorithm analysis matrices)
<p>I have a question about my solution to a <a href="https://www.hackerrank.com/challenges/best-spot/problem" rel="nofollow noreferrer">problem</a> from Hackerrank. The problem is, given <span class="mat... | habedi/stack-exchange-dataset |
105,871 | AVL tree worst case height proof | <p>The worst case height of AVL tree is <span class="math-container">$1.44 \log n$</span>. How do we prove that?
I read somewhere about Fibonacci quicks but did not understand it.</p>
 | complexity theory binary trees balanced search trees avl trees | 1 | AVL tree worst case height proof -- (complexity theory binary trees balanced search trees avl trees)
<p>The worst case height of AVL tree is <span class="math-container">$1.44 \log n$</span>. How do we prove that?
I read somewhere about Fibonacci quicks but did not understand it.</p>
 | habedi/stack-exchange-dataset |
105,873 | How to prove that the time complexity of this algorithm is O($\sqrt{N}$)? | <pre><code> int n;
 cin >> n;
 int sum = 0;
 for (int i = 1; sum <= n; i++) {
 sum += i;
 }
</code></pre>

<p>If I assumed that <span class="math-container">$N = 100$</span>, the loop will run <span class="math-container">$13$</span> steps, which is almost the square r... | algorithms time complexity runtime analysis | 1 | How to prove that the time complexity of this algorithm is O($\sqrt{N}$)? -- (algorithms time complexity runtime analysis)
<pre><code> int n;
 cin >> n;
 int sum = 0;
 for (int i = 1; sum <= n; i++) {
 sum += i;
 }
</code></pre>

<p>If I assumed that <span class="math-... | habedi/stack-exchange-dataset |
105,876 | Context free grammar for L={ ((ab)^n)^m } | <p>I want to write a cfg for the following language:</p>

<p><span class="math-container">$ L = {((ab)^n)^m }$</span> <span class="math-container">$m,n >= 0$</span></p>

<p>this language produces (abababababab) where: <br /> <span class="math-container">$n=2, m=3 \\ or \\ n=3, m=2$</span><br /></p>&#... | formal languages context free formal grammars | 1 | Context free grammar for L={ ((ab)^n)^m } -- (formal languages context free formal grammars)
<p>I want to write a cfg for the following language:</p>

<p><span class="math-container">$ L = {((ab)^n)^m }$</span> <span class="math-container">$m,n >= 0$</span></p>

<p>this language produces (abababababa... | habedi/stack-exchange-dataset |
105,880 | Why do ¬, ∀ and ∃ have the same precedence? | <p>I thought the order of precedence of operators and quantifiers was arbitrary, but I don't really understand why those three have the same "strength" in relation to other operators (e.g., ¬ will have precedence over ∧, but not over ∀). This leads to the rule being that ¬, ∀ and ∃ will bind to the closest predicate on... | logic first order logic notation | 1 | Why do ¬, ∀ and ∃ have the same precedence? -- (logic first order logic notation)
<p>I thought the order of precedence of operators and quantifiers was arbitrary, but I don't really understand why those three have the same "strength" in relation to other operators (e.g., ¬ will have precedence over ∧, but not over ∀). ... | habedi/stack-exchange-dataset |
105,885 | Augmenting a tree such that we preserve the insertion operation optimal runtime | <p>Suppose we are given a red-black tree with <span class="math-container">$n$</span> vertices with distinct keys and we want to store, as addition information in each vertex <span class="math-container">$v$</span>, the biggest key out of the keys that are smaller than <span class="math-container">$v$</span> (or nothin... | data structures binary search trees red black trees | 1 | Augmenting a tree such that we preserve the insertion operation optimal runtime -- (data structures binary search trees red black trees)
<p>Suppose we are given a red-black tree with <span class="math-container">$n$</span> vertices with distinct keys and we want to store, as addition information in each vertex <span cl... | habedi/stack-exchange-dataset |
105,897 | Which algorithm can I use to allocate human resources? | <p>I have to manage shifts of a variable number of people inside several rooms for a week.<br>
Every shift must be at least 1h long and the number of hours per person for the week should be nearly the same for everyone.<br>
Every person could ask for specific shifts and this could be accepted if a suitable solu... | algorithms optimization | 1 | Which algorithm can I use to allocate human resources? -- (algorithms optimization)
<p>I have to manage shifts of a variable number of people inside several rooms for a week.<br>
Every shift must be at least 1h long and the number of hours per person for the week should be nearly the same for everyone.<br>
Ever... | habedi/stack-exchange-dataset |
105,898 | An algorithm that find the max X/Y in a polygon in O(log n) | <p>I got a task to create two functions one finds max <span class="math-container">$X$</span> and the other <span class="math-container">$Y$</span> in a polygon in <span class="math-container">$O(\log n)$</span>.</p>

<p>The polygon is represented by an array of its vertices where each vertex is represented by ... | algorithms complexity theory time complexity computational geometry binary search | 1 | An algorithm that find the max X/Y in a polygon in O(log n) -- (algorithms complexity theory time complexity computational geometry binary search)
<p>I got a task to create two functions one finds max <span class="math-container">$X$</span> and the other <span class="math-container">$Y$</span> in a polygon in <span cla... | habedi/stack-exchange-dataset |
105,899 | Why use heap over red-black tree? | <p>Heap supports insert operation in <span class="math-container">$O(\log n)$</span> time. And while heap supports remove min/max in <span class="math-container">$O(\log n)$</span> time, to remove any element (non min/max) heap takes <span class="math-container">$O(n)$</span> time.</p>

<p>However, red-black tr... | algorithms data structures heaps red black trees | 1 | Why use heap over red-black tree? -- (algorithms data structures heaps red black trees)
<p>Heap supports insert operation in <span class="math-container">$O(\log n)$</span> time. And while heap supports remove min/max in <span class="math-container">$O(\log n)$</span> time, to remove any element (non min/max) heap take... | habedi/stack-exchange-dataset |
105,900 | Two Minimax AIs playing against each other | <p>I am trying to have my Minimax AI chess players play against each other.</p>

<p>I was a bit confused about an implementation detail.</p>

<p>Let's call <code>black</code> my first minimax AI chess player that plays first.</p>

<p><code>white</code> is the other minimax AI that goes second.</... | search algorithms artificial intelligence search trees game theory board games | 1 | Two Minimax AIs playing against each other -- (search algorithms artificial intelligence search trees game theory board games)
<p>I am trying to have my Minimax AI chess players play against each other.</p>

<p>I was a bit confused about an implementation detail.</p>

<p>Let's call <code>black</code> my... | habedi/stack-exchange-dataset |
105,910 | What's the difference between: operational, denotational and axiomatic semantics? | <p>Recap of the terms from the dictionary:</p>

<ul>
<li><strong>semantics</strong>: the study of meaning in a language (words, phrases, etc) and of language constructs in programming languages (basically any syntactically valid part of a program that generates an instruction or a sequence of instructions t... | semantics operational semantics denotational semantics | 1 | What's the difference between: operational, denotational and axiomatic semantics? -- (semantics operational semantics denotational semantics)
<p>Recap of the terms from the dictionary:</p>

<ul>
<li><strong>semantics</strong>: the study of meaning in a language (words, phrases, etc) and of language construc... | habedi/stack-exchange-dataset |
105,911 | Word Problem over Finite Groupoids | <p>I'm struggling with an interesting problem from a chapter about Dynamic Programming in Skienas' famous "The Algorithm Design Manual". 
It's listed on the following web-page under number 8-22: <a href="http://www.algorist.com/algowiki/index.php/Divide-TADM2E#8-22" rel="noreferrer">http://www.algorist.com/algowiki... | algorithms dynamic programming search algorithms word combinatorics | 1 | Word Problem over Finite Groupoids -- (algorithms dynamic programming search algorithms word combinatorics)
<p>I'm struggling with an interesting problem from a chapter about Dynamic Programming in Skienas' famous "The Algorithm Design Manual". 
It's listed on the following web-page under number 8-22: <a href="http... | habedi/stack-exchange-dataset |
105,915 | Can this equation be solved in polynomial time? | <p>I came across a more general form of <a href="https://cs.stackexchange.com/q/105572/101646">this</a> question. </p>

<p>Can we find the value of variables in <strong>polynomial time</strong> ?</p>

<p>Let <span class="math-container">$m = n^{2}$</span>, there are <strong><span class="math-container">... | algorithms time complexity linear algebra mathematical programming | 1 | Can this equation be solved in polynomial time? -- (algorithms time complexity linear algebra mathematical programming)
<p>I came across a more general form of <a href="https://cs.stackexchange.com/q/105572/101646">this</a> question. </p>

<p>Can we find the value of variables in <strong>polynomial time</strong... | habedi/stack-exchange-dataset |
105,923 | How does a computer interpret real numbers? | <p>I understand that the modern day digital computer works on the binary number system. I can also get, that the binary representation can be converted to <em>rational</em> numbers. </p>

<p>But I want to know how does the present day computational model interpret <em>real</em> numbers. </p>

<p><strong... | mathematical programming mathematical foundations | 1 | How does a computer interpret real numbers? -- (mathematical programming mathematical foundations)
<p>I understand that the modern day digital computer works on the binary number system. I can also get, that the binary representation can be converted to <em>rational</em> numbers. </p>

<p>But I want to know how... | habedi/stack-exchange-dataset |
105,932 | Does the Kleene star distribute over each element? (0+1)* = 0* + 1*? | <p>Does the Kleene star distribute over each element? Is this true: <span class="math-container">$(0+1)^* = (0^* + 1^*)$</span>?</p>
 | regular languages regular expressions discrete mathematics | 1 | Does the Kleene star distribute over each element? (0+1)* = 0* + 1*? -- (regular languages regular expressions discrete mathematics)
<p>Does the Kleene star distribute over each element? Is this true: <span class="math-container">$(0+1)^* = (0^* + 1^*)$</span>?</p>
 | habedi/stack-exchange-dataset |
105,933 | How to do if a potential function Does not work? Amortized analysis | <p>Here is an example taken from CLRS. </p>

<p>q)Consider an ordinary binary min-heap data structure with n elements supporting the instructions INSERT and EXTRACT-MIN in O(lg n) worst-case time. Give a potential function Φ such that the amortized cost of INSERT is O(lg n) and the amortized cost of EXTRACT-MIN... | amortized analysis | 1 | How to do if a potential function Does not work? Amortized analysis -- (amortized analysis)
<p>Here is an example taken from CLRS. </p>

<p>q)Consider an ordinary binary min-heap data structure with n elements supporting the instructions INSERT and EXTRACT-MIN in O(lg n) worst-case time. Give a potential functi... | habedi/stack-exchange-dataset |
105,935 | general question amortized cost and worst case | <p>lets say a data structure has operations called insert and delete both of which take O(log(n)) worst case. Suppose the amortized cost of insert is O(log(n)) and the amortized cost of delete is O(1). </p>

<p>Now if a sequence that has n delete operations performed on this data structure that has n elements ... | algorithm analysis data structures amortized analysis | 1 | general question amortized cost and worst case -- (algorithm analysis data structures amortized analysis)
<p>lets say a data structure has operations called insert and delete both of which take O(log(n)) worst case. Suppose the amortized cost of insert is O(log(n)) and the amortized cost of delete is O(1). </p>
&#x... | habedi/stack-exchange-dataset |
105,939 | Floyd–Warshall algorithm on an undirected graph contains negative weight edges | <p>According to <a href="https://stackoverflow.com/a/14804529/6784796">this</a> answer, the Bellman-Ford algorithm doesn't work when an undirected graph contains negative weight edges since any edge with negative weight forms a negative cycle, and the distances to all vertices in a negative cycle, as well as the distan... | algorithms graphs shortest path | 1 | Floyd–Warshall algorithm on an undirected graph contains negative weight edges -- (algorithms graphs shortest path)
<p>According to <a href="https://stackoverflow.com/a/14804529/6784796">this</a> answer, the Bellman-Ford algorithm doesn't work when an undirected graph contains negative weight edges since any edge with ... | habedi/stack-exchange-dataset |
105,941 | Why $\phi$ $\cdot$ R = $\phi$, rather than $\phi$ $\cdot$ R = R in Automata? | <p>I understand that <span class="math-container">$\phi$</span> is a null symbol.<br>
why concatenation of any language L with <span class="math-container">$\phi$</span> is <span class="math-container">$\phi$</span> rather than L ? </p>
 | formal languages automata formal grammars | 1 | Why $\phi$ $\cdot$ R = $\phi$, rather than $\phi$ $\cdot$ R = R in Automata? -- (formal languages automata formal grammars)
<p>I understand that <span class="math-container">$\phi$</span> is a null symbol.<br>
why concatenation of any language L with <span class="math-container">$\phi$</span> is <span class="math-c... | habedi/stack-exchange-dataset |
105,948 | Check if a lambda constructor is well-typed | <p>In basic type inference for -calculus with parametric polymorphism à la Hindley–Milner, 
when can we say that we cannot give a type to a lambda constructor? 
For example 
<span class="math-container">$$(λx.λy.y(x\ y))(λz.z)$$</span></p>
 | lambda calculus type checking type inference | 1 | Check if a lambda constructor is well-typed -- (lambda calculus type checking type inference)
<p>In basic type inference for -calculus with parametric polymorphism à la Hindley–Milner, 
when can we say that we cannot give a type to a lambda constructor? 
For example 
<span class="math-container... | habedi/stack-exchange-dataset |
105,949 | L1 and Ln cache: when are they written? | <p>I have been following the "<a href="https://eu.udacity.com/course/high-performance-computer-architecture--ud007" rel="nofollow noreferrer">High Performance Computer Architecture</a>" course from Georgia Tech (also on YouTube), and unless I've missed something, I cannot see where the following has been explained:</p>... | cpu cache | 1 | L1 and Ln cache: when are they written? -- (cpu cache)
<p>I have been following the "<a href="https://eu.udacity.com/course/high-performance-computer-architecture--ud007" rel="nofollow noreferrer">High Performance Computer Architecture</a>" course from Georgia Tech (also on YouTube), and unless I've missed something, I... | habedi/stack-exchange-dataset |
105,953 | Term for an A*-like pathfinding strategy where only the heuristic goal distance matters | <p>I am trying to find a proper term for the <a href="https://en.wikipedia.org/wiki/A*_search_algorithm" rel="nofollow noreferrer">A*</a>-like best-first pathfinding strategy where the node to expand next is the one with the least estimated distance from the goal, regardless of its distance from the source.</p>
&#x... | terminology shortest path graph traversal heuristics a star search | 1 | Term for an A*-like pathfinding strategy where only the heuristic goal distance matters -- (terminology shortest path graph traversal heuristics a star search)
<p>I am trying to find a proper term for the <a href="https://en.wikipedia.org/wiki/A*_search_algorithm" rel="nofollow noreferrer">A*</a>-like best-first pathfi... | habedi/stack-exchange-dataset |
105,959 | Regular expressions for some languages | <ol>
<li>Set of strings over <span class="math-container">$\{0,1\}$</span> having at least two occurrence of the substring 00. </li>
<li><span class="math-container">$\{a^n b^m : n ≥ 4, m ≥ 3\}$</span>.</li>
<li>Set of strings over the alphabet <span class="math-container">$\{a,b,c\}$</span> containing at l... | automata regular expressions | 1 | Regular expressions for some languages -- (automata regular expressions)
<ol>
<li>Set of strings over <span class="math-container">$\{0,1\}$</span> having at least two occurrence of the substring 00. </li>
<li><span class="math-container">$\{a^n b^m : n ≥ 4, m ≥ 3\}$</span>.</li>
<li>Set of strings over the... | habedi/stack-exchange-dataset |
105,969 | Longest common substring in linear time | <p>We know that the longest common substring of two strings can be found in <span class="math-container">$\mathcal O(N^2)$</span> time complexity.
Can a solution be found in only linear time?</p>
 | algorithms time complexity strings longest common substring | 1 | Longest common substring in linear time -- (algorithms time complexity strings longest common substring)
<p>We know that the longest common substring of two strings can be found in <span class="math-container">$\mathcal O(N^2)$</span> time complexity.
Can a solution be found in only linear time?</p>
 | habedi/stack-exchange-dataset |
105,976 | Reasons for choosing register number and address sizes in an Instruction Set | <p>Why would it be suitable to design an instruction set with 2-bits allocated for the register number and 10-bits allocated for the memory address? Would introducing a cache change this? (If possible I'd like to know why or where to find an explanation on this.)</p>

<p>If it helps an example would look like ... | computer architecture | 1 | Reasons for choosing register number and address sizes in an Instruction Set -- (computer architecture)
<p>Why would it be suitable to design an instruction set with 2-bits allocated for the register number and 10-bits allocated for the memory address? Would introducing a cache change this? (If possible I'd like to kn... | habedi/stack-exchange-dataset |
105,977 | CFG for the language {ω ∈ {a, b}*| in every prefix of ω, the number of a’s is greater than or equal to number of b’s} | <p>I know the answer which is:</p>

<p><span class="math-container">\begin{align}
S &\rightarrow aS \mid T\\
T &\rightarrow aTbT\ \mid \varepsilon
\end{align}</span></p>

<p>Now, <span class="math-container">$bbaaa$</span> is in the language. But the given CFG cannot generate it. Is ... | formal languages formal grammars | 1 | CFG for the language {ω ∈ {a, b}*| in every prefix of ω, the number of a’s is greater than or equal to number of b’s} -- (formal languages formal grammars)
<p>I know the answer which is:</p>

<p><span class="math-container">\begin{align}
S &\rightarrow aS \mid T\\
T &\rightarrow aTbT\ \mid \vare... | habedi/stack-exchange-dataset |
105,981 | Proving Big Omega of a polynomial without limits | <p>Here is the definition of <span class="math-container">$\Omega$</span>:</p>

<blockquote>
 <p><span class="math-container">$f(n) = Ω(g(n))$</span> iff there exist positive constants <span class="math-container">$c$</span> and <span class="math-container">$n_0$</span> such that <span class="math-containe... | asymptotics landau notation | 1 | Proving Big Omega of a polynomial without limits -- (asymptotics landau notation)
<p>Here is the definition of <span class="math-container">$\Omega$</span>:</p>

<blockquote>
 <p><span class="math-container">$f(n) = Ω(g(n))$</span> iff there exist positive constants <span class="math-container">$c$</span> ... | habedi/stack-exchange-dataset |
105,982 | How good (or bad) is my makeshift PRNG? | <p>Say I have designed a makeshift PRNG for my personal amusement, now I would like to see how good it is. How do I benchmark its "randomness"? Ideally, I want to know a statistics test, such that if I pass it (or get a high score) I can write up a paper to announce a new state-of-the-art PRNG to the world. Yeah I know... | algorithms algorithm analysis randomness statistics pseudo random generators | 1 | How good (or bad) is my makeshift PRNG? -- (algorithms algorithm analysis randomness statistics pseudo random generators)
<p>Say I have designed a makeshift PRNG for my personal amusement, now I would like to see how good it is. How do I benchmark its "randomness"? Ideally, I want to know a statistics test, such that i... | habedi/stack-exchange-dataset |
105,984 | Is there an efficient solution to the travelling salesman problem with binary edge weights? | <p>Is there a way to solve TSP in polynomial time if there are only two kinds of weights, 0 and 1?</p>
 | traveling salesman | 1 | Is there an efficient solution to the travelling salesman problem with binary edge weights? -- (traveling salesman)
<p>Is there a way to solve TSP in polynomial time if there are only two kinds of weights, 0 and 1?</p>
 | habedi/stack-exchange-dataset |
105,988 | How to model references in an ontology | <p>I am interested in creating an ontology which will model arguments (among other things). For example, a triple in the ontology might be</p>

<p><code>Vaccination -> can lead to -> Autism</code></p>

<p>(not that I necessarily believe this, just a good example of an argument).
I would like t... | graphs database theory modelling ontologies | 1 | How to model references in an ontology -- (graphs database theory modelling ontologies)
<p>I am interested in creating an ontology which will model arguments (among other things). For example, a triple in the ontology might be</p>

<p><code>Vaccination -> can lead to -> Autism</code></p>

<p>(not ... | habedi/stack-exchange-dataset |
105,989 | invariant of bin packing | <p>We are given an array of integers and a number K. We need to pack these integers into bins. The condition is that we have to use exactly K number of bins and each bin should have equal capacity. We need to find the size of bin such that wastage of unused bin is minimized.</p>

<p>Is this problem polynomial t... | algorithms dynamic programming combinatorics approximation subset sum | 1 | invariant of bin packing -- (algorithms dynamic programming combinatorics approximation subset sum)
<p>We are given an array of integers and a number K. We need to pack these integers into bins. The condition is that we have to use exactly K number of bins and each bin should have equal capacity. We need to find the si... | habedi/stack-exchange-dataset |
105,992 | Partition array into k subsets | <p>We are given an array and a number K. Partition array into K subsets such that </p>

<p>let MaxSum be the maximum sum of among subsets.</p>

<p>We have to minimize summation =<span class="math-container">$$\sum_{i=1}^{k}MaxSum-sum(i) $$</span></p>

<p>Is this problem polynimial time solvable?... | algorithms time complexity arrays partitions subset sum | 1 | Partition array into k subsets -- (algorithms time complexity arrays partitions subset sum)
<p>We are given an array and a number K. Partition array into K subsets such that </p>

<p>let MaxSum be the maximum sum of among subsets.</p>

<p>We have to minimize summation =<span class="math-container">$$\su... | habedi/stack-exchange-dataset |
106,001 | Turing machine accepts any word | <blockquote>
 <p>Let M be a Turing-machine with tape alphabet = {0, 1} that does not
 move beyond the first 64 cells of its tape. Is the problem "Does M
 accept any word?" decidable?</p>
</blockquote>

<ol>
<li>I would say it does not accept any word because we can have words longer than ... | turing machines | 1 | Turing machine accepts any word -- (turing machines)
<blockquote>
 <p>Let M be a Turing-machine with tape alphabet = {0, 1} that does not
 move beyond the first 64 cells of its tape. Is the problem "Does M
 accept any word?" decidable?</p>
</blockquote>

<ol>
<li>I would say it does not a... | habedi/stack-exchange-dataset |
106,018 | Simulating a probability of 1 of 2^N with less than N random bits | <p>Say I need to simulate the following discrete distribution:</p>

<p><span class="math-container">$$
 P(X = k) =
\begin{cases}
\frac{1}{2^N}, & \text{if $k = 1$} \\
1 - \frac{1}{2^N}, & \text{if $k = 0$}
\end{cases}
$$</span></p>

<p>The most obvious way is to draw <sp... | algorithms information theory randomness pseudo random generators entropy | 1 | Simulating a probability of 1 of 2^N with less than N random bits -- (algorithms information theory randomness pseudo random generators entropy)
<p>Say I need to simulate the following discrete distribution:</p>

<p><span class="math-container">$$
 P(X = k) =
\begin{cases}
\frac{1}{2^N}, & \tex... | habedi/stack-exchange-dataset |
106,019 | Why is this a proof by contradiction for this algorithm? Isn't this a direct proof instead? | <p><strong>First Slide: Find Max(A)</strong></p>
<ol>
<li>// INPUT: A[1..n] - an array of integers</li>
<li>// OUTPUT: an element m of A such that m >= A[j], for all 1 <= j <= A.length</li>
<li>max = A[j==1]</li>
<li>for j = 2 to A.length</li>
<li>if max < A[j]</li>
<li>max = A[j... | algorithms correctness proof check my answer | 1 | Why is this a proof by contradiction for this algorithm? Isn't this a direct proof instead? -- (algorithms correctness proof check my answer)
<p><strong>First Slide: Find Max(A)</strong></p>
<ol>
<li>// INPUT: A[1..n] - an array of integers</li>
<li>// OUTPUT: an element m of A such that m >= A[j], for a... | habedi/stack-exchange-dataset |
106,020 | I don't understand what this regular language is asking for? Find a grammar for L(G) = {w || w | is odd,∑ = (0, 1) } | <p>I don't understand what this regular language is asking for? Find a grammar for L(G) = {w || w | is odd,∑ = (0, 1) }. What does the " || " mean I know a single " | " means or.</p>
 | regular languages formal grammars regular expressions discrete mathematics | 1 | I don't understand what this regular language is asking for? Find a grammar for L(G) = {w || w | is odd,∑ = (0, 1) } -- (regular languages formal grammars regular expressions discrete mathematics)
<p>I don't understand what this regular language is asking for? Find a grammar for L(G) = {w || w | is odd,∑ = (0, 1) }. Wh... | habedi/stack-exchange-dataset |
106,025 | How do you marginalize in graphical model elimination? | <p>I'm reading Michael I. Jordan's book on probabilistic graphical models, and I don't understand the elimination algorithm presented in chapter 3. To narrow the question down, consider <a href="https://people.eecs.berkeley.edu/~jordan/prelims/chapter3.pdf#page=6" rel="nofollow noreferrer">page 6</a>. In equation (3.10... | probability theory graphical models | 1 | How do you marginalize in graphical model elimination? -- (probability theory graphical models)
<p>I'm reading Michael I. Jordan's book on probabilistic graphical models, and I don't understand the elimination algorithm presented in chapter 3. To narrow the question down, consider <a href="https://people.eecs.berkeley.... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.