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 |
|---|---|---|---|---|---|---|
65,694 | Assignment algorithm for symmetric matrices | <p>I stumbled on the <a href="https://en.wikipedia.org/wiki/Hungarian_algorithm" rel="nofollow noreferrer">Hungarian algorithm</a> during my personal research when I was assigned interesting problem as homework:</p>

<p>Given a list of objects $L$ and a pairing function $\delta : L \times L \rightarrow \left[0,... | graphs optimization matching | 1 | Assignment algorithm for symmetric matrices -- (graphs optimization matching)
<p>I stumbled on the <a href="https://en.wikipedia.org/wiki/Hungarian_algorithm" rel="nofollow noreferrer">Hungarian algorithm</a> during my personal research when I was assigned interesting problem as homework:</p>

<p>Given a list o... | habedi/stack-exchange-dataset |
65,695 | Generate collision resistant identifiers with two-way hashing | <p><em>Objective:</em> We want to generate a unique and reproducible identifier for a given slice of bytes and avoid collisions.</p>

<p><em>High-level idea:</em> Compute $$fK := hash(k_1)\; and\; sK := hash(k_1^{-1})\; where\; k_i^{-1}\; is\; the\; reversed\; bitstring\; k_i$$</p>

<p>We then proceed t... | strings correctness proof hash tables hashing | 1 | Generate collision resistant identifiers with two-way hashing -- (strings correctness proof hash tables hashing)
<p><em>Objective:</em> We want to generate a unique and reproducible identifier for a given slice of bytes and avoid collisions.</p>

<p><em>High-level idea:</em> Compute $$fK := hash(k_1)\; and\; sK... | habedi/stack-exchange-dataset |
65,703 | Inequality caused by float inaccuracy | <p>At least in Java, if I write this code:</p>



<pre class="lang-java prettyprint-override"><code>float a = 1000.0F;
float b = 0.00004F;
float c = a + b + b;
float d = b + b + a;
boolean e = c == d;
</code></pre>

<p>the value of $e$ would be $false$. I believe this is caus... | arithmetic floating point numerical algorithms | 1 | Inequality caused by float inaccuracy -- (arithmetic floating point numerical algorithms)
<p>At least in Java, if I write this code:</p>



<pre class="lang-java prettyprint-override"><code>float a = 1000.0F;
float b = 0.00004F;
float c = a + b + b;
float d = b + b + a;
boolean e = c == ... | habedi/stack-exchange-dataset |
65,708 | Why there are no approximation algorithms for SAT and other decision problems? | <p>I have an NP-complete decision problem. Given an instance of the problem, I would like to design an algorithm that outputs YES, if the problem is feasible, and, NO, otherwise. (Of course, if the algorithm is not optimal, it will make errors.)</p>

<p>I cannot find any approximation algorithms for such proble... | algorithms satisfiability approximation decision problem | 1 | Why there are no approximation algorithms for SAT and other decision problems? -- (algorithms satisfiability approximation decision problem)
<p>I have an NP-complete decision problem. Given an instance of the problem, I would like to design an algorithm that outputs YES, if the problem is feasible, and, NO, otherwise. ... | habedi/stack-exchange-dataset |
65,715 | How to Define an Efficient, Optimal or Suboptimal Parallel Algorithm? | <p>I am going through the book of Parallel Programming and a parallel algorithm is often classified as <em>Efficient</em>, <em>Optimal</em> or <em>Suboptimal</em>. I googled these terms but I didn't found a clear definition for them.</p>

<p>Define $T(n)$ as the running time of the sequential algorithm, $t(n)$ ... | asymptotics parallel computing | 1 | How to Define an Efficient, Optimal or Suboptimal Parallel Algorithm? -- (asymptotics parallel computing)
<p>I am going through the book of Parallel Programming and a parallel algorithm is often classified as <em>Efficient</em>, <em>Optimal</em> or <em>Suboptimal</em>. I googled these terms but I didn't found a clear d... | habedi/stack-exchange-dataset |
65,721 | why nominal unification is a first-order unification? | <p>In my understanding, if a unification solves equations of terms that are not higher-order terms, then it is a first-order unification.</p>

<p>If a unification solves equations of terms that are higher-order terms, then it is a higher-order unification. Therefore a unification solves equations of $\lambda$-t... | lambda calculus unification | 1 | why nominal unification is a first-order unification? -- (lambda calculus unification)
<p>In my understanding, if a unification solves equations of terms that are not higher-order terms, then it is a first-order unification.</p>

<p>If a unification solves equations of terms that are higher-order terms, then it... | habedi/stack-exchange-dataset |
65,729 | Expected distance between tree nodes | <p>I have been given a tree with n nodes and n-1 edges with it's weight.
There are two people A and B.
I have been given a list of nodes of size k.</p>

<p>A will pick a random node x from this list and B will independently pick a random node y from this list.</p>

<p>I have to find expected dis... | algorithms graphs trees | 1 | Expected distance between tree nodes -- (algorithms graphs trees)
<p>I have been given a tree with n nodes and n-1 edges with it's weight.
There are two people A and B.
I have been given a list of nodes of size k.</p>

<p>A will pick a random node x from this list and B will independently pick a random ... | habedi/stack-exchange-dataset |
65,738 | Finding the language of a context-free grammar? | <p>Given following question:</p>

<p>Let $G$ be a context-free grammar, $G=(V, \Sigma, R, S)$, that has start
variable $S$, set of variables $V = \{S\}$, set of terminals $\Sigma = \{0, 1\}$, and set of rules $R = \{S \rightarrow \epsilon , S \rightarrow 0 , S \rightarrow 1 , S → 0S0 , S \rightarrow 1S1\}$.... | formal languages context free formal grammars notation | 1 | Finding the language of a context-free grammar? -- (formal languages context free formal grammars notation)
<p>Given following question:</p>

<p>Let $G$ be a context-free grammar, $G=(V, \Sigma, R, S)$, that has start
variable $S$, set of variables $V = \{S\}$, set of terminals $\Sigma = \{0, 1\}$, and set ... | habedi/stack-exchange-dataset |
65,743 | How many bits for offset/frame/page | <p>I'm working on the following exercise and can't get the calculations right:</p>

<p>Assume an OS uses:</p>

<ul>
<li>33 bits for physical address</li>
<li>34 bits for logical address</li>
<li>2KB frame size</li>
</ul>

<p>Calculate:</p>

<ul>
<li>How many bits are ... | operating systems virtual memory | 1 | How many bits for offset/frame/page -- (operating systems virtual memory)
<p>I'm working on the following exercise and can't get the calculations right:</p>

<p>Assume an OS uses:</p>

<ul>
<li>33 bits for physical address</li>
<li>34 bits for logical address</li>
<li>2KB frame size</li>
... | habedi/stack-exchange-dataset |
65,746 | Why aren't existential types implemented in any mainstream language? | <p>I'm talking about first-order existential types, as summarized <a href="https://en.wikipedia.org/wiki/Type_system#Existential_types" rel="nofollow noreferrer">here</a>, with <code>pack</code> as the introduction form that bundles up a type with an expression of that type, and <code>open</code> as the elimination for... | programming languages type theory | 1 | Why aren't existential types implemented in any mainstream language? -- (programming languages type theory)
<p>I'm talking about first-order existential types, as summarized <a href="https://en.wikipedia.org/wiki/Type_system#Existential_types" rel="nofollow noreferrer">here</a>, with <code>pack</code> as the introducti... | habedi/stack-exchange-dataset |
65,747 | How are faces of a DCEL updated when triangulating a polygon? | <p>In chapter 3 <a href="https://books.google.co.uk/books?id=tkyG8W2163YC&pg=PA45&dq=computational%20geometry%20algorithms%20and%20applications&hl=it&sa=X&ved=0ahUKEwjLxpqh15nQAhVCAsAKHTokDucQ6AEIGzAA#v=onepage&q=computational%20geometry%20algorithms%20and%20applications&f=false" rel="nofoll... | algorithms data structures computational geometry | 1 | How are faces of a DCEL updated when triangulating a polygon? -- (algorithms data structures computational geometry)
<p>In chapter 3 <a href="https://books.google.co.uk/books?id=tkyG8W2163YC&pg=PA45&dq=computational%20geometry%20algorithms%20and%20applications&hl=it&sa=X&ved=0ahUKEwjLxpqh15nQAhVCAsA... | habedi/stack-exchange-dataset |
65,749 | Is the MinMax/optimization/search variant of a decision problem always easier/equal? | <p>Is the MinMax/optimization/search variant of a decision problem always easier/equal in complexity because we can always reduce them to their decision variant?</p>

<p>From Wikipedia:</p>

<blockquote>
 <p>If the longest path problem could be solved in polynomial time, it could be used to solve t... | complexity theory np complete np hard decision problem polynomial time | 1 | Is the MinMax/optimization/search variant of a decision problem always easier/equal? -- (complexity theory np complete np hard decision problem polynomial time)
<p>Is the MinMax/optimization/search variant of a decision problem always easier/equal in complexity because we can always reduce them to their decision varian... | habedi/stack-exchange-dataset |
65,756 | Understanding Amdahl's Law calculation | <p>I have a homework problem: Calculate the overall speedup of a system that spends 40% of its time in calculations with a processor upgrade that provides for 100% greater throughput.</p>

<p>Which is a pretty straightforward calculation with Amdahl's Law</p>

<p>$S = \frac{1}{(1-f)+(\frac{f}{k})} $</p... | performance program optimization | 1 | Understanding Amdahl's Law calculation -- (performance program optimization)
<p>I have a homework problem: Calculate the overall speedup of a system that spends 40% of its time in calculations with a processor upgrade that provides for 100% greater throughput.</p>

<p>Which is a pretty straightforward calculati... | habedi/stack-exchange-dataset |
65,758 | Combinatorics approach to staircase problem | <p>There are $n$ stairs and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs every time. What is the total number of ways they can reach the top?</p>

<p>There are many ways to do this by using code. But when I first read this problem was to use a combinato... | algorithms combinatorics | 1 | Combinatorics approach to staircase problem -- (algorithms combinatorics)
<p>There are $n$ stairs and a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs every time. What is the total number of ways they can reach the top?</p>

<p>There are many ways to do thi... | habedi/stack-exchange-dataset |
65,765 | Can a purely declarative language really exist? | <p>Wikipedia has several languages listed as declarative languages. One of these languages listed is XSLT, which is a language for applying transformations to XML.</p>

<p><a href="https://en.wikipedia.org/wiki/XSLT" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/XSLT</a></p>

<p>As I understa... | programming languages programming paradigms | 1 | Can a purely declarative language really exist? -- (programming languages programming paradigms)
<p>Wikipedia has several languages listed as declarative languages. One of these languages listed is XSLT, which is a language for applying transformations to XML.</p>

<p><a href="https://en.wikipedia.org/wiki/XSL... | habedi/stack-exchange-dataset |
65,781 | Mealy to Moore Conversion | <p>Consider an $m$ output, $n$ state Mealy machine. How many states does the equivalent Moore machine contain?</p>

<p>The answer is $mn$ but my argument is that the total number of output produced while reading a string of length $n$ ($n$ states) Mealy will produce $m$ outputs ($m$ transitions) but a Moore mac... | automata finite automata simulation | 1 | Mealy to Moore Conversion -- (automata finite automata simulation)
<p>Consider an $m$ output, $n$ state Mealy machine. How many states does the equivalent Moore machine contain?</p>

<p>The answer is $mn$ but my argument is that the total number of output produced while reading a string of length $n$ ($n$ state... | habedi/stack-exchange-dataset |
65,795 | Doubts abouts join implementation | <p>I'm studying advanced database and I can not understand some concepts related to the join.
I hope I'm in the right place to post my doubts, otherwise I'm sorry.</p>

<p>I realized that to make the equijoin there are several families. 
In particular, the family that is based on the Cartesian product i... | database theory | 1 | Doubts abouts join implementation -- (database theory)
<p>I'm studying advanced database and I can not understand some concepts related to the join.
I hope I'm in the right place to post my doubts, otherwise I'm sorry.</p>

<p>I realized that to make the equijoin there are several families. 
In particul... | habedi/stack-exchange-dataset |
65,798 | Complement of CFL is Recursive | <p>If CFL are not closed under complementation, it means that if a language '$L$' is CFL then its compliment $L^C$ is not CFL. Then how can we discuss about $L^C$ being recursive?</p>

<p>My doubt arose because I think if a language cannot be decided CFL or not then how can it be declared Recursive ?</p>
 | context free | 1 | Complement of CFL is Recursive -- (context free)
<p>If CFL are not closed under complementation, it means that if a language '$L$' is CFL then its compliment $L^C$ is not CFL. Then how can we discuss about $L^C$ being recursive?</p>

<p>My doubt arose because I think if a language cannot be decided CFL or not t... | habedi/stack-exchange-dataset |
65,822 | Introductory Book on Pseudo-Random Number Generation | <p>I'm a rank amateur in the area of pseudo-random number generation. I've recently found out that certain generators are better than others (e.g. mt19337 vs rand in C++) and learned what modulo bias is.</p>

<p><strong>My Request</strong></p>

<p>I'm looking for an introductory book on pseudo-random nu... | books pseudo random generators | 1 | Introductory Book on Pseudo-Random Number Generation -- (books pseudo random generators)
<p>I'm a rank amateur in the area of pseudo-random number generation. I've recently found out that certain generators are better than others (e.g. mt19337 vs rand in C++) and learned what modulo bias is.</p>

<p><strong>My ... | habedi/stack-exchange-dataset |
65,827 | How can unifying 2 sentences in first-order logic result in a variable becoming 2 different things? | <p>I'm working on a program which must use inference in first-order logic, and everything is working great except for 1 thing which I don't understand.</p>

<p>The book I'm using, "Artificial Intelligence A Modern Approach" by Russell and Norvig, shows a proof on page 349 which has me confused.
They combine... | first order logic unification | 1 | How can unifying 2 sentences in first-order logic result in a variable becoming 2 different things? -- (first order logic unification)
<p>I'm working on a program which must use inference in first-order logic, and everything is working great except for 1 thing which I don't understand.</p>

<p>The book I'm usin... | habedi/stack-exchange-dataset |
65,828 | Is there a metric for the similarity of two image filters? | <h2>Definitions</h2>

<p>An image filter is a matrix $m \in \mathbb{R}^{k_1 \times k_2 \times k_3}$ which gets applied to an image $I \in \mathbb{R}^{l_1 \times l_2 \times l_3}$ as a discrete convolution </p>

<p>$$I'(n_1, n_2, n_3) = \sum_{i=0}^{k_1} \sum_{j=0}^{k_2} \sum_{k=0}^{k_3} I[n_1-i - \lfloor ... | machine learning computer vision comparison | 1 | Is there a metric for the similarity of two image filters? -- (machine learning computer vision comparison)
<h2>Definitions</h2>

<p>An image filter is a matrix $m \in \mathbb{R}^{k_1 \times k_2 \times k_3}$ which gets applied to an image $I \in \mathbb{R}^{l_1 \times l_2 \times l_3}$ as a discrete convolution ... | habedi/stack-exchange-dataset |
65,830 | How to solve this asymptotic complexity problem? | <p>The increasing order of following functions in terms of asymptotic complexity is:
<a href="https://i.stack.imgur.com/46kSo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/46kSo.png" alt="complexity problem"></a></p>

<p>(A) f1(n) < f4(n) < f2(n) < f3(n)</p>

<p>(B) f1(... | algorithm analysis time complexity asymptotics | 1 | How to solve this asymptotic complexity problem? -- (algorithm analysis time complexity asymptotics)
<p>The increasing order of following functions in terms of asymptotic complexity is:
<a href="https://i.stack.imgur.com/46kSo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/46kSo.png" alt="comple... | habedi/stack-exchange-dataset |
65,833 | occur-check, does nominal unification has it? | <p>In unification, there is a "occur-check". Such as $X = a \, X$ fails to find a substitution for $X$ since it appears on right hand side too.
The first-order unification, higher-order unification all have occur-check.</p>

<p>the paper <a href="http://www.gabbay.org.uk/papers/nomu-jv.pdf" rel="nofollow n... | unification | 1 | occur-check, does nominal unification has it? -- (unification)
<p>In unification, there is a "occur-check". Such as $X = a \, X$ fails to find a substitution for $X$ since it appears on right hand side too.
The first-order unification, higher-order unification all have occur-check.</p>

<p>the paper <a hre... | habedi/stack-exchange-dataset |
65,838 | The fastest algorithm for intersection of two sorted lists? | <p>Say that there are two sorted lists: A and B.</p>

<p>The number of entries in A and B can vary. (They can be very small/huge. They can be similar to each other/significantly different).</p>

<p>What is the known to be the fastest algorithm for this functionality?</p>

<p>Can any one give me ... | algorithms lists | 1 | The fastest algorithm for intersection of two sorted lists? -- (algorithms lists)
<p>Say that there are two sorted lists: A and B.</p>

<p>The number of entries in A and B can vary. (They can be very small/huge. They can be similar to each other/significantly different).</p>

<p>What is the known to be ... | habedi/stack-exchange-dataset |
65,842 | Where can I find CS problem set resources? | <p>I am trying to learn to program and I don't just want to learn syntax, but rather learn and practice breaking up and solving problems. Now, I want to know where can I go to get hold of material that ranges in programming problems from beginner to intermediate and hopefully even further so that I can train my problem... | programming languages | 1 | Where can I find CS problem set resources? -- (programming languages)
<p>I am trying to learn to program and I don't just want to learn syntax, but rather learn and practice breaking up and solving problems. Now, I want to know where can I go to get hold of material that ranges in programming problems from beginner to ... | habedi/stack-exchange-dataset |
65,856 | Literature about a naive approach to graph isomorphism by inspecting polynomials of adjacency matrices | <p>I describe an approach to graph isomorphism which probably has false positives, and I am curious whether there is literature indicating that it does not work.</p>

<p>Given two adjacency matrices $G, H$, an admittedly naive method of checking for isomorphism is to check whether for each row $u$ of $G$, there... | reference request graph isomorphism | 1 | Literature about a naive approach to graph isomorphism by inspecting polynomials of adjacency matrices -- (reference request graph isomorphism)
<p>I describe an approach to graph isomorphism which probably has false positives, and I am curious whether there is literature indicating that it does not work.</p>

<... | habedi/stack-exchange-dataset |
65,862 | A special case for the subset sum problem | <p>If we wanted to see if any disjointed subset of a set $X = [w_1, ..., w_n]$ exists such as the sum of its elements equal exactly a given value $M$ (0-1 Knapsack problem) we could employ a DP solution or a simple greedy algorithm.</p>

<p>A simple implementation of which could be the following. Sort the set $... | algorithms time complexity knapsack problems | 1 | A special case for the subset sum problem -- (algorithms time complexity knapsack problems)
<p>If we wanted to see if any disjointed subset of a set $X = [w_1, ..., w_n]$ exists such as the sum of its elements equal exactly a given value $M$ (0-1 Knapsack problem) we could employ a DP solution or a simple greedy algori... | habedi/stack-exchange-dataset |
65,870 | Turing machine for which it is impossible to decide if it halts? | <p>Assuming someone tries to approximate a function which decides if a turing machine halts or not. It uses only a finite amount of time. The function returns $0$ (=the turing machine halts), $1$ (=the turing machine never halts) or $2$ (=the algorithm could not decide if the turing machine ever halts). If it returns $... | computability turing machines undecidability halting problem | 1 | Turing machine for which it is impossible to decide if it halts? -- (computability turing machines undecidability halting problem)
<p>Assuming someone tries to approximate a function which decides if a turing machine halts or not. It uses only a finite amount of time. The function returns $0$ (=the turing machine halts... | habedi/stack-exchange-dataset |
65,877 | Understanding Cache Mapping and Access (Computer Architecture) | <p>Consider a 512-KByte cache with 64-word cachelines (a cacheline is also known as a cache block, each word is 4-Bytes). This cache uses write-back scheme, and the address is 32 bits wide.</p>

<p>Answer the next questions for Direct Mapped cache, Fully Associative and Way Set Associative</p>

<p>What ... | computer architecture cpu cache | 1 | Understanding Cache Mapping and Access (Computer Architecture) -- (computer architecture cpu cache)
<p>Consider a 512-KByte cache with 64-word cachelines (a cacheline is also known as a cache block, each word is 4-Bytes). This cache uses write-back scheme, and the address is 32 bits wide.</p>

<p>Answer the nex... | habedi/stack-exchange-dataset |
65,886 | Counters in Turing machines | <p>I know how a Turing machine works, how it accepts a language but in some.</p>

<p>In some scenarios we would like to use counters.
For example, I want to develop a machine that accepts $\{0^{2n} : n \geq 0\}$. How can I count the number of zeroes?</p>

<p>If some one of you could solve the follow... | turing machines | 1 | Counters in Turing machines -- (turing machines)
<p>I know how a Turing machine works, how it accepts a language but in some.</p>

<p>In some scenarios we would like to use counters.
For example, I want to develop a machine that accepts $\{0^{2n} : n \geq 0\}$. How can I count the number of zeroes?</p>
... | habedi/stack-exchange-dataset |
65,892 | Allocating flows in a network while avoiding a particular node | <p>I am considering a network with the max flow problem in a particular situation. I have a set of flows which should pass a certain node <strong>A</strong> and and another set of flows which should avoid <strong>A</strong> and pass through another node <strong>B</strong>. The flows can cross each other at any other ar... | graphs network flow | 1 | Allocating flows in a network while avoiding a particular node -- (graphs network flow)
<p>I am considering a network with the max flow problem in a particular situation. I have a set of flows which should pass a certain node <strong>A</strong> and and another set of flows which should avoid <strong>A</strong> and pass... | habedi/stack-exchange-dataset |
65,897 | Find number of nodes that seperate graph to two or more subgrahps when removed individually - Find articulation points on a non-directed graph | <p>Suppose that we have an undirected graph, and that for any two nodes there is a path from one to another. In such a graph, there might be some nodes that, if removed from the graph individually, leave behind the starting graph as two or more subgraphs - that is, removing one of the said nodes no longer makes possibl... | algorithms graphs counting | 1 | Find number of nodes that seperate graph to two or more subgrahps when removed individually - Find articulation points on a non-directed graph -- (algorithms graphs counting)
<p>Suppose that we have an undirected graph, and that for any two nodes there is a path from one to another. In such a graph, there might be some... | habedi/stack-exchange-dataset |
65,900 | Deriving epsilon with a context free grammar with epsilon rules | <p>The below problem is from my Formal Languages class. The professor suggested drawing derivation trees for the language until we reach epsilon in all the leaves, and that it should begin to look like a geometric series. But I'm still having trouble getting started.</p>

<p>The way it was explained: if a conte... | context free formal grammars | 1 | Deriving epsilon with a context free grammar with epsilon rules -- (context free formal grammars)
<p>The below problem is from my Formal Languages class. The professor suggested drawing derivation trees for the language until we reach epsilon in all the leaves, and that it should begin to look like a geometric series. ... | habedi/stack-exchange-dataset |
65,901 | Understanding the bandwidth problem on graphs | <p>I'm trying to understand the <a href="https://en.wikipedia.org/wiki/Graph_bandwidth" rel="nofollow noreferrer">bandwidth problem</a> on graphs. Consider the following tree given as an adjacency list:</p>

<pre><code>1 => 4
2 => 6
3 => 5, 6
4 => 7
5 => 3
6 => 2, 3, 7
... | graphs optimization ordering | 1 | Understanding the bandwidth problem on graphs -- (graphs optimization ordering)
<p>I'm trying to understand the <a href="https://en.wikipedia.org/wiki/Graph_bandwidth" rel="nofollow noreferrer">bandwidth problem</a> on graphs. Consider the following tree given as an adjacency list:</p>

<pre><code>1 => 4
... | habedi/stack-exchange-dataset |
65,903 | The Taylor series and time complexity analysis | <p>I was just wondering, if an algorithm $A$ has a time complexity O$(2^n)$, since $2^n$ can be represented using a Taylor series, which is a polynomial, does this mean that $A$ has polynomial time complexity? Generalising even further, does this mean that any algorithm which has a time complexity O($f(n)$) where $f(n)... | algorithms complexity theory time complexity | 1 | The Taylor series and time complexity analysis -- (algorithms complexity theory time complexity)
<p>I was just wondering, if an algorithm $A$ has a time complexity O$(2^n)$, since $2^n$ can be represented using a Taylor series, which is a polynomial, does this mean that $A$ has polynomial time complexity? Generalising ... | habedi/stack-exchange-dataset |
65,915 | What is the big-O (worst-case upper bound) for time and space requirement of the different Chomsky classes? | <p>Everybody knows the <a href="https://en.wikipedia.org/wiki/Chomsky_hierarchy" rel="nofollow noreferrer">Chomsky-hierarchy</a> for describing formal languages and <a href="https://en.wikipedia.org/wiki/Big_O_notation" rel="nofollow noreferrer">big-O notation</a> for describing time and space complexity of a function.... | complexity theory time complexity space complexity chomsky hierarchy | 1 | What is the big-O (worst-case upper bound) for time and space requirement of the different Chomsky classes? -- (complexity theory time complexity space complexity chomsky hierarchy)
<p>Everybody knows the <a href="https://en.wikipedia.org/wiki/Chomsky_hierarchy" rel="nofollow noreferrer">Chomsky-hierarchy</a> for descr... | habedi/stack-exchange-dataset |
65,925 | Proving that the shortest simple path problem between two vertices $s$ and $t$ in a graph is NP-complete | <p>How to show that the shortest simple path problem between two vertices <span class="math-container">$s$</span> and <span class="math-container">$t$</span> (finding a minimum weight path between <span class="math-container">$s$</span> and <span class="math-container">$t$</span>) in a graph is NP-complete? I saw the f... | complexity theory graphs np complete reductions shortest path | 1 | Proving that the shortest simple path problem between two vertices $s$ and $t$ in a graph is NP-complete -- (complexity theory graphs np complete reductions shortest path)
<p>How to show that the shortest simple path problem between two vertices <span class="math-container">$s$</span> and <span class="math-container">$... | habedi/stack-exchange-dataset |
65,929 | Why are progress bars so inaccurate? | <p>Computers and programming languages tend to be deterministic and predictable. Yet progress bars seem the opposite, especially if the operation is complex. Even for world class professional products, some progress bars do little to reflect the real progress of an operation. I've seen them go from 10% to 90% in one... | computation models | 1 | Why are progress bars so inaccurate? -- (computation models)
<p>Computers and programming languages tend to be deterministic and predictable. Yet progress bars seem the opposite, especially if the operation is complex. Even for world class professional products, some progress bars do little to reflect the real progre... | habedi/stack-exchange-dataset |
65,933 | Can I notate time complexity depending on the result of an algorithm? | <p>I have a program that calculates the first year some two events happen on the same day. I have not calculated any upper limit for the year. The time complexity of the program would be equivalent to <strong>O(Years)</strong>, where Years is the result of the algorithm. </p>

<p>Is such a notation possible?</p... | algorithm analysis landau notation notation | 1 | Can I notate time complexity depending on the result of an algorithm? -- (algorithm analysis landau notation notation)
<p>I have a program that calculates the first year some two events happen on the same day. I have not calculated any upper limit for the year. The time complexity of the program would be equivalent to ... | habedi/stack-exchange-dataset |
65,952 | Language of a Turing Machine that runs its input on two other Turing Machines | <p>Given two Turing Machines M1 and M2, we build a new machine M that does the following on input x:</p>

<ol>
<li>Run M1 on x. If M1 accepts x, then go to an accept state.</li>
<li>Run M2 on x. If m2 accepts x, then go to an accept state.</li>
</ol>

<p>What would be the language of such a ... | formal languages turing machines | 1 | Language of a Turing Machine that runs its input on two other Turing Machines -- (formal languages turing machines)
<p>Given two Turing Machines M1 and M2, we build a new machine M that does the following on input x:</p>

<ol>
<li>Run M1 on x. If M1 accepts x, then go to an accept state.</li>
<li>Run M2... | habedi/stack-exchange-dataset |
65,953 | Meaning / proof of these regex | <p>I came across following excerpts while reading about regular expressions identities:</p>

<blockquote>
 <p>The regex associative laws are:
 $$(L+M)+N=L+(M+N)$$
 $$(LM)N=L(MN)$$
 Some important implications out of associative laws are:
 $$r(sr)^*=(rs)^*r$$
 $$(rs+r)^*r=r(sr+r)^*$... | regular expressions | 1 | Meaning / proof of these regex -- (regular expressions)
<p>I came across following excerpts while reading about regular expressions identities:</p>

<blockquote>
 <p>The regex associative laws are:
 $$(L+M)+N=L+(M+N)$$
 $$(LM)N=L(MN)$$
 Some important implications out of associative laws are... | habedi/stack-exchange-dataset |
65,961 | Is my implementation of genetic algorithm correct? | <p>In genetic algorithms, we have a function called "mutation". Before we call this function, we choose parents.<br>
In my version of the algorithm, when i mutate the child, i don't change the bits which are the same as the given input.<br>
By that, I mean :
Imagine we want to reach the string "ABCDE".<br>... | algorithms optimization genetic algorithms | 1 | Is my implementation of genetic algorithm correct? -- (algorithms optimization genetic algorithms)
<p>In genetic algorithms, we have a function called "mutation". Before we call this function, we choose parents.<br>
In my version of the algorithm, when i mutate the child, i don't change the bits which are the same... | habedi/stack-exchange-dataset |
65,967 | Application of a directed almost tree | <p>Is there anything interesting to say about an "almost BST" with directed edges?
Is there a domain where this structure naturally arises? I'm imagining a tree like the one below, but it would of course be more interesting if the tree were deeper with just a few of these strange edges.</p>

<p><a href="htt... | graphs terminology binary trees | 1 | Application of a directed almost tree -- (graphs terminology binary trees)
<p>Is there anything interesting to say about an "almost BST" with directed edges?
Is there a domain where this structure naturally arises? I'm imagining a tree like the one below, but it would of course be more interesting if the tree were ... | habedi/stack-exchange-dataset |
65,969 | If NP is the class of problems that cannot be solved in polynomial time, what is co-NP? | <p>In my super non-rigorous class on optimization, the prof defined NP as the class of decision problems that cannot be solved in polynomial time. By definition, P is the class of decision problems that can be solved in polynomial time.</p>

<p>Then what is so called co-NP? Does co-NP = P in the sense of 'compl... | complexity theory np complexity classes | 1 | If NP is the class of problems that cannot be solved in polynomial time, what is co-NP? -- (complexity theory np complexity classes)
<p>In my super non-rigorous class on optimization, the prof defined NP as the class of decision problems that cannot be solved in polynomial time. By definition, P is the class of decisio... | habedi/stack-exchange-dataset |
65,970 | Do CFGs generate many languages? | <p>Suppose we define a CFG such that it is possible to produce strings of the form $a^nb^n$ (in this case, I would think, we would need epsilon-productions). 
Then one such $L(CFG)$ is $a^nb^n$.</p>

<p>However, let's say it is also possible to produce strings not of the form $a^nb^n$ from this grammar. </p... | formal languages formal grammars | 1 | Do CFGs generate many languages? -- (formal languages formal grammars)
<p>Suppose we define a CFG such that it is possible to produce strings of the form $a^nb^n$ (in this case, I would think, we would need epsilon-productions). 
Then one such $L(CFG)$ is $a^nb^n$.</p>

<p>However, let's say it is also poss... | habedi/stack-exchange-dataset |
65,976 | How is a Transition System in Operational Semantics defined? | <p>I'm describing the semantics of a new optimization for Java using Operational Semantics but I'm not sure how to define the transition system.</p>

<p>I found this link :<a href="http://www.irisa.fr/celtique/teaching/PAS/opsem-2016.pdf" rel="nofollow noreferrer">http://www.irisa.fr/celtique/teaching/PAS/opsem... | formal languages operational semantics | 1 | How is a Transition System in Operational Semantics defined? -- (formal languages operational semantics)
<p>I'm describing the semantics of a new optimization for Java using Operational Semantics but I'm not sure how to define the transition system.</p>

<p>I found this link :<a href="http://www.irisa.fr/celtiq... | habedi/stack-exchange-dataset |
65,980 | Is a language of some deciders decidable? | <p>Is </p>

<p>$$L = \{ \langle M \rangle \mid M = (\{Q_1, Q_2, . . . , Q_{100}\}, \{0, 1\}, \{0, 1, \_\}, δ, Q_1, Q_2, Q_3) \text{ is a decider}\}$$ </p>

<p>decidable?</p>

<p>I know </p>

<p>$$HALT_{TM}= \{ \langle M \rangle \mid M \text{ is a decider}\}$$ </p>

<p>is not deci... | formal languages turing machines reductions undecidability halting problem | 1 | Is a language of some deciders decidable? -- (formal languages turing machines reductions undecidability halting problem)
<p>Is </p>

<p>$$L = \{ \langle M \rangle \mid M = (\{Q_1, Q_2, . . . , Q_{100}\}, \{0, 1\}, \{0, 1, \_\}, δ, Q_1, Q_2, Q_3) \text{ is a decider}\}$$ </p>

<p>decidable?</p>

... | habedi/stack-exchange-dataset |
65,981 | Accounting method amortized analysis of a sequence of operations (CLRS 17.2-2) | <p>I'm working through <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">CLRS</a>, Chapter 17 on Amortized Analysis. One of the problems I attempted to solve is 17.2-2 (described below), but my answer differs from the one in the instructor's manual, so I thought I'd solicit your... | algorithms amortized analysis | 1 | Accounting method amortized analysis of a sequence of operations (CLRS 17.2-2) -- (algorithms amortized analysis)
<p>I'm working through <a href="https://mitpress.mit.edu/books/introduction-algorithms" rel="nofollow noreferrer">CLRS</a>, Chapter 17 on Amortized Analysis. One of the problems I attempted to solve is 17.2... | habedi/stack-exchange-dataset |
65,982 | Efficiently find maximum XOR on a graph | <p>We are given an <strong>undirected</strong> graph $G=(V,E)$, $|V| \leq 50$. We are also given a starting vertex $s$. Each vertex $v$ of the graph is associated with a natural number $N_v$. Initially our profit is $R=N_s$.</p>

<p>Now we have to traverse the graph beginning from $s$ in an order. We can visit... | algorithms graphs optimization graph traversal | 1 | Efficiently find maximum XOR on a graph -- (algorithms graphs optimization graph traversal)
<p>We are given an <strong>undirected</strong> graph $G=(V,E)$, $|V| \leq 50$. We are also given a starting vertex $s$. Each vertex $v$ of the graph is associated with a natural number $N_v$. Initially our profit is $R=N_s$.</p... | habedi/stack-exchange-dataset |
65,997 | Types as first class Citizen | <p>Coming from a C++ background I don't understand why one needs types / type expressions as first class citizen?
The only language I know that supports this feature is Aldor.</p>

<p>Does anybody have some literature about types as first class citizen or know some reasons why it's useful?</p>
 | programming languages language design types | 1 | Types as first class Citizen -- (programming languages language design types)
<p>Coming from a C++ background I don't understand why one needs types / type expressions as first class citizen?
The only language I know that supports this feature is Aldor.</p>

<p>Does anybody have some literature about types ... | habedi/stack-exchange-dataset |
66,007 | Interesting problems that can be solved with algorithms | <p>I need to write a blog post on a problem that can be solved algorithmically. I need to do two things:</p>

<p>1) I need to decide what the naive brute force method would be and touch on it's time and Space complexities.</p>

<p>2) I need to come up with a more elegant/ideal method to solve the proble... | algorithm analysis | 1 | Interesting problems that can be solved with algorithms -- (algorithm analysis)
<p>I need to write a blog post on a problem that can be solved algorithmically. I need to do two things:</p>

<p>1) I need to decide what the naive brute force method would be and touch on it's time and Space complexities.</p>
&... | habedi/stack-exchange-dataset |
66,020 | Reference request: optimizing procedures on lists in dynamic languages by performing safety checks in advance | <p>For my science fair project, I implemented <a href="https://bugs.python.org/issue28685" rel="nofollow noreferrer">an optimization</a> to Python's sort routine. The idea is to move the safety checks that have to be carried out during each comparison, e.g. type checks and character-width checks, outside of the sort lo... | reference request type checking program optimization interpreters | 1 | Reference request: optimizing procedures on lists in dynamic languages by performing safety checks in advance -- (reference request type checking program optimization interpreters)
<p>For my science fair project, I implemented <a href="https://bugs.python.org/issue28685" rel="nofollow noreferrer">an optimization</a> to... | habedi/stack-exchange-dataset |
66,023 | What is 'K' in the Bounded Post Correspondence Problem? | <p>I'm only just starting to learn about the PCP, and I'm especially interested in the Bounded version. <a href="https://en.wikipedia.org/wiki/Post_correspondence_problem#Variants" rel="nofollow noreferrer">From Wikipedia</a>:</p>

<blockquote>
 <p>One of the most important variants of PCP is the bounded P... | complexity theory computability | 1 | What is 'K' in the Bounded Post Correspondence Problem? -- (complexity theory computability)
<p>I'm only just starting to learn about the PCP, and I'm especially interested in the Bounded version. <a href="https://en.wikipedia.org/wiki/Post_correspondence_problem#Variants" rel="nofollow noreferrer">From Wikipedia</a>:<... | habedi/stack-exchange-dataset |
66,041 | Logspace algorithm for s-t connectivity in undirected forests | <p>It has been shown that the decision problem<br>
$\{(G, s, t)~\mid~ G\text{ is an undirected forest and there is a path from }s \text{ to } t \}$ is complete for logspace (and therefore in $L$).<br>
But the proof involves a series of reductions which didn't seem very intuitive to me.<br>
Is there any natu... | algorithms graphs graph traversal | 1 | Logspace algorithm for s-t connectivity in undirected forests -- (algorithms graphs graph traversal)
<p>It has been shown that the decision problem<br>
$\{(G, s, t)~\mid~ G\text{ is an undirected forest and there is a path from }s \text{ to } t \}$ is complete for logspace (and therefore in $L$).<br>
But the pr... | habedi/stack-exchange-dataset |
66,046 | Eliminating ambiguity when referring to complexity in cases of multiple parameters and/or multiple results | <p>When looking through a few questions at StackOverflow¹ that all ask for algorithms to select <em>k</em> distinct random numbers out of <em>N</em>, <strong>I've become confused about how to compare the answers in terms of time and space complexity.</strong></p>

<ul>
<li>each algorithm has two parameters,... | time complexity asymptotics space complexity | 1 | Eliminating ambiguity when referring to complexity in cases of multiple parameters and/or multiple results -- (time complexity asymptotics space complexity)
<p>When looking through a few questions at StackOverflow¹ that all ask for algorithms to select <em>k</em> distinct random numbers out of <em>N</em>, <strong>I've ... | habedi/stack-exchange-dataset |
66,048 | How to find the maximal set of elements $S$ of an array such that every element in $S$ is greater than or equal to the cardinality of $S$? | <p>I have an algorithmic problem.</p>

<p>Given an array (or a set) $T$ of $n$ nonnegative integers. Find the maximal set $S$ of $T$ such that for all $a\in S$, $a\geqslant |S|$.</p>

<p>For example:</p>

<ol>
<li>If $T$=[1, 3, 4, 1, 3, 6], then $S$ can be [3, 3, 6] or [3, 4, 6] or [4, 3, 6]... | algorithms optimization sets | 1 | How to find the maximal set of elements $S$ of an array such that every element in $S$ is greater than or equal to the cardinality of $S$? -- (algorithms optimization sets)
<p>I have an algorithmic problem.</p>

<p>Given an array (or a set) $T$ of $n$ nonnegative integers. Find the maximal set $S$ of $T$ such t... | habedi/stack-exchange-dataset |
66,052 | Find an algorithm that finds a minimal hitting set for sets limited in size | <p>Given a family of sets $F=\{S_1,...,S_m\}$, where $S_i{\subseteq}\{1..n\}$, with the assumption that the maximum size of any set $S_i$ is at most $k$ ($|S_i|{\leq}k\ {\forall}i\in\{i..n\}$).</p>

<p>I'm tasked with finding a hitting set $H$, a set that contains at least one member from each set $S_i$ ($H{\ca... | np hard sets | 1 | Find an algorithm that finds a minimal hitting set for sets limited in size -- (np hard sets)
<p>Given a family of sets $F=\{S_1,...,S_m\}$, where $S_i{\subseteq}\{1..n\}$, with the assumption that the maximum size of any set $S_i$ is at most $k$ ($|S_i|{\leq}k\ {\forall}i\in\{i..n\}$).</p>

<p>I'm tasked with ... | habedi/stack-exchange-dataset |
66,067 | Differences between $\text{BPP}$ and $\overline{\text{BPP}}$ vs $\text{co-BPP}$ | <p>Is $\overline{\text{BPP}}$ different from $\text{co-BPP}$? I am having trouble understanding the "co" part of these complexities.</p>

<p>I think yes and here is what I think: It seems given that $\text{BPP}$ is the class of languages decided by PTMs with error probability 1/3, then this is equal to $\text{c... | complexity theory complexity classes | 1 | Differences between $\text{BPP}$ and $\overline{\text{BPP}}$ vs $\text{co-BPP}$ -- (complexity theory complexity classes)
<p>Is $\overline{\text{BPP}}$ different from $\text{co-BPP}$? I am having trouble understanding the "co" part of these complexities.</p>

<p>I think yes and here is what I think: It seems gi... | habedi/stack-exchange-dataset |
66,070 | what is variable capture in nominal logic? | <p>While reading a paper <a href="http://Nominal%20Unification%20from%20a%20Higher-Order%20Perspective" rel="nofollow noreferrer">Nominal Unification from a Higher-Order Perspective</a>, in the abstract I noticed something feel bit confusing,</p>

<blockquote>
 <p>Nominal Logic is an extension of first-ord... | programming languages logic variable binding | 1 | what is variable capture in nominal logic? -- (programming languages logic variable binding)
<p>While reading a paper <a href="http://Nominal%20Unification%20from%20a%20Higher-Order%20Perspective" rel="nofollow noreferrer">Nominal Unification from a Higher-Order Perspective</a>, in the abstract I noticed something feel... | habedi/stack-exchange-dataset |
66,096 | Showing Optimal Substructure for Stacking Boxes DP Problem? | <p>I am having trouble wrapping my head around the <a href="http://www.geeksforgeeks.org/dynamic-programming-set-21-box-stacking-problem/" rel="nofollow noreferrer">Stacking Boxes</a> dynamic programming problem, and understanding how it has optimal substructure and overlapping subproblems. If it has the optimal subst... | algorithms dynamic programming | 1 | Showing Optimal Substructure for Stacking Boxes DP Problem? -- (algorithms dynamic programming)
<p>I am having trouble wrapping my head around the <a href="http://www.geeksforgeeks.org/dynamic-programming-set-21-box-stacking-problem/" rel="nofollow noreferrer">Stacking Boxes</a> dynamic programming problem, and underst... | habedi/stack-exchange-dataset |
66,099 | Upper bound of of fib(n+2) | <p>I have a homework problem that is perplexing me because the math is beyond what I have done, although we were told that it was unnecessary to solve this mathematically. Just provide a close upper bound and justify it.</p>

<blockquote>
 <p>Let
 $$f(n) = |\{w ∈ \{a, b\}^n : aa \notin w \}|. $$
... | asymptotics combinatorics upper bound | 1 | Upper bound of of fib(n+2) -- (asymptotics combinatorics upper bound)
<p>I have a homework problem that is perplexing me because the math is beyond what I have done, although we were told that it was unnecessary to solve this mathematically. Just provide a close upper bound and justify it.</p>

<blockquote>&#x... | habedi/stack-exchange-dataset |
66,116 | Shortest path between two points with n hops | <p>Is there an efficient algorithm which computes the (possibly approximately) shortest $n$-edge path between two points $A$ and $B$ in a weighted complete graph? Dijkstra won't work because it will just give the trivial answer of $A\to B$. I'd like to find an $n$-edge path (e.g. for $n=4$, find $C$, $D$ and $E$ which ... | graphs shortest path traveling salesman | 1 | Shortest path between two points with n hops -- (graphs shortest path traveling salesman)
<p>Is there an efficient algorithm which computes the (possibly approximately) shortest $n$-edge path between two points $A$ and $B$ in a weighted complete graph? Dijkstra won't work because it will just give the trivial answer of... | habedi/stack-exchange-dataset |
66,135 | how can a program be OS-dependent? | <p>I know the fact that you cannot run the same machine code on two different machines,</p>

<p>so the software must be <strong>machine dependent</strong> (i.e Arm program cannot run on either powerpc or x86).</p>

<p>but in reality the software is <strong>OS dependent</strong> (i.e linux programs canno... | computer architecture operating systems | 1 | how can a program be OS-dependent? -- (computer architecture operating systems)
<p>I know the fact that you cannot run the same machine code on two different machines,</p>

<p>so the software must be <strong>machine dependent</strong> (i.e Arm program cannot run on either powerpc or x86).</p>

<p>but in... | habedi/stack-exchange-dataset |
66,136 | A special case for the subset sum problem: selecting from powers of two | <p>Given a multiset $X=\{x_1,\dots,x_n\}$ where every element $w_i$ is a power of two, and given an integer $M$, I'd like to determine if there is any subset of $X$ that sums to $M$.</p>

<p>(This question is based on a previous <a href="https://cs.stackexchange.com/questions/65862/a-special-case-for-the-subset... | algorithms complexity theory knapsack problems | 1 | A special case for the subset sum problem: selecting from powers of two -- (algorithms complexity theory knapsack problems)
<p>Given a multiset $X=\{x_1,\dots,x_n\}$ where every element $w_i$ is a power of two, and given an integer $M$, I'd like to determine if there is any subset of $X$ that sums to $M$.</p>

... | habedi/stack-exchange-dataset |
66,137 | Proof of correctness of algorithms (induction) | <p>I am reading Algorithm's Design Manual by S.Skiena and I have a hard time understanding and proving the correctness of algorithms. I should use proof by induction and when we talk about summations and proving their formulas I can do it, I have no problem understanding why it is correct. When I get a loop on the othe... | algorithms correctness proof induction loop invariants | 1 | Proof of correctness of algorithms (induction) -- (algorithms correctness proof induction loop invariants)
<p>I am reading Algorithm's Design Manual by S.Skiena and I have a hard time understanding and proving the correctness of algorithms. I should use proof by induction and when we talk about summations and proving t... | habedi/stack-exchange-dataset |
66,144 | Group points by given shapes | <p>I am using a sensing board able to detect magnetic signals between the board and a display.</p>

<p>I have a set of objects that are represented (each of them) by a unique set of points (magnets) with a particular shape. For example: object #1 is made by three points that form an equilateral triangle with si... | computational geometry | 1 | Group points by given shapes -- (computational geometry)
<p>I am using a sensing board able to detect magnetic signals between the board and a display.</p>

<p>I have a set of objects that are represented (each of them) by a unique set of points (magnets) with a particular shape. For example: object #1 is made ... | habedi/stack-exchange-dataset |
66,151 | What's the meaning of the $\top$ symbol in a Hoare triple? | <p>I'm studying program verification and came across the following triple:<br>
$$ \{\top\} \;P \; \{y=(x+1)\} $$
What's the meaning of the $\top$ symbol on the precondition? Does it mean $P$ can take any input?</p>
 | software verification hoare logic | 1 | What's the meaning of the $\top$ symbol in a Hoare triple? -- (software verification hoare logic)
<p>I'm studying program verification and came across the following triple:<br>
$$ \{\top\} \;P \; \{y=(x+1)\} $$
What's the meaning of the $\top$ symbol on the precondition? Does it mean $P$ can take any input?</p>... | habedi/stack-exchange-dataset |
66,153 | How to partition the rows of a matrix in such a way that every column satisfies a given condition? | <p>The input is: Given a matrix $\mathbf{A}=\left[a_{ij}\right]$ of nonnegative integers for all $i\in\{1,\ldots, m\}$ and $j\in\{1,\ldots, n\}$ (where $n<m$). Nonnegative integers $V_j$ for all $j\in\{1,\ldots,n\}$. </p>

<p>The question is: Find $n$ disjoint sets $S_j$ of $\{1,\ldots,m\}$ such that 
$$... | algorithms | 1 | How to partition the rows of a matrix in such a way that every column satisfies a given condition? -- (algorithms)
<p>The input is: Given a matrix $\mathbf{A}=\left[a_{ij}\right]$ of nonnegative integers for all $i\in\{1,\ldots, m\}$ and $j\in\{1,\ldots, n\}$ (where $n<m$). Nonnegative integers $V_j$ for all $j\in\{... | habedi/stack-exchange-dataset |
66,161 | Running time of an algorithm containing binary elements for cryptography | <p>Hey guys sorry I'm new to cs and I'm trying to find the running time of algorithms... could you tell me about the algo given how much time is needed in terms of complexity? The actual algo I created is the same as below but the sum must be more or equal to 2^(n-2).Thank you<img src="https://i.stack.imgur.com/3iFcE.... | complexity theory time complexity runtime analysis | 1 | Running time of an algorithm containing binary elements for cryptography -- (complexity theory time complexity runtime analysis)
<p>Hey guys sorry I'm new to cs and I'm trying to find the running time of algorithms... could you tell me about the algo given how much time is needed in terms of complexity? The actual alg... | habedi/stack-exchange-dataset |
66,166 | Show that the diameter of a MST is sometimes larger by a factor $\Omega(n)$ than the diameter of the graph $G$ | <p>As my title points out, I don't understand how do you show that, in general, the diameter of a MST (minimal spanning tree) can be bigger than the diameter of G, by the factor $\Omega(n)$. $(n:= |V|, G =(V,E)) $.</p>

<p>And I don't understand, how big is $\Omega(n)$ and why $\Omega$?</p>

<p>I made a... | graphs spanning trees | 1 | Show that the diameter of a MST is sometimes larger by a factor $\Omega(n)$ than the diameter of the graph $G$ -- (graphs spanning trees)
<p>As my title points out, I don't understand how do you show that, in general, the diameter of a MST (minimal spanning tree) can be bigger than the diameter of G, by the factor $\Om... | habedi/stack-exchange-dataset |
66,172 | On complexity of the sieve, start crossing at the square of $p$ | <p>This question is about a common optimization in the basic sieve of Erathostenes. </p>

<p>If we look at <a href="https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf" rel="nofollow noreferrer">this paper</a> (page 3, footnotes), the author says:</p>

<blockquote>
 <p>If we start crossing off at $... | algorithm analysis time complexity | 1 | On complexity of the sieve, start crossing at the square of $p$ -- (algorithm analysis time complexity)
<p>This question is about a common optimization in the basic sieve of Erathostenes. </p>

<p>If we look at <a href="https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf" rel="nofollow noreferrer">this paper</a... | habedi/stack-exchange-dataset |
66,179 | Understanding details of NP-Hard definition | <p>I am learning from this video: <a href="https://www.youtube.com/watch?v=eHZifpgyH_4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=eHZifpgyH_4</a> 
at 21:17 he talks about his definition of NP-Hard. </p>

<p>The definition is: X is NP-Hard if every problem y which belongs to NP reduces to X. ... | complexity theory time complexity np complete np hard | 1 | Understanding details of NP-Hard definition -- (complexity theory time complexity np complete np hard)
<p>I am learning from this video: <a href="https://www.youtube.com/watch?v=eHZifpgyH_4" rel="nofollow noreferrer">https://www.youtube.com/watch?v=eHZifpgyH_4</a> 
at 21:17 he talks about his definition of NP-Hard.... | habedi/stack-exchange-dataset |
66,181 | Selling blocks of time slots | <p>Given $n$ time slots that $k$ people want to buy. Person $i$ has a value $h(i,j)\geq 0$ for each time slot $j$. Each person can only buy one consecutive block of time slots, which could be empty.</p>

<p>Is there a <em>polynomial-time algorithm</em> to compute the maximum value the seller can achieve? </p>... | algorithms optimization np hard scheduling | 1 | Selling blocks of time slots -- (algorithms optimization np hard scheduling)
<p>Given $n$ time slots that $k$ people want to buy. Person $i$ has a value $h(i,j)\geq 0$ for each time slot $j$. Each person can only buy one consecutive block of time slots, which could be empty.</p>

<p>Is there a <em>polynomial-... | habedi/stack-exchange-dataset |
66,184 | Heuristic analysis of Bloom filters | <p>I am currently watching a lecture on Bloom filters, and the professor is doing a heuristic analysis of Bloom filters.</p>

<p>It's all based on the following assumption:</p>

<blockquote>
 <p>All $h_{i}(x)$'s are uniformly random and independent (across different $i$'s and $x$'s)</p>
</block... | probability theory hashing bloom filters | 1 | Heuristic analysis of Bloom filters -- (probability theory hashing bloom filters)
<p>I am currently watching a lecture on Bloom filters, and the professor is doing a heuristic analysis of Bloom filters.</p>

<p>It's all based on the following assumption:</p>

<blockquote>
 <p>All $h_{i}(x)$'s are u... | habedi/stack-exchange-dataset |
66,187 | Calculating modulus of large non-factored numbers | <p>The internet is full of algorithms to calculate the modulo operation of large numbers that have the form $a^e \bmod p$. How about numbers with unknown factorization. More precisely, let's say I have a 4-byte sized modulus prime $p$, and a large number $a$ stored in memory as an array of bytes, that is, $a = [a_{k-1}... | algorithms modular arithmetic | 1 | Calculating modulus of large non-factored numbers -- (algorithms modular arithmetic)
<p>The internet is full of algorithms to calculate the modulo operation of large numbers that have the form $a^e \bmod p$. How about numbers with unknown factorization. More precisely, let's say I have a 4-byte sized modulus prime $p$,... | habedi/stack-exchange-dataset |
66,198 | How to partition a set into disjoints subsets each of given size? | <p>The input: Given a set $U=\{1, \ldots, k\}$ called the universe. Let $C=\{S_1, \ldots, S_n\}$ be a collection of subsets of $U$ and let $ s_j$ be a nonnegative integer for all $j=1,\ldots,n$ such that $\sum_{j=1}^{n} s_j=k$.</p>

<p>The question: Are there $n$ subsets $A_j$ of $S_j$ (i.e., $A_j\subset S_j$) ... | reductions | 1 | How to partition a set into disjoints subsets each of given size? -- (reductions)
<p>The input: Given a set $U=\{1, \ldots, k\}$ called the universe. Let $C=\{S_1, \ldots, S_n\}$ be a collection of subsets of $U$ and let $ s_j$ be a nonnegative integer for all $j=1,\ldots,n$ such that $\sum_{j=1}^{n} s_j=k$.</p>
&#... | habedi/stack-exchange-dataset |
66,200 | Is the set of strings $0^{2k}10^{2k}10^{k}$ for $k \geq 0$ context-free? | <p>I am able to solve $0^{k}10^{k}10^{j}$ where $ k < j$. and I was able to see that this is also a concatenation of two strings. How to do it for $0^{2k}10^{2k}10^{k}$ for $k \ge 0$?</p>
 | formal languages formal grammars context sensitive | 1 | Is the set of strings $0^{2k}10^{2k}10^{k}$ for $k \geq 0$ context-free? -- (formal languages formal grammars context sensitive)
<p>I am able to solve $0^{k}10^{k}10^{j}$ where $ k < j$. and I was able to see that this is also a concatenation of two strings. How to do it for $0^{2k}10^{2k}10^{k}$ for $k \ge 0$?</p>&... | habedi/stack-exchange-dataset |
66,205 | How to find all maximal sets $S_i$ of a given array $T$ such that every element of $S_i$ is greater than or equal to the cardinality of $S_i$ | <p>Lately, I asked <a href="https://cs.stackexchange.com/questions/66048/how-to-find-the-maximal-set-of-elements-s-of-an-array-such-that-every-element">this question</a> to find the maximal set of elements $S$ of a given array $T$ such that every element of $S$ is greater than or equal to the cardinality of $S$. </p>&#... | algorithms | 1 | How to find all maximal sets $S_i$ of a given array $T$ such that every element of $S_i$ is greater than or equal to the cardinality of $S_i$ -- (algorithms)
<p>Lately, I asked <a href="https://cs.stackexchange.com/questions/66048/how-to-find-the-maximal-set-of-elements-s-of-an-array-such-that-every-element">this quest... | habedi/stack-exchange-dataset |
66,206 | Prove that L = { wu; wu in {a,b}* and |w| = |u| } is not regular | <p>Prove that $L = \{wu, wu \in \{a,b\}^* \ \land |w| = |u| \}$ is not regular.</p>

<p>I'm trying to approach this problem with the pumping lemma.</p>

<p>So I know I have to pick a string <em>s</em>, which can be split into <em>xyz</em> components in terms of the pumping length, <em>p</em>.</p>
&... | regular languages pumping lemma | 1 | Prove that L = { wu; wu in {a,b}* and |w| = |u| } is not regular -- (regular languages pumping lemma)
<p>Prove that $L = \{wu, wu \in \{a,b\}^* \ \land |w| = |u| \}$ is not regular.</p>

<p>I'm trying to approach this problem with the pumping lemma.</p>

<p>So I know I have to pick a string <em>s</em>,... | habedi/stack-exchange-dataset |
66,212 | How to "convert" nested loops into code taking advantage of parallel computing? | <p>Let's say that an algorithm uses several nested loops to accomplish it's task, for instance :</p>

<ul>
<li>An algorithm treating voxels on several frames, so there would be
four dimensions : t (for time), x, y and z.</li>
<li>An algorithm evaluating a
function that takes n entries, searching... | parallel computing | 1 | How to "convert" nested loops into code taking advantage of parallel computing? -- (parallel computing)
<p>Let's say that an algorithm uses several nested loops to accomplish it's task, for instance :</p>

<ul>
<li>An algorithm treating voxels on several frames, so there would be
four dimensions : t (fo... | habedi/stack-exchange-dataset |
66,229 | Why can't linear bounded automata accept an empty string? | <p>The linear bounded automata (LBA) is defined as follows:</p>

<blockquote>
 <p>A linear bounded automata is a nondeterministic Turing machine $M=(Q,\Sigma,\Gamma,\delta,q_0,\square,F)$ (as in the definition of TM) with the restriction that $\Sigma$ must contain two symbols $[$ and $]$, such that $\delta... | automata context sensitive | 1 | Why can't linear bounded automata accept an empty string? -- (automata context sensitive)
<p>The linear bounded automata (LBA) is defined as follows:</p>

<blockquote>
 <p>A linear bounded automata is a nondeterministic Turing machine $M=(Q,\Sigma,\Gamma,\delta,q_0,\square,F)$ (as in the definition of TM) ... | habedi/stack-exchange-dataset |
66,234 | Bottom-Up Parser With Leftmost Derivation | <p>I'm reading the book <a href="http://www.dickgrune.com/Books/PTAPG_2nd_Edition/" rel="nofollow noreferrer"><em>Parsing Techniques</em></a> by Dick Grune et al. and in section 3.1.3 "Linearization of the Parse Tree" they introduce the notion of linearization:</p>

<blockquote>
 <p>[...] a parser can prod... | formal grammars parsers | 1 | Bottom-Up Parser With Leftmost Derivation -- (formal grammars parsers)
<p>I'm reading the book <a href="http://www.dickgrune.com/Books/PTAPG_2nd_Edition/" rel="nofollow noreferrer"><em>Parsing Techniques</em></a> by Dick Grune et al. and in section 3.1.3 "Linearization of the Parse Tree" they introduce the notion of li... | habedi/stack-exchange-dataset |
66,235 | Is the simulation of how a warehouse functions (eg Amazon) a discrete event simulation problem | <p>If i wanted to write a piece of software that simulated a warehouse where typical warehouse procedures occur eg </p>

<ul>
<li>loading of trucks onto conveyors</li>
<li>goods being transported around a warehouse by machines</li>
<li>goods being packed by operatives </li>
<li>goods being picke... | simulation | 1 | Is the simulation of how a warehouse functions (eg Amazon) a discrete event simulation problem -- (simulation)
<p>If i wanted to write a piece of software that simulated a warehouse where typical warehouse procedures occur eg </p>

<ul>
<li>loading of trucks onto conveyors</li>
<li>goods being transport... | habedi/stack-exchange-dataset |
66,236 | What is the complexity of a variation of the Coupon collector's problem? | <p>I need to know the complexity of the following algorithm:</p>

<p>Draw elements from a set of size $m$, one by one, randomly, with replacement, until coming across $n$ different elements from the set ($n\le m$). We do not care what are the numbers drawn, and halt once $n$ different numbers were seen during t... | time complexity probability theory | 1 | What is the complexity of a variation of the Coupon collector's problem? -- (time complexity probability theory)
<p>I need to know the complexity of the following algorithm:</p>

<p>Draw elements from a set of size $m$, one by one, randomly, with replacement, until coming across $n$ different elements from the ... | habedi/stack-exchange-dataset |
66,243 | what is the Recent Nature Inspired Algorithm for Optimization? | <p>I'm into designing a <strong>recommender system</strong> for movie database and for effective optimization.I suggested the idea of using particle swamp optimization ,but my professors need recent algorithms,can any one suggest <strong><em>recent nature inspired algorithms for optimization</em></strong>.(After Cuckoo... | algorithm analysis bio inspired computing | 1 | what is the Recent Nature Inspired Algorithm for Optimization? -- (algorithm analysis bio inspired computing)
<p>I'm into designing a <strong>recommender system</strong> for movie database and for effective optimization.I suggested the idea of using particle swamp optimization ,but my professors need recent algorithms,... | habedi/stack-exchange-dataset |
66,252 | Noncontext free for quotient | <p>Have such exercise:
Let $L_1=\{a^{2n}b^n|n\geq1\}^*$</p>

<p>and $L_2=\{b^na^n|n\geq 1\}^*b$</p>

<p>Prove, that $L_1, L_2$ are context free, while quotient $L_1/L_2$ is not context-free.</p>

<p>(This is <a href="http://users.utu.fi/jkari/automata/hw10.pdf" rel="nofollow noreferrer">hom... | context free | 1 | Noncontext free for quotient -- (context free)
<p>Have such exercise:
Let $L_1=\{a^{2n}b^n|n\geq1\}^*$</p>

<p>and $L_2=\{b^na^n|n\geq 1\}^*b$</p>

<p>Prove, that $L_1, L_2$ are context free, while quotient $L_1/L_2$ is not context-free.</p>

<p>(This is <a href="http://users.utu.fi/jkari/a... | habedi/stack-exchange-dataset |
66,261 | On complexity of the sieve, start crossing at the square of p - Part II | <p>Ok, this is a follow up question to <a href="https://cs.stackexchange.com/questions/66172/on-complexity-of-the-sieve-start-crossing-at-the-square-of-p">this</a>, about the Erathostenes Sieve.</p>

<p>If we look at <a href="https://www.cs.hmc.edu/~oneill/papers/Sieve-JFP.pdf" rel="nofollow noreferrer">this</a... | algorithm analysis asymptotics | 1 | On complexity of the sieve, start crossing at the square of p - Part II -- (algorithm analysis asymptotics)
<p>Ok, this is a follow up question to <a href="https://cs.stackexchange.com/questions/66172/on-complexity-of-the-sieve-start-crossing-at-the-square-of-p">this</a>, about the Erathostenes Sieve.</p>

<p>I... | habedi/stack-exchange-dataset |
66,268 | Maximum waiting time between events such that k events are not missed | <p>I've been given some homework on dynamic programming and I'm having trouble to find the suboptimal recurrence. Let me copy the statement:</p>
<blockquote>
<p>In a given motorcycle training circuit, the number of riders is becoming increasingly large. As such, a new set of stricter rules is being enforced.</p... | algorithms dynamic programming efficiency | 1 | Maximum waiting time between events such that k events are not missed -- (algorithms dynamic programming efficiency)
<p>I've been given some homework on dynamic programming and I'm having trouble to find the suboptimal recurrence. Let me copy the statement:</p>
<blockquote>
<p>In a given motorcycle training cir... | habedi/stack-exchange-dataset |
66,300 | Domain Theory and Polymorphism | <p>Domain theory gives an amazing theory of computability in the presence of simple types. But when parametric polymorphism is added there doesn't seem to be a nice theory that explains whats going on quite as nicely as domain theory explains computation over simple types. Certainly I wouldn't expect such a thing to ex... | computability type theory dependent types | 1 | Domain Theory and Polymorphism -- (computability type theory dependent types)
<p>Domain theory gives an amazing theory of computability in the presence of simple types. But when parametric polymorphism is added there doesn't seem to be a nice theory that explains whats going on quite as nicely as domain theory explains... | habedi/stack-exchange-dataset |
66,306 | Resulting complexity class for allowing two passes over witness in NL? | <p>I know that when an NL Turing machine is allowed to go back and forth freely, the resulting class of problems solvable on it is NP.</p>

<p>But limit of two passes over the witness tape, does not seem to add much power to the NL machine, if at all. </p>

<p>I am stuck on this problem. What is the res... | complexity theory nondeterminism | 1 | Resulting complexity class for allowing two passes over witness in NL? -- (complexity theory nondeterminism)
<p>I know that when an NL Turing machine is allowed to go back and forth freely, the resulting class of problems solvable on it is NP.</p>

<p>But limit of two passes over the witness tape, does not seem... | habedi/stack-exchange-dataset |
66,309 | Advice needed. NLP and ML. Where to start? | <p>Hi fellow computer scientists,</p>

<p>I just began my journey to the world of ML and NLP so please bear with me. I'm hoping to find some guidance here. I would be very grateful if anyone could point me in the right direction (reading materials, lectures, specific algorithms, tools, etc.) for solving the fol... | machine learning natural language processing edit distance | 1 | Advice needed. NLP and ML. Where to start? -- (machine learning natural language processing edit distance)
<p>Hi fellow computer scientists,</p>

<p>I just began my journey to the world of ML and NLP so please bear with me. I'm hoping to find some guidance here. I would be very grateful if anyone could point me... | habedi/stack-exchange-dataset |
66,327 | Building a tree with the heap property from an array and preserving its order | <p>How efficiently can I build a binary tree satisfying the heap property from an array and such that the <strong>inorder traversal of the tree is the original array</strong>?</p>

<p>For example, if I have:</p>

<blockquote>
 <p>2 1 5 6 2 3</p>
</blockquote>

<p>I want to build:</p>&#x... | data structures binary trees heaps | 1 | Building a tree with the heap property from an array and preserving its order -- (data structures binary trees heaps)
<p>How efficiently can I build a binary tree satisfying the heap property from an array and such that the <strong>inorder traversal of the tree is the original array</strong>?</p>

<p>For exampl... | habedi/stack-exchange-dataset |
66,350 | How do I interpret the wording of this passage about abstract binding trees from the book Practical Foundations of Programming Languages | <p>On page 7/8, section 1.2, of <em>Practical Foundations of Programming Languages, 2nd edition</em>, Robert Harper gives this initial definition of abstract binding trees:</p>
<p>The smallest family of sets closed under the conditions</p>
<ol>
<li>If <span class="math-container">$x \in \mathcal{X}_s$</span... | type theory variable binding syntax trees | 1 | How do I interpret the wording of this passage about abstract binding trees from the book Practical Foundations of Programming Languages -- (type theory variable binding syntax trees)
<p>On page 7/8, section 1.2, of <em>Practical Foundations of Programming Languages, 2nd edition</em>, Robert Harper gives this initial d... | habedi/stack-exchange-dataset |
66,353 | Is this a generic way to convert any recursive procedure to tail-recursion? | <p>It seems that I've found a generic way to convert <strong>any</strong> recursive procedure to tail-recursion:</p>

<ol>
<li>Define a helper sub-procedure with an extra "result" parameter.</li>
<li>Apply what would be applied to the procedure's return value to that parameter.</li>
<li>Call this he... | algorithms logic recursion lisp | 1 | Is this a generic way to convert any recursive procedure to tail-recursion? -- (algorithms logic recursion lisp)
<p>It seems that I've found a generic way to convert <strong>any</strong> recursive procedure to tail-recursion:</p>

<ol>
<li>Define a helper sub-procedure with an extra "result" parameter.</li>... | habedi/stack-exchange-dataset |
66,368 | Is it mandatory to define transitions on every possible alphabet in Deterministic Finite Automata? | <p>Tomorrow is my presentation and I want to clear my concepts…</p>

<p>I've read that in DFA, "For each state, transition on all possible symbols (alphabet) should be defined."</p>

<p>Is for each state, defining transition on all possible symbols mandatory in DFA? If its not, then please give any exam... | automata finite automata nondeterminism | 1 | Is it mandatory to define transitions on every possible alphabet in Deterministic Finite Automata? -- (automata finite automata nondeterminism)
<p>Tomorrow is my presentation and I want to clear my concepts…</p>

<p>I've read that in DFA, "For each state, transition on all possible symbols (alphabet) should be ... | habedi/stack-exchange-dataset |
66,372 | Spinlock using cache coherence | <p>Have been trying to understand the image below which shows status of spinlock using cache coherence. Reference is Computer Architecture A Quantitative Approach------------------<br>
Could anybody explain why there is a cache miss in step no.5 when P2 tries to execute swap.<a href="https://i.stack.imgur.com/Q6Yuo... | cpu cache | 1 | Spinlock using cache coherence -- (cpu cache)
<p>Have been trying to understand the image below which shows status of spinlock using cache coherence. Reference is Computer Architecture A Quantitative Approach------------------<br>
Could anybody explain why there is a cache miss in step no.5 when P2 tries to execute... | habedi/stack-exchange-dataset |
66,376 | Find minimum number of time points that cross out all intervals | <p>Say we have a set of time intervals, that may intersect. A time point "marks" all of the intervals that are still unfinished at that time point. I wish to find an algorithm so that I can mark all of the intervals using the least amount of time points. E.g. if all of the intervals have not finished at time 6, one poi... | dynamic programming greedy algorithms intervals | 1 | Find minimum number of time points that cross out all intervals -- (dynamic programming greedy algorithms intervals)
<p>Say we have a set of time intervals, that may intersect. A time point "marks" all of the intervals that are still unfinished at that time point. I wish to find an algorithm so that I can mark all of t... | habedi/stack-exchange-dataset |
66,378 | how to understand time complexity from a plot? | <p>This is my first question here. I'm not a CS at all, so it might be quite trivial. </p>

<p>I have written a program in C where I allocate memory to store a matrix of dimensions <em>n-by-n</em> and then feed a linear algebra subroutine with. I'm having big troubles in understanding how to identify time compl... | algorithms asymptotics runtime analysis experimental analysis | 1 | how to understand time complexity from a plot? -- (algorithms asymptotics runtime analysis experimental analysis)
<p>This is my first question here. I'm not a CS at all, so it might be quite trivial. </p>

<p>I have written a program in C where I allocate memory to store a matrix of dimensions <em>n-by-n</em> a... | habedi/stack-exchange-dataset |
66,382 | How to minimize the cardinality of a set and disjoint partitions subject to constraints in polynomial time? | <p><strong>The real problem I am facing is the following.</strong></p>

<p><em>INSTANCE</em>: I have sets $N:=\{1,\ldots,n\}$ and $K:=\{1,\ldots,k\}$ and matrix $a_{ij}>0$ for all $i\in K$ and $j\in N$. </p>

<p><em>QUESTION</em>: I need to find a subset $S$ of $N$ of size as small as possible and pa... | algorithms optimization | 1 | How to minimize the cardinality of a set and disjoint partitions subject to constraints in polynomial time? -- (algorithms optimization)
<p><strong>The real problem I am facing is the following.</strong></p>

<p><em>INSTANCE</em>: I have sets $N:=\{1,\ldots,n\}$ and $K:=\{1,\ldots,k\}$ and matrix $a_{ij}>0$ ... | habedi/stack-exchange-dataset |
66,389 | Graph with repeated/redundant edges? | <p>Is a graph with two of the same edges a graph? 
Specifically, can this graph be considered a directed graph?</p>

<p><a href="https://i.stack.imgur.com/lMvyY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lMvyY.png" alt="enter image description here"></a></p>
 | graphs | 1 | Graph with repeated/redundant edges? -- (graphs)
<p>Is a graph with two of the same edges a graph? 
Specifically, can this graph be considered a directed graph?</p>

<p><a href="https://i.stack.imgur.com/lMvyY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lMvyY.png" alt="enter image des... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.