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
104,820
How to generate snowflakes of a fixed area as challenges for the FridgeIQ puzzle?
<p>I have been presented a set of FridgeIQ by a friend and she has planted an idea in my head.</p>&#xA;&#xA;<p>FridgeIQ is a geometric disection puzzle consisting of 16 polygonal tiles as seen in the terrible picture near the bottom of this post</p>&#xA;&#xA;<p>The shapes of the tiles are based on a square grid with th...
np hard tiling
1
How to generate snowflakes of a fixed area as challenges for the FridgeIQ puzzle? -- (np hard tiling) <p>I have been presented a set of FridgeIQ by a friend and she has planted an idea in my head.</p>&#xA;&#xA;<p>FridgeIQ is a geometric disection puzzle consisting of 16 polygonal tiles as seen in the terrible picture n...
habedi/stack-exchange-dataset
104,833
Overall time complexity of Heuristical Algorithm for travelling salesman problem [TSP]
<p>I am trying to figure out the time complexity of a heuristical algorithm used to solve the Travelling Salesman Problem in a more efficient way than by brute force, (<span class="math-container">$\theta(n!)$</span> or similar) </p>&#xA;&#xA;<ol>&#xA;<li><p>The first step is to <strong>compute Kruskal's Minimum Spanni...
algorithms graphs time complexity heuristics traveling salesman
1
Overall time complexity of Heuristical Algorithm for travelling salesman problem [TSP] -- (algorithms graphs time complexity heuristics traveling salesman) <p>I am trying to figure out the time complexity of a heuristical algorithm used to solve the Travelling Salesman Problem in a more efficient way than by brute forc...
habedi/stack-exchange-dataset
104,834
Transforming TM with useless state(s)
<p>I'm new to Computation Theory and trying to figure out the undecidability problems. Last night, I came up with the language of TM with a useless state:</p>&#xA;&#xA;<blockquote>&#xA; <p><span class="math-container">$\text{USELESS_TM} = \{ \langle M, q \rangle\mid q\text{ is a useless state in TM }M\}$</span></p>&#x...
turing machines
1
Transforming TM with useless state(s) -- (turing machines) <p>I'm new to Computation Theory and trying to figure out the undecidability problems. Last night, I came up with the language of TM with a useless state:</p>&#xA;&#xA;<blockquote>&#xA; <p><span class="math-container">$\text{USELESS_TM} = \{ \langle M, q \rang...
habedi/stack-exchange-dataset
104,835
What's after EXPSPACE?
<p>As far as I'm aware, EXPSPACE is the most inclusive computational complexity class. I was wondering if/how people conceptualize supersets of EXPSPACE.</p>&#xA;&#xA;<p>Thinking about this question, I came up with a couple thoughts of my own:</p>&#xA;&#xA;<ol>&#xA;<li><p>Maybe EXPSPACE = the set of all Recursively Enu...
complexity theory computability decision problem space complexity
1
What's after EXPSPACE? -- (complexity theory computability decision problem space complexity) <p>As far as I'm aware, EXPSPACE is the most inclusive computational complexity class. I was wondering if/how people conceptualize supersets of EXPSPACE.</p>&#xA;&#xA;<p>Thinking about this question, I came up with a couple th...
habedi/stack-exchange-dataset
104,854
Placing items into compatible bucket types to find an optimal total value
<p>Suppose we have a list of buckets, each with a unique type and a maximum capaciy. We also have a list of items, each with a value and a list of compatible bucket types. An item is compatible with a bucket type iff the item is able to be inserted into a bucket of that type. The goal is to insert the items into the bu...
algorithms combinatorics
1
Placing items into compatible bucket types to find an optimal total value -- (algorithms combinatorics) <p>Suppose we have a list of buckets, each with a unique type and a maximum capaciy. We also have a list of items, each with a value and a list of compatible bucket types. An item is compatible with a bucket type iff...
habedi/stack-exchange-dataset
104,876
Finding max value algorithm with subset comparison
<p>I have a set of <span class="math-container">$N$</span> different values, and my goal is to find the biggest one in the least number of comparisons. Comparing subsets (using the sum of each) is also allowed, and counts as one comparison.</p>&#xA;&#xA;<p>The intuitive algorithm would be comparing them linearly: compa...
algorithms algorithm design
1
Finding max value algorithm with subset comparison -- (algorithms algorithm design) <p>I have a set of <span class="math-container">$N$</span> different values, and my goal is to find the biggest one in the least number of comparisons. Comparing subsets (using the sum of each) is also allowed, and counts as one compari...
habedi/stack-exchange-dataset
104,884
Show: "Checking no solution for system of linear equations with integer variables and coefficients" $\in \mathbf{NP}$
<p>I've been struggling for a while trying to solve this problem:</p>&#xA;&#xA;<p>Show that the following problem is in <span class="math-container">$\mathbf{NP}$</span>:</p>&#xA;&#xA;<blockquote>&#xA; <p>Check that a system of linear equations with <span class="math-container">$m$</span> integer variables and&#xA; i...
turing machines np decision problem complexity classes
1
Show: "Checking no solution for system of linear equations with integer variables and coefficients" $\in \mathbf{NP}$ -- (turing machines np decision problem complexity classes) <p>I've been struggling for a while trying to solve this problem:</p>&#xA;&#xA;<p>Show that the following problem is in <span class="math-cont...
habedi/stack-exchange-dataset
104,889
Why cannot we enumerate all Turing machines that have no fixed point?
<p>The language</p>&#xA;&#xA;<p><span class="math-container">$$&#xA;L_1 = \{w \in \{0, 1\}^\ast \mid \exists x \in \{0, 1\}^\ast\colon M_w(x) = x\}&#xA;$$</span></p>&#xA;&#xA;<p><sub>(<span class="math-container">$w$</span> is an encoding of a DTM, <span class="math-container">$M_w$</span> is the respective DTM.)</sub>...
turing machines undecidability nondeterminism
1
Why cannot we enumerate all Turing machines that have no fixed point? -- (turing machines undecidability nondeterminism) <p>The language</p>&#xA;&#xA;<p><span class="math-container">$$&#xA;L_1 = \{w \in \{0, 1\}^\ast \mid \exists x \in \{0, 1\}^\ast\colon M_w(x) = x\}&#xA;$$</span></p>&#xA;&#xA;<p><sub>(<span class="ma...
habedi/stack-exchange-dataset
104,890
How does paxos algorithm handle partial failures of accept messages?
<p>I've been reading the basic paxos algorithm from the "Paxos Made Simple" paper. I can't understand how paxos algorithm maintains the safety properties under partial failures of the accept messages, meaning cases where the proposer receives prepare responses from a majority, but the subsequent accept message does not...
distributed systems consensus
1
How does paxos algorithm handle partial failures of accept messages? -- (distributed systems consensus) <p>I've been reading the basic paxos algorithm from the "Paxos Made Simple" paper. I can't understand how paxos algorithm maintains the safety properties under partial failures of the accept messages, meaning cases w...
habedi/stack-exchange-dataset
104,894
Decision problem that can be verified but not run in n^2 time
<p>A much much weaker idea similar to the P=NP question, is there a decision problem that can be verified in <span class="math-container">$O(n^2)$</span> time, but it can be proven that there is no algorithm that decides it <span class="math-container">$O(n^2)$</span> time?</p>&#xA;
time complexity
1
Decision problem that can be verified but not run in n^2 time -- (time complexity) <p>A much much weaker idea similar to the P=NP question, is there a decision problem that can be verified in <span class="math-container">$O(n^2)$</span> time, but it can be proven that there is no algorithm that decides it <span class="...
habedi/stack-exchange-dataset
104,897
Does an optimal path imply the heuristic is admissible?
<p>If we are given an A<span class="math-container">$^*$</span> path search with some heuristic <span class="math-container">$h$</span> that yields an optimal path, without knowing that the heuristic is admissible beforehand, would this imply that <span class="math-container">$h$</span> is admissible?</p>&#xA;
artificial intelligence heuristics a star search
1
Does an optimal path imply the heuristic is admissible? -- (artificial intelligence heuristics a star search) <p>If we are given an A<span class="math-container">$^*$</span> path search with some heuristic <span class="math-container">$h$</span> that yields an optimal path, without knowing that the heuristic is admissi...
habedi/stack-exchange-dataset
104,900
Reducing 3SAT to a Set Splitting Problem
<p>I want to be able to reduce the 3SAT problem to a flavor of set-splitting problem. Basically, given <span class="math-container">$n$</span> items and <span class="math-container">$m$</span> subsets <span class="math-container">$S_1, S_2,...,S_m$</span> of these items I want a yes or no answer based upon the fact if ...
np complete np hard np decision problem
1
Reducing 3SAT to a Set Splitting Problem -- (np complete np hard np decision problem) <p>I want to be able to reduce the 3SAT problem to a flavor of set-splitting problem. Basically, given <span class="math-container">$n$</span> items and <span class="math-container">$m$</span> subsets <span class="math-container">$S_1...
habedi/stack-exchange-dataset
104,901
avl trees rotations question
<p><a href="https://i.stack.imgur.com/VXzkH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VXzkH.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>As you can see in this tree its unbalanced at the root with a balanced factor of <span class="math-container">$-2$</span>. You can also perfor...
binary search trees avl trees
1
avl trees rotations question -- (binary search trees avl trees) <p><a href="https://i.stack.imgur.com/VXzkH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/VXzkH.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>As you can see in this tree its unbalanced at the root with a balanced factor ...
habedi/stack-exchange-dataset
104,911
How to create RGB-colors with equal vector norm?
<p>I am trying to do the following:</p>&#xA;&#xA;<ol>&#xA;<li>Interprete RGB color values as a 3-D vektor</li>&#xA;<li>Transform the RGB color into polar coordinates L, teta and phi </li>&#xA;<li>Create colors with constant L</li>&#xA;</ol>&#xA;&#xA;<p>The math behind this is the standard <a href="https://en.wikipedia....
colorings
1
How to create RGB-colors with equal vector norm? -- (colorings) <p>I am trying to do the following:</p>&#xA;&#xA;<ol>&#xA;<li>Interprete RGB color values as a 3-D vektor</li>&#xA;<li>Transform the RGB color into polar coordinates L, teta and phi </li>&#xA;<li>Create colors with constant L</li>&#xA;</ol>&#xA;&#xA;<p>The...
habedi/stack-exchange-dataset
104,913
Selection of dates respecting delay constraints
<p>I encountered an issue at work that can be derived approximatively to this problem.</p>&#xA;&#xA;<p>Let say we have a machine that can be triggered to instantly do an action. There are several (between 10 to 15) possible triggering times per day.</p>&#xA;&#xA;<p>I have to select exactly 5 times per day (between 00:0...
algorithms optimization constraint satisfaction
1
Selection of dates respecting delay constraints -- (algorithms optimization constraint satisfaction) <p>I encountered an issue at work that can be derived approximatively to this problem.</p>&#xA;&#xA;<p>Let say we have a machine that can be triggered to instantly do an action. There are several (between 10 to 15) poss...
habedi/stack-exchange-dataset
104,914
Why language is not regular
<p>Taken from site "Geeks For Geeks".&#xA;The lemma: "A concatenation of pattern(regular) and a non-pattern(not-regular) is also not regular language."</p>&#xA;&#xA;<p>example: <span class="math-container">$\left \{L={a^{n}b^{2m}|n\geq 1,m\geq 1} \right \}$</span></p>&#xA;&#xA;<p>I think I managed to build dfa (q2 is a...
regular languages automata finite automata
1
Why language is not regular -- (regular languages automata finite automata) <p>Taken from site "Geeks For Geeks".&#xA;The lemma: "A concatenation of pattern(regular) and a non-pattern(not-regular) is also not regular language."</p>&#xA;&#xA;<p>example: <span class="math-container">$\left \{L={a^{n}b^{2m}|n\geq 1,m\geq ...
habedi/stack-exchange-dataset
104,915
Efficient algorithm to replace list of integers with nearest bigger element
<p>The original question was in the context of an array, but I just used a list without changing the length for easier debugging purposes of <code>toString()</code>.</p>&#xA;&#xA;<blockquote>&#xA; <p>Given an unsorted list of integers, design a O(n) algorithm to transform the list such that the integers are replaced b...
algorithms arrays
1
Efficient algorithm to replace list of integers with nearest bigger element -- (algorithms arrays) <p>The original question was in the context of an array, but I just used a list without changing the length for easier debugging purposes of <code>toString()</code>.</p>&#xA;&#xA;<blockquote>&#xA; <p>Given an unsorted li...
habedi/stack-exchange-dataset
104,917
Behavior of specific PDA for a certain input
<p>Suppose we're given the non-deterministic PDA shown below which reads from the alphabet <span class="math-container">$\sum = \lbrace a,b \rbrace$</span>. How will this PDA behave if we pass it the string <span class="math-container">$ba$</span>? We read <span class="math-container">$b$</span> first and push <span cl...
complexity theory finite automata pushdown automata
1
Behavior of specific PDA for a certain input -- (complexity theory finite automata pushdown automata) <p>Suppose we're given the non-deterministic PDA shown below which reads from the alphabet <span class="math-container">$\sum = \lbrace a,b \rbrace$</span>. How will this PDA behave if we pass it the string <span class...
habedi/stack-exchange-dataset
104,928
Does a Context-free language have a grammar that has either 3 or 0 nonterminals on the right hand side?
<p>Is the following true or false? Why?</p>&#xA;&#xA;<p>Let L be a context-free language with <span class="math-container">$\epsilon\notin$</span> L. Then there is <span class="math-container">$\epsilon$</span>-free grammar <span class="math-container">$G=(V,\Sigma, P,S )$</span> with <span class="math-container">$L (G...
formal languages context free formal grammars
1
Does a Context-free language have a grammar that has either 3 or 0 nonterminals on the right hand side? -- (formal languages context free formal grammars) <p>Is the following true or false? Why?</p>&#xA;&#xA;<p>Let L be a context-free language with <span class="math-container">$\epsilon\notin$</span> L. Then there is <...
habedi/stack-exchange-dataset
104,929
Is there a way a proving a language regular/non-regular that works for every possible language?
<p>In my theory of computing class, we've been talking about how to prove languages regular and non-regular. I've heard of methods like the pumping lemma and Kolmogorov complexity to prove languages non-regular, while proving languages regular revolves around building a DFA, or using the Myhill-Nerode theorem. All of t...
formal languages regular languages automata finite automata
1
Is there a way a proving a language regular/non-regular that works for every possible language? -- (formal languages regular languages automata finite automata) <p>In my theory of computing class, we've been talking about how to prove languages regular and non-regular. I've heard of methods like the pumping lemma and K...
habedi/stack-exchange-dataset
104,933
Reducing the vertex cover problem to a variation of the vertex cover problem
<p>The following variation on the vertex cover problem was given:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given is an instance of graph <span class="math-container">$G = (V, E)$</span>. Does <span class="math-container">$G$</span> have a vertex cover of size at most <span class="math-container">$\frac{|V|}{4}$</span>?</p>&#...
complexity theory graphs np complete reductions np hard
1
Reducing the vertex cover problem to a variation of the vertex cover problem -- (complexity theory graphs np complete reductions np hard) <p>The following variation on the vertex cover problem was given:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given is an instance of graph <span class="math-container">$G = (V, E)$</span>. D...
habedi/stack-exchange-dataset
104,952
Simple way to prove $\left \{ 0^{n}1^{m} \mid (n-m) \bmod 5=0 \right \}$ is regular?
<p>Prove: <span class="math-container">$\left \{ 0^{n}1^{m} \mid (n-m) \bmod 5=0 \right \}$</span> is regular.</p>&#xA;&#xA;<p>Is it reasonable to get a DFA with at least 30 states for this language? is there an easier way to prove it is regular?</p>&#xA;
regular languages finite automata
1
Simple way to prove $\left \{ 0^{n}1^{m} \mid (n-m) \bmod 5=0 \right \}$ is regular? -- (regular languages finite automata) <p>Prove: <span class="math-container">$\left \{ 0^{n}1^{m} \mid (n-m) \bmod 5=0 \right \}$</span> is regular.</p>&#xA;&#xA;<p>Is it reasonable to get a DFA with at least 30 states for this langua...
habedi/stack-exchange-dataset
104,955
Is the set of language decidable by some Turing machine computing in some given computable time bound decidable
<p>Let <span class="math-container">$T : \mathbb N \to \mathbb N$</span> be some computable function. Then by <span class="math-container">$\mathcal C_T$</span> we denote the class of languages decidable by a deterministic Turing machine in at most <span class="math-container">$T(|w|)$</span> steps for an input <span c...
turing machines computability undecidability decision problem
1
Is the set of language decidable by some Turing machine computing in some given computable time bound decidable -- (turing machines computability undecidability decision problem) <p>Let <span class="math-container">$T : \mathbb N \to \mathbb N$</span> be some computable function. Then by <span class="math-container">$\...
habedi/stack-exchange-dataset
104,956
Maximum number of nodes connected when the link has a large buffer
<p>A link of capacity 100 Mbps is carrying traffic from a number of sources. Each source generates an on-off traffic stream;when the source is on, the rate of traffic is 10 Mbps, and when the source is off, the rate of traffic is zero. The duty cycle,which is the ratio of on-time to off-time, is 1 : 2Assuming that all ...
computer architecture computer networks
1
Maximum number of nodes connected when the link has a large buffer -- (computer architecture computer networks) <p>A link of capacity 100 Mbps is carrying traffic from a number of sources. Each source generates an on-off traffic stream;when the source is on, the rate of traffic is 10 Mbps, and when the source is off, t...
habedi/stack-exchange-dataset
104,970
Fine-grained complexity of 3-CNF formula evaluation
<p>It's well known that 3-SAT is in NP, which means that one can evaluate a 3-CNF formula in polynomial time. However, I was wondering what the tightest upper bound is for formula verification, expressed in big-O notation or some other way.</p>&#xA;&#xA;<p>My best guess is that 3-CNF formulas can be verified in linear ...
time complexity satisfiability decision problem 3 sat sat solvers
1
Fine-grained complexity of 3-CNF formula evaluation -- (time complexity satisfiability decision problem 3 sat sat solvers) <p>It's well known that 3-SAT is in NP, which means that one can evaluate a 3-CNF formula in polynomial time. However, I was wondering what the tightest upper bound is for formula verification, exp...
habedi/stack-exchange-dataset
104,981
(Generally) How to specify asynchronous action with side effects using logic equations
<p>Say you have this function call sequence:</p>&#xA;&#xA;<pre><code>function all() {&#xA; fn1()&#xA; fn2()&#xA; fn3()&#xA;}&#xA;</code></pre>&#xA;&#xA;<p>And say that <code>fn2</code> was asynchronous and caused all kinds of side effects:</p>&#xA;&#xA;<pre><code>var globalPacketCounter = 0&#xA;&#xA;function fn2() {...
logic formal methods software verification model checking
1
(Generally) How to specify asynchronous action with side effects using logic equations -- (logic formal methods software verification model checking) <p>Say you have this function call sequence:</p>&#xA;&#xA;<pre><code>function all() {&#xA; fn1()&#xA; fn2()&#xA; fn3()&#xA;}&#xA;</code></pre>&#xA;&#xA;<p>And say that...
habedi/stack-exchange-dataset
104,982
Proof of Space Hierarchy Theorem incompatible with Linear Speed Up Theorem for time
<p>In <a href="https://en.wikipedia.org/wiki/Space_hierarchy_theorem" rel="nofollow noreferrer">this proof of the Space Hierarchy Theorem</a> the following language is defined&#xA;<span class="math-container">$$&#xA; L = \{ (\langle M \rangle, 10^k) : M \mbox{ does not accept } (\langle M \rangle, 10^k) \mbox{ using s...
complexity theory turing machines computability space complexity
1
Proof of Space Hierarchy Theorem incompatible with Linear Speed Up Theorem for time -- (complexity theory turing machines computability space complexity) <p>In <a href="https://en.wikipedia.org/wiki/Space_hierarchy_theorem" rel="nofollow noreferrer">this proof of the Space Hierarchy Theorem</a> the following language i...
habedi/stack-exchange-dataset
104,987
How to model a logical indicator when two inequalities hold in Integer Programming?
<p>I have an IP program where <span class="math-container">$\forall i \in I, j \in J$</span> my decision variables are <span class="math-container">$x_{i,j}$</span>. I have two sets of inequalities (one inequality for every <span class="math-container">$i,j$</span> pair) that are of interest which are <span class="math...
integer programming constraint programming
1
How to model a logical indicator when two inequalities hold in Integer Programming? -- (integer programming constraint programming) <p>I have an IP program where <span class="math-container">$\forall i \in I, j \in J$</span> my decision variables are <span class="math-container">$x_{i,j}$</span>. I have two sets of ine...
habedi/stack-exchange-dataset
104,995
How to perform measurement of a qubit?
<p>I am trying to implement the <a href="https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm" rel="nofollow noreferrer">Deutsch algorithm</a>.&#xA;My steps were:</p>&#xA;&#xA;<ol>&#xA;<li>Write down <span class="math-container">$|01\rangle$</span> in a matrix form <span class="math-container">$A$</span>;</li>...
quantum computing
1
How to perform measurement of a qubit? -- (quantum computing) <p>I am trying to implement the <a href="https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm" rel="nofollow noreferrer">Deutsch algorithm</a>.&#xA;My steps were:</p>&#xA;&#xA;<ol>&#xA;<li>Write down <span class="math-container">$|01\rangle$</span> ...
habedi/stack-exchange-dataset
104,999
Don’t understanding argument on words of a certain form
<p>In my book they use the following argument which I don’t understand : </p>&#xA;&#xA;<blockquote>&#xA; <p>Let <span class="math-container">$L$</span> be a langage such that there is <span class="math-container">$m_1, ..., m_k \in \Sigma^*$</span> such that <span class="math-container">$ L \subset m_1^*...m_k^*$</spa...
automata word combinatorics
1
Don’t understanding argument on words of a certain form -- (automata word combinatorics) <p>In my book they use the following argument which I don’t understand : </p>&#xA;&#xA;<blockquote>&#xA; <p>Let <span class="math-container">$L$</span> be a langage such that there is <span class="math-container">$m_1, ..., m_k \i...
habedi/stack-exchange-dataset
105,026
Number of FLOPs (floating point operations) for exponentiation
<p>What is the number of floating point operations needed to perform exponentiation (power of)? </p>&#xA;&#xA;<p>Assuming multiplication of two floats use one FLOP, the number of operations for <span class="math-container">$x^n$</span> will be <span class="math-container">$n-1$</span>. However, is there a faster way to...
algorithms arithmetic floating point
1
Number of FLOPs (floating point operations) for exponentiation -- (algorithms arithmetic floating point) <p>What is the number of floating point operations needed to perform exponentiation (power of)? </p>&#xA;&#xA;<p>Assuming multiplication of two floats use one FLOP, the number of operations for <span class="math-con...
habedi/stack-exchange-dataset
105,031
Which unit (control unite or logic unit) issue instructions of load/store?
<p>I learned that the CPU is composed of two units</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/sL8w2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sL8w2.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>and the machine’s instructions can be categorized into three groupings: (1) t...
cpu
1
Which unit (control unite or logic unit) issue instructions of load/store? -- (cpu) <p>I learned that the CPU is composed of two units</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/sL8w2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sL8w2.png" alt="enter image description here"></a></p>&#xA;&...
habedi/stack-exchange-dataset
105,034
Greedy algorithm for even item distribution
<p>I have this problem where I need to design a greedy algorithm. The problem is as follows:</p>&#xA;&#xA;<p>A chocolate factory owns <span class="math-container">$n$</span> stores, which are connected by a single road. Each store has a limited supply <span class="math-container">$c_i$</span> of chocolates. Furthermore...
algorithms greedy algorithms algorithm design
1
Greedy algorithm for even item distribution -- (algorithms greedy algorithms algorithm design) <p>I have this problem where I need to design a greedy algorithm. The problem is as follows:</p>&#xA;&#xA;<p>A chocolate factory owns <span class="math-container">$n$</span> stores, which are connected by a single road. Each ...
habedi/stack-exchange-dataset
105,037
How is Pure Maths utilized in Computer Science research?
<p>How can People with a background in Mathematics pursue PhD in Computer Science"</p>&#xA;&#xA;<p>Although I have a Postgraduate degree in Mathematics with basic programming knowledge,it sounded quite interesting how knowledge in Mathematics can help to solve Computer Science Research Problems.</p>&#xA;&#xA;<p>Since t...
research
1
How is Pure Maths utilized in Computer Science research? -- (research) <p>How can People with a background in Mathematics pursue PhD in Computer Science"</p>&#xA;&#xA;<p>Although I have a Postgraduate degree in Mathematics with basic programming knowledge,it sounded quite interesting how knowledge in Mathematics can he...
habedi/stack-exchange-dataset
105,053
How the operating system allocated to dual-channels memory?
<p>I learned that the boot loader transmit the operating system from Hard Disk to Main Memory during the booting process.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/XNIDO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XNIDO.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>I wonde...
operating systems
1
How the operating system allocated to dual-channels memory? -- (operating systems) <p>I learned that the boot loader transmit the operating system from Hard Disk to Main Memory during the booting process.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/XNIDO.png" rel="nofollow noreferrer"><img src="https://i.stack.i...
habedi/stack-exchange-dataset
105,065
Why is this code uniquely decodable?
<p>Source alphabet: <span class="math-container">$\{a, b, c, d, e, f\}$</span></p>&#xA;&#xA;<p>Code alphabet: <span class="math-container">$\{0, 1\}$</span></p>&#xA;&#xA;<ul>&#xA;<li><span class="math-container">$a\colon 0101$</span></li>&#xA;<li><span class="math-container">$b\colon 1001$</span></li>&#xA;<li><span cla...
encoding scheme
1
Why is this code uniquely decodable? -- (encoding scheme) <p>Source alphabet: <span class="math-container">$\{a, b, c, d, e, f\}$</span></p>&#xA;&#xA;<p>Code alphabet: <span class="math-container">$\{0, 1\}$</span></p>&#xA;&#xA;<ul>&#xA;<li><span class="math-container">$a\colon 0101$</span></li>&#xA;<li><span class="ma...
habedi/stack-exchange-dataset
105,070
DFA of (aa+bb)(a+b)* + (a+b)*(aa+bb)?
<p>Our class teacher gave us a descriptive definition of a language in a Quiz today and ask us to make its DFA. In the middle of quiz he also told us the <a href="https://www.cs.rochester.edu/~nelson/courses/csc_173/fa/re.html" rel="nofollow noreferrer"><strong>Regular Expression</strong></a>(RE) of that language but w...
regular languages automata finite automata regular expressions kleene star
1
DFA of (aa+bb)(a+b)* + (a+b)*(aa+bb)? -- (regular languages automata finite automata regular expressions kleene star) <p>Our class teacher gave us a descriptive definition of a language in a Quiz today and ask us to make its DFA. In the middle of quiz he also told us the <a href="https://www.cs.rochester.edu/~nelson/co...
habedi/stack-exchange-dataset
105,079
Reading elements of a countable set with Turing machine
<p>I have a basic question about the behavior of a potential Turing machine.</p>&#xA;&#xA;<p>Suppose that <span class="math-container">$S$</span> is a countable set of binary strings, so that we can enumerate <span class="math-container">$S$</span> as <span class="math-container">$(s_i)_{n\in \mathbb{N}}$</span>. </p>&...
algorithms turing machines computability
1
Reading elements of a countable set with Turing machine -- (algorithms turing machines computability) <p>I have a basic question about the behavior of a potential Turing machine.</p>&#xA;&#xA;<p>Suppose that <span class="math-container">$S$</span> is a countable set of binary strings, so that we can enumerate <span cla...
habedi/stack-exchange-dataset
105,089
Prove the languages |L<M>| = 2 and |L<M>| $\not=$ 2 to be non-Turing recognizable or non-recursively enumerable
<p>I am trying to prove the <strong>non</strong>-recursively enumerable property of two languages.</p>&#xA;&#xA;<p><span class="math-container">$L_2 = \{\langle M \rangle: |L\langle M \rangle| = 2\}$</span> and<br>&#xA;<span class="math-container">$L_{\not=2} = \{\langle M \rangle: |L\langle M \rangle| \not= 2\}$</span...
turing machines computability reductions semi decidability
1
Prove the languages |L<M>| = 2 and |L<M>| $\not=$ 2 to be non-Turing recognizable or non-recursively enumerable -- (turing machines computability reductions semi decidability) <p>I am trying to prove the <strong>non</strong>-recursively enumerable property of two languages.</p>&#xA;&#xA;<p><span class="math-container">...
habedi/stack-exchange-dataset
105,091
If a NAND gate is universal, why you don't have NAND OISCs
<p>If a <a href="https://en.wikipedia.org/wiki/NAND_logic" rel="nofollow noreferrer">NAND</a> gate can be used to construct all other of the basic logic gates, then I'm wondering why you don't/can't have a purely NAND-based <a href="https://en.wikipedia.org/wiki/One_instruction_set_computer" rel="nofollow noreferrer">O...
computer architecture logic circuits
1
If a NAND gate is universal, why you don't have NAND OISCs -- (computer architecture logic circuits) <p>If a <a href="https://en.wikipedia.org/wiki/NAND_logic" rel="nofollow noreferrer">NAND</a> gate can be used to construct all other of the basic logic gates, then I'm wondering why you don't/can't have a purely NAND-b...
habedi/stack-exchange-dataset
105,093
Find the smallest set of strings which "covers" a given set of strings (coverage = containing as substring)
<p>Let <span class="math-container">$S$</span> be a finite set of strings and <span class="math-container">$0 &lt; k\leq l$</span> integers. We want to find the smallest set of strings <span class="math-container">$T(k,l)$</span> for which the following holds:</p>&#xA;&#xA;<ul>&#xA;<li><span class="math-container">$\fo...
algorithms time complexity approximation strings substrings
1
Find the smallest set of strings which "covers" a given set of strings (coverage = containing as substring) -- (algorithms time complexity approximation strings substrings) <p>Let <span class="math-container">$S$</span> be a finite set of strings and <span class="math-container">$0 &lt; k\leq l$</span> integers. We wan...
habedi/stack-exchange-dataset
105,118
Are comparison sort algos appropriate for SUBJECTIVE sorting?
<p>I've been tasked with creating an online feature that ranks 50 fantasy characters from a variety of domains based on combat acumen and polls users one which one is the most powerful based on their votes on a series of face-to-face matchups. (Spiderman vs. Jon Snow, etc. etc.). If this is designed well, we hope to at...
sorting comparison heap sort
1
Are comparison sort algos appropriate for SUBJECTIVE sorting? -- (sorting comparison heap sort) <p>I've been tasked with creating an online feature that ranks 50 fantasy characters from a variety of domains based on combat acumen and polls users one which one is the most powerful based on their votes on a series of fac...
habedi/stack-exchange-dataset
105,124
Finding maximum takes at least $\lceil n/2 \rceil$ comparisons
<p>We are given an array <span class="math-container">$A$</span> with <span class="math-container">$n$</span> elements, <span class="math-container">$n \in \mathbb{N}$</span> and all elements are in the set <span class="math-container">$\{1,2,3, \cdots, n \}$</span>.</p>&#xA;&#xA;<p>I want to prove that finding the max...
proof techniques arrays lower bounds comparison decision tree
1
Finding maximum takes at least $\lceil n/2 \rceil$ comparisons -- (proof techniques arrays lower bounds comparison decision tree) <p>We are given an array <span class="math-container">$A$</span> with <span class="math-container">$n$</span> elements, <span class="math-container">$n \in \mathbb{N}$</span> and all element...
habedi/stack-exchange-dataset
105,126
Sorting strings with "before" and "after" constraints
<p>I'm trying to solve a constraint-satisfaction problem for a project of mine that seems like it should have a well-known solution, but I can't for the life of me seem to find it described anywhere.</p>&#xA;&#xA;<p>I've been poring over what literature I can find about CSP's and none of the general stuff seems to be c...
sorting constraint satisfaction
1
Sorting strings with "before" and "after" constraints -- (sorting constraint satisfaction) <p>I'm trying to solve a constraint-satisfaction problem for a project of mine that seems like it should have a well-known solution, but I can't for the life of me seem to find it described anywhere.</p>&#xA;&#xA;<p>I've been por...
habedi/stack-exchange-dataset
105,137
Doing matrix multiplication with $\lceil n^3 / \log n \rceil$ processors in $2\log n$ steps by Brent's principle
<p>On a parallel machine with <span class="math-container">$n$</span> processors we can compute the sum (or product, or the result of any associative operation) on <span class="math-container">$n$</span> numbers in <span class="math-container">$\log n$</span> steps. In the first step combine neighbors to get <span clas...
complexity theory computation models parallel computing
1
Doing matrix multiplication with $\lceil n^3 / \log n \rceil$ processors in $2\log n$ steps by Brent's principle -- (complexity theory computation models parallel computing) <p>On a parallel machine with <span class="math-container">$n$</span> processors we can compute the sum (or product, or the result of any associat...
habedi/stack-exchange-dataset
105,140
Proof that a subtree of a red-black tree has no more than $\frac{3n}{4}$ nodes
<p>I have a red-black tree with <span class="math-container">$n$</span> nodes, rooted at <span class="math-container">$x$</span>. How can I prove or disprove that the number of nodes in any subtree of <span class="math-container">$x$</span> (including the root of the subtree) will never be greater than <span class="mat...
data structures binary search trees red black trees
1
Proof that a subtree of a red-black tree has no more than $\frac{3n}{4}$ nodes -- (data structures binary search trees red black trees) <p>I have a red-black tree with <span class="math-container">$n$</span> nodes, rooted at <span class="math-container">$x$</span>. How can I prove or disprove that the number of nodes i...
habedi/stack-exchange-dataset
105,144
Turing Machine where branches are resolved via arbitrary operator
<p>Alternating Turing Machines output Boolean values and combine the values returned by branches via the <code>any</code>/<code>all</code> operators. Is there a name or theory behind the class of Turing Machines where there is no restriction to the Boolean space and the <code>any</code>/<code>all</code> operators?</p>&...
complexity theory turing machines optimization terminology logic
1
Turing Machine where branches are resolved via arbitrary operator -- (complexity theory turing machines optimization terminology logic) <p>Alternating Turing Machines output Boolean values and combine the values returned by branches via the <code>any</code>/<code>all</code> operators. Is there a name or theory behind t...
habedi/stack-exchange-dataset
105,149
Meaning of polynomially larger or smaller in the context of the master method
<p>I'm studying the master method of solving recurrences and I have a somewhat decent math background but I'm having difficulty understanding the concept of <span class="math-container">$n^{\log_ba}$</span> being polynomially smaller or larger than <span class="math-container">$f(n)$</span>.</p>&#xA;&#xA;<p>What I mean...
asymptotics master theorem polynomials
1
Meaning of polynomially larger or smaller in the context of the master method -- (asymptotics master theorem polynomials) <p>I'm studying the master method of solving recurrences and I have a somewhat decent math background but I'm having difficulty understanding the concept of <span class="math-container">$n^{\log_ba}...
habedi/stack-exchange-dataset
105,151
(Non) Context Free language?
<p>In an exam question it is asked to identify if the given language is Context-Free, Non Context Free or Regular.&#xA;This is the question :</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/rue3b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rue3b.png" alt="Question"></a></p>&#xA;&#xA;<p>In my o...
automata
1
(Non) Context Free language? -- (automata) <p>In an exam question it is asked to identify if the given language is Context-Free, Non Context Free or Regular.&#xA;This is the question :</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/rue3b.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rue3b.png" ...
habedi/stack-exchange-dataset
105,156
Sampling numbers from a weighted set that sum to constant value
<p>So I have a multi-set of positive integers <span class="math-container">$S = \{n_1, n_2, \dots\}$</span> with associated weights <span class="math-container">$W = \{w_1, w_2, \dots\}$</span>. I want to sample some numbers, without replacement, from <span class="math-container">$S$</span> according to weights <span c...
algorithms combinatorics probability theory sampling
1
Sampling numbers from a weighted set that sum to constant value -- (algorithms combinatorics probability theory sampling) <p>So I have a multi-set of positive integers <span class="math-container">$S = \{n_1, n_2, \dots\}$</span> with associated weights <span class="math-container">$W = \{w_1, w_2, \dots\}$</span>. I w...
habedi/stack-exchange-dataset
105,157
residual graph and augmenting path in max flow
<p>I thought I understood max flow perfectly until I got to the exam and we got this. I know how to compute a maximum flow by means of the Ford-Fulkerson algorithm, specify the residual network and augmenting path. But here they gave us a graph where some of the capacities were already full (if you can tell from the pi...
algorithms graphs network flow
1
residual graph and augmenting path in max flow -- (algorithms graphs network flow) <p>I thought I understood max flow perfectly until I got to the exam and we got this. I know how to compute a maximum flow by means of the Ford-Fulkerson algorithm, specify the residual network and augmenting path. But here they gave us ...
habedi/stack-exchange-dataset
105,162
What is language density used for?
<p>If we have a langage <span class="math-container">$L$</span> over an alphabet <span class="math-container">$\Sigma$</span>, then we can defined the density function of <span class="math-container">$L$</span> as :</p>&#xA;&#xA;<blockquote>&#xA; <p><span class="math-container">$$ p_L(n) = | L \cap \Sigma^n | $$</span...
formal languages word combinatorics
1
What is language density used for? -- (formal languages word combinatorics) <p>If we have a langage <span class="math-container">$L$</span> over an alphabet <span class="math-container">$\Sigma$</span>, then we can defined the density function of <span class="math-container">$L$</span> as :</p>&#xA;&#xA;<blockquote>&#x...
habedi/stack-exchange-dataset
105,163
To check if a chain with $n$ links can be "folded" into a size at most $L$
<p>Given a chain of <span class="math-container">$n$</span> links, each of length <span class="math-container">$a_1, a_2,..a_n$</span>, where each <span class="math-container">$a_i$</span> is a positive integer. <span class="math-container">$L$</span> defines the length of the "folded" chain. More formally, we want to ...
algorithms graphs asymptotics dynamic programming
1
To check if a chain with $n$ links can be "folded" into a size at most $L$ -- (algorithms graphs asymptotics dynamic programming) <p>Given a chain of <span class="math-container">$n$</span> links, each of length <span class="math-container">$a_1, a_2,..a_n$</span>, where each <span class="math-container">$a_i$</span> i...
habedi/stack-exchange-dataset
105,172
Build a balanced binary tree from list in linear time
<p>I couldn't figure this one out. Given an unsorted list, we want to build a balanced binary tree (not a search tree, namely - left child is of lower key, and right child of higher key). Can we do it in linear time? <strong>Thanks!</strong></p>&#xA;
data structures binary trees
1
Build a balanced binary tree from list in linear time -- (data structures binary trees) <p>I couldn't figure this one out. Given an unsorted list, we want to build a balanced binary tree (not a search tree, namely - left child is of lower key, and right child of higher key). Can we do it in linear time? <strong>Thanks!...
habedi/stack-exchange-dataset
105,187
Fenwick Tree/ Binary Index Tree Interval location
<p>I have an array of positive numbers, and when calculating the cumulative sum of this array, want to know which interval a given point will lie in.</p>&#xA;&#xA;<p>I have done this by searching linearly through an array, but want to use Fenwick trees in the hopes the speed up will be noticeable. I've followed tutoria...
data structures
1
Fenwick Tree/ Binary Index Tree Interval location -- (data structures) <p>I have an array of positive numbers, and when calculating the cumulative sum of this array, want to know which interval a given point will lie in.</p>&#xA;&#xA;<p>I have done this by searching linearly through an array, but want to use Fenwick tr...
habedi/stack-exchange-dataset
105,208
Whether it's necessary for a grammar to be ambiguous when it is both left recursive and right recursive
<p>I read somewhere that if a grammar is left recursive as well as right recursive, then it is not necessarily ambiguous. </p>&#xA;&#xA;<p>I couldn't make up my mind on this statement. How can a grammar which is both left recursive as well as right recursive not have more than one parse tree for a single string. </p>&...
context free compilers recursion parsers
1
Whether it's necessary for a grammar to be ambiguous when it is both left recursive and right recursive -- (context free compilers recursion parsers) <p>I read somewhere that if a grammar is left recursive as well as right recursive, then it is not necessarily ambiguous. </p>&#xA;&#xA;<p>I couldn't make up my mind on t...
habedi/stack-exchange-dataset
105,209
When an algorithm says Summation this, and Integral that, what does it mean in coding terms?
<p>I'm a student at a college with only two units of mathematics and I don't know if I'm asking in the right place so please bear with me. </p>&#xA;&#xA;<p>I'm currently reading GPU Gems by nvidia and I have a question. It uses Sigma, as in summation, and integral a lot, but when look at the implementation of some of t...
algorithms numerical algorithms computer algebra
1
When an algorithm says Summation this, and Integral that, what does it mean in coding terms? -- (algorithms numerical algorithms computer algebra) <p>I'm a student at a college with only two units of mathematics and I don't know if I'm asking in the right place so please bear with me. </p>&#xA;&#xA;<p>I'm currently rea...
habedi/stack-exchange-dataset
105,212
How many iterations does the Bellman-Ford algorithm need for directed and undirected graphs
<p>The Bellman-Ford algorithm on a graph with <span class="math-container">$n$</span> vertices, normally includes a loop executed <span class="math-container">$n-1$</span> times. Each time through the loop we iterate over the list of edges <span class="math-container">$(u,v)$</span> and relax <span class="math-containe...
algorithms graphs algorithm analysis shortest path
1
How many iterations does the Bellman-Ford algorithm need for directed and undirected graphs -- (algorithms graphs algorithm analysis shortest path) <p>The Bellman-Ford algorithm on a graph with <span class="math-container">$n$</span> vertices, normally includes a loop executed <span class="math-container">$n-1$</span> ...
habedi/stack-exchange-dataset
105,214
Isomorphisms between regular graphs of same degree
<p>Are all <span class="math-container">$n$</span>-vertex regular graphs of degree <span class="math-container">$d$</span> isomorphic?</p>&#xA;&#xA;<p>Can someone provide an example of two non-isomorphic graphs <span class="math-container">$G_1$</span> and <span class="math-container">$G_2$</span> which are both regula...
graphs graph isomorphism
1
Isomorphisms between regular graphs of same degree -- (graphs graph isomorphism) <p>Are all <span class="math-container">$n$</span>-vertex regular graphs of degree <span class="math-container">$d$</span> isomorphic?</p>&#xA;&#xA;<p>Can someone provide an example of two non-isomorphic graphs <span class="math-container"...
habedi/stack-exchange-dataset
105,215
Meaning of the "why not" modality from linear type theory?
<p>In linear type theory there is a modality written <code>!</code> where <code>!T</code> can be read as "infinite copies of <code>T</code>".</p>&#xA;&#xA;<p>According to ncatlab, there is a dual to this modality which is sometimes written <code>?T</code> and referred to as the "why not" modality. What is the meaning o...
type theory modal logic
1
Meaning of the "why not" modality from linear type theory? -- (type theory modal logic) <p>In linear type theory there is a modality written <code>!</code> where <code>!T</code> can be read as "infinite copies of <code>T</code>".</p>&#xA;&#xA;<p>According to ncatlab, there is a dual to this modality which is sometimes ...
habedi/stack-exchange-dataset
105,234
Measuring the Probability of Error for a Potential BPP Algorithm
<h1>Problem</h1>&#xA;&#xA;<p>Given a search algorithm that can be used to query a <em>k-dimensional space</em>, produced from an <em>input array of N data</em>, has a time complexity of <span class="math-container">$O(klog^2N)$</span>. This algorithm partitions the space into four regions then selects three of those re...
time complexity search algorithms randomized algorithms
1
Measuring the Probability of Error for a Potential BPP Algorithm -- (time complexity search algorithms randomized algorithms) <h1>Problem</h1>&#xA;&#xA;<p>Given a search algorithm that can be used to query a <em>k-dimensional space</em>, produced from an <em>input array of N data</em>, has a time complexity of <span cl...
habedi/stack-exchange-dataset
105,235
Get all factors of a word in linear time or constant time
<p>I have the following problem :</p>&#xA;&#xA;<p>I have an algorithm which takes a word <span class="math-container">$w$</span> as entry. The problem is that my algorithm is doing a lot of things on the factors of <span class="math-container">$w$</span> and I am representing <span class="math-container">$w$</span> as ...
algorithms word combinatorics
1
Get all factors of a word in linear time or constant time -- (algorithms word combinatorics) <p>I have the following problem :</p>&#xA;&#xA;<p>I have an algorithm which takes a word <span class="math-container">$w$</span> as entry. The problem is that my algorithm is doing a lot of things on the factors of <span class=...
habedi/stack-exchange-dataset
105,246
Quantum NAND gate
<p>Wondering how a quantum NAND gate would be implemented, and if it would be considered universal. I saw for quantum computing the Hadamard, phase, CNOT and π/8 gates are universal, but didn't see NAND in there. Wondering why it's not universal in quantum computing, and if/how you can construct a quantum NAND gate.</p...
quantum computing circuits
1
Quantum NAND gate -- (quantum computing circuits) <p>Wondering how a quantum NAND gate would be implemented, and if it would be considered universal. I saw for quantum computing the Hadamard, phase, CNOT and π/8 gates are universal, but didn't see NAND in there. Wondering why it's not universal in quantum computing, an...
habedi/stack-exchange-dataset
105,250
Minimum number of tree operations to normalize a labeled tree
<p>Given a binary tree with labels on the leaves, like <span class="math-container">$(bc)(ad)$</span> or <span class="math-container">$((af)e)(c(db))$</span>, which we can interpret as a product of terms with respect to a commutative associative operation, how many applications of commutativity (swapping the two childr...
complexity theory asymptotics combinatorics
1
Minimum number of tree operations to normalize a labeled tree -- (complexity theory asymptotics combinatorics) <p>Given a binary tree with labels on the leaves, like <span class="math-container">$(bc)(ad)$</span> or <span class="math-container">$((af)e)(c(db))$</span>, which we can interpret as a product of terms with ...
habedi/stack-exchange-dataset
105,251
Is λ allowed in Deterministic CFG?
<p>I have a non-deterministic CFG that says </p>&#xA;&#xA;<blockquote>&#xA; <p>S-> aS | aB | bB | λ;<br>&#xA; B-> bB | λ</p>&#xA;</blockquote>&#xA;&#xA;<p>And I'm asked to create a deterministic CFG from that. I understand why the given CFG is non-deterministic because it contains </p>&#xA;&#xA;<blockquote>&#xA; <p>...
context free
1
Is λ allowed in Deterministic CFG? -- (context free) <p>I have a non-deterministic CFG that says </p>&#xA;&#xA;<blockquote>&#xA; <p>S-> aS | aB | bB | λ;<br>&#xA; B-> bB | λ</p>&#xA;</blockquote>&#xA;&#xA;<p>And I'm asked to create a deterministic CFG from that. I understand why the given CFG is non-deterministic bec...
habedi/stack-exchange-dataset
105,256
DFA which accepts all strings starting and ending with 'aa'
<p>I have to construct a DFA which accepts set of all strings over {a,b} which start and end with 'aa'. &#xA;I have constructed the following DFA, but it does not accept 'aa' and 'aaa'. How can I make it accept all strings in the language.<a href="https://i.stack.imgur.com/DOrFQ.jpg" rel="nofollow noreferrer"><img src=...
automata finite automata
1
DFA which accepts all strings starting and ending with 'aa' -- (automata finite automata) <p>I have to construct a DFA which accepts set of all strings over {a,b} which start and end with 'aa'. &#xA;I have constructed the following DFA, but it does not accept 'aa' and 'aaa'. How can I make it accept all strings in the ...
habedi/stack-exchange-dataset
105,266
Create a grammar that generate the language a^n . b^m . c^q . d^p such that n + p = q + m
<p>I'm stuck on this question. I'm struggling on how to keep track of the number of a and d I have generated.</p>&#xA;&#xA;<p>The professor hasn't given the correction.</p>&#xA;&#xA;<p>I have seen similar questions but the condition is different, I can't find the grammar. Is it possible to prove that it is not context ...
formal languages context free formal grammars
1
Create a grammar that generate the language a^n . b^m . c^q . d^p such that n + p = q + m -- (formal languages context free formal grammars) <p>I'm stuck on this question. I'm struggling on how to keep track of the number of a and d I have generated.</p>&#xA;&#xA;<p>The professor hasn't given the correction.</p>&#xA;&#...
habedi/stack-exchange-dataset
105,274
The instructions a Stack Machine has
<p>Trying to figure out which instructions a stack machine has, and wanted to clarify / reassure that these are in fact all of them.</p>&#xA;&#xA;<ul>&#xA;<li><code>push</code> onto stack</li>&#xA;<li><code>pop</code> off stack</li>&#xA;<li><code>call</code> a system function like <code>add</code></li>&#xA;</ul>&#xA;&#...
computer architecture assembly
1
The instructions a Stack Machine has -- (computer architecture assembly) <p>Trying to figure out which instructions a stack machine has, and wanted to clarify / reassure that these are in fact all of them.</p>&#xA;&#xA;<ul>&#xA;<li><code>push</code> onto stack</li>&#xA;<li><code>pop</code> off stack</li>&#xA;<li><code>...
habedi/stack-exchange-dataset
105,287
Number of final states in a minimal DFA
<p>Is the number of final states in a DFA at least the number of final states in its minimal DFA?</p>&#xA;&#xA;<p>Is the answer even yes? Any help would be appreciated.</p>&#xA;
automata finite automata
1
Number of final states in a minimal DFA -- (automata finite automata) <p>Is the number of final states in a DFA at least the number of final states in its minimal DFA?</p>&#xA;&#xA;<p>Is the answer even yes? Any help would be appreciated.</p>&#xA;
habedi/stack-exchange-dataset
105,291
Program to check whether a string is accepted by an unrestricted grammar
<p>How can I write a program to find out whether a given string is generated using a type 0 grammar (unrestricted grammar)?</p>&#xA;
formal languages formal grammars
1
Program to check whether a string is accepted by an unrestricted grammar -- (formal languages formal grammars) <p>How can I write a program to find out whether a given string is generated using a type 0 grammar (unrestricted grammar)?</p>&#xA;
habedi/stack-exchange-dataset
105,299
Optimal scalability of a distributed algorithm
<p>What's the optimal scalability of some algorithm when I implement it in a distributed manner? </p>&#xA;&#xA;<p>Intuitively, it seems to me that any algorithm can scale at most linearly with number of computing nodes. I.e, if algorithm A takes <strong>T</strong> units of time with <strong>1 computing node</strong> on...
runtime analysis distributed systems
1
Optimal scalability of a distributed algorithm -- (runtime analysis distributed systems) <p>What's the optimal scalability of some algorithm when I implement it in a distributed manner? </p>&#xA;&#xA;<p>Intuitively, it seems to me that any algorithm can scale at most linearly with number of computing nodes. I.e, if alg...
habedi/stack-exchange-dataset
105,307
Calculate the number of distinct permutations of length n in the closure of a language
<p>I am studying a distance CS course, but there is no tutor available, so I would appreciate your help...</p>&#xA;&#xA;<p>Consider the language <span class="math-container">$S = \{a, aa, ab\}$</span>&#xA;How many distinct words of length <span class="math-container">$n$</span> will appear in <span class="math-containe...
algorithms closure properties
1
Calculate the number of distinct permutations of length n in the closure of a language -- (algorithms closure properties) <p>I am studying a distance CS course, but there is no tutor available, so I would appreciate your help...</p>&#xA;&#xA;<p>Consider the language <span class="math-container">$S = \{a, aa, ab\}$</spa...
habedi/stack-exchange-dataset
105,311
On propositional formula satisfiablitiy
<p>I know that there is no algorithm for converting any logical formula to DNF so even though we have an efficient algorithm to solve DNFSAT we can't solve formulaSAT in deterministic polynomial time.&#xA;But what makes the finding of an efficient CNF algorithm solve formulaSAT in polynomial time?&#xA;Because I'm guess...
complexity theory time complexity np complete
1
On propositional formula satisfiablitiy -- (complexity theory time complexity np complete) <p>I know that there is no algorithm for converting any logical formula to DNF so even though we have an efficient algorithm to solve DNFSAT we can't solve formulaSAT in deterministic polynomial time.&#xA;But what makes the findi...
habedi/stack-exchange-dataset
105,313
dynamic pseudo-code for simplified coin changing algorithm
<p>As a homework exercise our professor presented to us a simplified version of the coin-changing problem in which we do not need to minimize the number of coins used or track the number of possible combinations. Instead we need only to determine if a certain subset of coins of same or varying denomination, equal exac...
dynamic programming coin change pseudocode
1
dynamic pseudo-code for simplified coin changing algorithm -- (dynamic programming coin change pseudocode) <p>As a homework exercise our professor presented to us a simplified version of the coin-changing problem in which we do not need to minimize the number of coins used or track the number of possible combinations. ...
habedi/stack-exchange-dataset
105,316
Is it decidable whether a Turing machine M will reach state q on input s?
<blockquote>&#xA; <p>Given a turing machine <span class="math-container">$M$</span>, one of its states <span class="math-container">$q$</span> and an input word <span class="math-container">$w$</span>, will <span class="math-container">$M$</span> ever reach <span class="math-container">$q$</span> on <span class="math-...
turing machines computability undecidability semi decidability
1
Is it decidable whether a Turing machine M will reach state q on input s? -- (turing machines computability undecidability semi decidability) <blockquote>&#xA; <p>Given a turing machine <span class="math-container">$M$</span>, one of its states <span class="math-container">$q$</span> and an input word <span class="mat...
habedi/stack-exchange-dataset
105,328
Deustch algorithm using one qubit
<p><a href="https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm" rel="nofollow noreferrer">Deutsch algorithm</a> uses two qubits to determine the type of function. But what if we have only one qubit? How the algorithm would be implemented? And especially, how <span class="math-container">$U_f = |x\rangle |y \...
quantum computing
1
Deustch algorithm using one qubit -- (quantum computing) <p><a href="https://en.wikipedia.org/wiki/Deutsch%E2%80%93Jozsa_algorithm" rel="nofollow noreferrer">Deutsch algorithm</a> uses two qubits to determine the type of function. But what if we have only one qubit? How the algorithm would be implemented? And especiall...
habedi/stack-exchange-dataset
105,329
How to find First in a left recursive grammar?
<blockquote>&#xA;<p>One of the basic requirements for a grammar to be LL(1) is : For every pai r of productions A -&gt; X | Y, First(X) and First(Y) should be disjointed.</p>&#xA;<p>If a grammar is left-recursive, then the set of productions will contain at least one pair of the form A -&gt; AX|B; and hence, First(AX) ...
context free compilers parsers
1
How to find First in a left recursive grammar? -- (context free compilers parsers) <blockquote>&#xA;<p>One of the basic requirements for a grammar to be LL(1) is : For every pai r of productions A -&gt; X | Y, First(X) and First(Y) should be disjointed.</p>&#xA;<p>If a grammar is left-recursive, then the set of product...
habedi/stack-exchange-dataset
105,335
DFA & RE from descriptive definition of given regular language
<p>I am trying to make the <a href="https://www.tutorialspoint.com/automata_theory/deterministic_finite_automaton.htm" rel="nofollow noreferrer"><strong>DFA</strong></a> and <a href="http://www.cs.rochester.edu/u/www/u/nelson/courses/csc_173/fa/re.html" rel="nofollow noreferrer"><strong>RE</strong></a> of a regular lan...
automata regular languages finite automata regular expressions kleene star
1
DFA & RE from descriptive definition of given regular language -- (automata regular languages finite automata regular expressions kleene star) <p>I am trying to make the <a href="https://www.tutorialspoint.com/automata_theory/deterministic_finite_automaton.htm" rel="nofollow noreferrer"><strong>DFA</strong></a> and <a ...
habedi/stack-exchange-dataset
105,350
Why isn't P and P/poly trivially the same?
<p>The definition of P is a language that can be decided by a polynomial time algorithm. The definition of P/poly can be taken to mean a language that can be decided by a polynomial-size circuit (see <a href="http://pages.cs.wisc.edu/~jyc/02-810notes/lecture09.pdf" rel="noreferrer">http://pages.cs.wisc.edu/~jyc/02-810n...
complexity theory time complexity circuits
1
Why isn't P and P/poly trivially the same? -- (complexity theory time complexity circuits) <p>The definition of P is a language that can be decided by a polynomial time algorithm. The definition of P/poly can be taken to mean a language that can be decided by a polynomial-size circuit (see <a href="http://pages.cs.wisc...
habedi/stack-exchange-dataset
105,359
How to statically type polymorphic lambdas using hindley milner style type inference
<p>I am playing with a simple implicitly typed functional language and have implemented type checking using a Hindley Milner style system. In order to guide code generation, I want to tag each term with its type during type inference. </p>&#xA;&#xA;<p>Of course my language uses lambda expressions and the implicit typin...
type theory type inference
1
How to statically type polymorphic lambdas using hindley milner style type inference -- (type theory type inference) <p>I am playing with a simple implicitly typed functional language and have implemented type checking using a Hindley Milner style system. In order to guide code generation, I want to tag each term with ...
habedi/stack-exchange-dataset
105,365
Network throughput with random delay selected from uniform distribution
<p><strong>Background:</strong></p>&#xA;&#xA;<p>I am working with IoT devices which broadcast status messages over a wireless channel periodically and at a rather high rate (500-5000 Hz). Receiving every message is not crucial but the more that are received, the better. I previously had nodes continuously synchronise c...
probability theory randomized algorithms computer networks
1
Network throughput with random delay selected from uniform distribution -- (probability theory randomized algorithms computer networks) <p><strong>Background:</strong></p>&#xA;&#xA;<p>I am working with IoT devices which broadcast status messages over a wireless channel periodically and at a rather high rate (500-5000 H...
habedi/stack-exchange-dataset
105,366
Good resources for Graph labelling
<p>I'm searching for good resources on different graph labelling, especially <strong>Graceful</strong>, <strong>Antimagic</strong> and <strong>Antibandwidth Labelling</strong>. Could anyone please help me with that? It will be very much appreciated. Thanks in advance.</p>&#xA;
graphs
1
Good resources for Graph labelling -- (graphs) <p>I'm searching for good resources on different graph labelling, especially <strong>Graceful</strong>, <strong>Antimagic</strong> and <strong>Antibandwidth Labelling</strong>. Could anyone please help me with that? It will be very much appreciated. Thanks in advance.</p>&...
habedi/stack-exchange-dataset
105,369
Interpolate on a cylic x axes
<p>Let's assume you are in 2D space and you have a set of fix points <code>FIX_POINTS = [(x1, y1), (x2, y2)]</code>. I want to interpolate the <code>y</code> value for a given <code>x</code> value using the provided points as fix points for a piecewise linear interpolation. </p>&#xA;&#xA;<p>Caveat: The x-axis is cyclic...
algorithms mathematical programming
1
Interpolate on a cylic x axes -- (algorithms mathematical programming) <p>Let's assume you are in 2D space and you have a set of fix points <code>FIX_POINTS = [(x1, y1), (x2, y2)]</code>. I want to interpolate the <code>y</code> value for a given <code>x</code> value using the provided points as fix points for a piecew...
habedi/stack-exchange-dataset
105,371
Decide if a string is in a language without simulating the automata accepting the languge
<p>Is it possible for a Turing machine with input of a DFA that accepts a finite language and a string to decide whether the string is in the language without "fully simulating" the DFA on the string?</p>&#xA;&#xA;<p>More formally, Is there a TM <span class="math-container">$M$</span> with a constant <span class="math-...
turing machines computability finite automata
1
Decide if a string is in a language without simulating the automata accepting the languge -- (turing machines computability finite automata) <p>Is it possible for a Turing machine with input of a DFA that accepts a finite language and a string to decide whether the string is in the language without "fully simulating" t...
habedi/stack-exchange-dataset
105,377
Automaton recognizing ambiguously accepted words of another automaton
<p>Let <span class="math-container">$A$</span> be a nondeterministic automaton. Let <span class="math-container">$X(A)$</span> the set of words for which there at least two accepting paths.</p>&#xA;&#xA;<p>In one of the previous exam, for which no answers are available, it is required to prove that there exist a determ...
automata regular languages finite automata
1
Automaton recognizing ambiguously accepted words of another automaton -- (automata regular languages finite automata) <p>Let <span class="math-container">$A$</span> be a nondeterministic automaton. Let <span class="math-container">$X(A)$</span> the set of words for which there at least two accepting paths.</p>&#xA;&#xA...
habedi/stack-exchange-dataset
105,379
Putting as many items as possible with weight and size limit
<p>I am trying to design a greedy algorithm that has to take in multiple factors when making a greedy choice. </p>&#xA;&#xA;<p>Any item has an item weight of <code>Iw</code> and item size of <code>Is</code>, these are both numerical values. Item sizes are originally translated from the values very small, small, medium,...
algorithms greedy algorithms
1
Putting as many items as possible with weight and size limit -- (algorithms greedy algorithms) <p>I am trying to design a greedy algorithm that has to take in multiple factors when making a greedy choice. </p>&#xA;&#xA;<p>Any item has an item weight of <code>Iw</code> and item size of <code>Is</code>, these are both nu...
habedi/stack-exchange-dataset
105,381
Negation of the semantics of the Until operator in LTL
<p>I have been looking at the Until operator and the release operator and when introduced to the release operator it was suggested that it is equivalent to:</p>&#xA;&#xA;<p><span class="math-container">$\phi R \psi \equiv \neg(\neg\phi U \neg \psi)$</span></p>&#xA;&#xA;<p>But when trying to get from the semantic defini...
logic semantics model checking linear temporal logic predicate logic
1
Negation of the semantics of the Until operator in LTL -- (logic semantics model checking linear temporal logic predicate logic) <p>I have been looking at the Until operator and the release operator and when introduced to the release operator it was suggested that it is equivalent to:</p>&#xA;&#xA;<p><span class="math-...
habedi/stack-exchange-dataset
105,386
Dominating set of given size $k$ in $O(2^k |V| |E|)$
<p>Recently I've encountered an interesting case of dominating set problem: given an unweighted and undirected graph <span class="math-container">$G(V, E)$</span> and knowing that it contains a dominating set of size <span class="math-container">$k$</span>, find any such dominating set in time <span class="math-contain...
graphs np
1
Dominating set of given size $k$ in $O(2^k |V| |E|)$ -- (graphs np) <p>Recently I've encountered an interesting case of dominating set problem: given an unweighted and undirected graph <span class="math-container">$G(V, E)$</span> and knowing that it contains a dominating set of size <span class="math-container">$k$</s...
habedi/stack-exchange-dataset
105,397
Is this algorithm bubble sort or selection sort?
<pre><code>#include &lt;iostream&gt;&#xA;&#xA;int main() {&#xA; int arr[10]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1};&#xA; for (int i = 0; i &lt; 10; i++) {&#xA; for (int j = 0; j &lt; 9; j++) {&#xA; if (arr[j] &gt; arr[j + 1]) {&#xA; std::swap(arr[j], arr[j + 1]);&#xA; }&#xA; ...
algorithms terminology sorting
1
Is this algorithm bubble sort or selection sort? -- (algorithms terminology sorting) <pre><code>#include &lt;iostream&gt;&#xA;&#xA;int main() {&#xA; int arr[10]{10, 9, 8, 7, 6, 5, 4, 3, 2, 1};&#xA; for (int i = 0; i &lt; 10; i++) {&#xA; for (int j = 0; j &lt; 9; j++) {&#xA; if (arr[j] &gt; arr[...
habedi/stack-exchange-dataset
105,398
Signed and unsigned numbers
<p>How would the ALU in a microprocessor differentiate between a signed number, -7 that is denoted by 1111 and an unsigned number 15, also denoted by 1111?</p>&#xA;
arithmetic binary
1
Signed and unsigned numbers -- (arithmetic binary) <p>How would the ALU in a microprocessor differentiate between a signed number, -7 that is denoted by 1111 and an unsigned number 15, also denoted by 1111?</p>&#xA;
habedi/stack-exchange-dataset
105,404
Can a schedule be conflict serializable but not serializable?
<p>A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations. Then, &#xA;My question is: Can a schedule be conflict serializable but not serializable? &#xA;Please explain why.</p>&#xA;
concurrency scheduling database theory process scheduling
1
Can a schedule be conflict serializable but not serializable? -- (concurrency scheduling database theory process scheduling) <p>A schedule is called conflict serializable if it can be transformed into a serial schedule by swapping non-conflicting operations. Then, &#xA;My question is: Can a schedule be conflict seriali...
habedi/stack-exchange-dataset
105,405
Regular grammar with at most one c
<p>I am attempting to make a regular grammar over alphabet {a, b, c} where there is at most one c. So far, I have the regular expression <code>((a|b)*|c)(a|b)*</code> but am unsure where to go from here; my previous attempts have ended up allowing multiple c's.</p>&#xA;&#xA;<p>The solution I has gives (N={s,t}, T={a,b,...
regular languages formal grammars
1
Regular grammar with at most one c -- (regular languages formal grammars) <p>I am attempting to make a regular grammar over alphabet {a, b, c} where there is at most one c. So far, I have the regular expression <code>((a|b)*|c)(a|b)*</code> but am unsure where to go from here; my previous attempts have ended up allowin...
habedi/stack-exchange-dataset
105,414
Given all pairs shortest paths matrix, find graph with minimum total sum of edges
<p>I was looking at some problems about graphs, and I got stuck on this one. Namely, we have given matrix of size <span class="math-container">$N \cdot N$</span> representing the length of the shortest path in undirected graph between some pairs of nodes in the graph <span class="math-container">$(i,j)$</span>.</p>&#xA...
graphs shortest path weighted graphs
1
Given all pairs shortest paths matrix, find graph with minimum total sum of edges -- (graphs shortest path weighted graphs) <p>I was looking at some problems about graphs, and I got stuck on this one. Namely, we have given matrix of size <span class="math-container">$N \cdot N$</span> representing the length of the sho...
habedi/stack-exchange-dataset
105,420
Must a function in lambda-calculus which inputs a boolean function be defined in a certian way?
<p>This question is my best attempt to get at a more general question about what one can get from terms in the lambda calculus.</p>&#xA;&#xA;<p>Using the church encoding, we define booleans by&#xA;<span class="math-container">$\texttt{true} = \lambda x,y.x$</span> and <span class="math-container">$\texttt{false} = \lam...
proof techniques lambda calculus
1
Must a function in lambda-calculus which inputs a boolean function be defined in a certian way? -- (proof techniques lambda calculus) <p>This question is my best attempt to get at a more general question about what one can get from terms in the lambda calculus.</p>&#xA;&#xA;<p>Using the church encoding, we define boole...
habedi/stack-exchange-dataset
105,426
Are there lambda-calculus functions which always output booleans, but are not constant functions?
<p>In labmda calculus, true = <span class="math-container">$\lambda x,y.x$</span> and false = <span class="math-container">$\lambda x,y.y$</span>.</p>&#xA;&#xA;<p>Is there a term <span class="math-container">$f$</span> such that for any other term <span class="math-container">$x$</span>, <span class="math-container">$f...
lambda calculus
1
Are there lambda-calculus functions which always output booleans, but are not constant functions? -- (lambda calculus) <p>In labmda calculus, true = <span class="math-container">$\lambda x,y.x$</span> and false = <span class="math-container">$\lambda x,y.y$</span>.</p>&#xA;&#xA;<p>Is there a term <span class="math-cont...
habedi/stack-exchange-dataset
105,431
How to judge the searching precision of Particle Swarm Optimization?
<p>As the title mentioned, how can I judge the searching precision of PSO? Is this depending on the velocity of the particles? I would like to give an example to clarify my question: For a 2-D searching, the precision of grid ergodic searching is the searching step. But what the precision should be using PSO searching....
computability optimization
1
How to judge the searching precision of Particle Swarm Optimization? -- (computability optimization) <p>As the title mentioned, how can I judge the searching precision of PSO? Is this depending on the velocity of the particles? I would like to give an example to clarify my question: For a 2-D searching, the precision o...
habedi/stack-exchange-dataset
105,436
How to best maintain a sorted list from a stream of integers?
<p>If I have an incoming stream of integers how can I best maintain a sorted list of them? The only way I can think of is to binary search for the position and shifting the remaining elements to the right. This would amount to <span class="math-container">$O(N + \log N)$</span> time. Is there a better data structure th...
algorithms sorting lists streaming algorithm
1
How to best maintain a sorted list from a stream of integers? -- (algorithms sorting lists streaming algorithm) <p>If I have an incoming stream of integers how can I best maintain a sorted list of them? The only way I can think of is to binary search for the position and shifting the remaining elements to the right. Th...
habedi/stack-exchange-dataset
105,439
Hoare logic, proving conjunction rule from basic rules, possible or not?
<p>(This is HW.) Suppose I have these following proof rules given.&#xA;<a href="https://i.stack.imgur.com/ojVC4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ojVC4.png" alt="rules I have now"></a></p>&#xA;&#xA;<p>I am currently considering if I can prove the conjunction rule (given below) from the ...
formal methods hoare logic
1
Hoare logic, proving conjunction rule from basic rules, possible or not? -- (formal methods hoare logic) <p>(This is HW.) Suppose I have these following proof rules given.&#xA;<a href="https://i.stack.imgur.com/ojVC4.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ojVC4.png" alt="rules I have now"></...
habedi/stack-exchange-dataset
105,445
Generalizing Knuth's $O(\log_2 n)$ Fibonacci algorithm to linear homogenous recurrences
<p>Knuth has a neat algorithm that uses matrix exponentiation to compute the <span class="math-container">$n$</span>th Fibonacci number in <span class="math-container">$O(\log_2 n)$</span>-time <a href="http://www.davidespataro.it/yet-another-one-on-fibonacci-serie-knuth-multiplication/" rel="nofollow noreferrer">1</a>...
algorithms recurrence relation number theory
1
Generalizing Knuth's $O(\log_2 n)$ Fibonacci algorithm to linear homogenous recurrences -- (algorithms recurrence relation number theory) <p>Knuth has a neat algorithm that uses matrix exponentiation to compute the <span class="math-container">$n$</span>th Fibonacci number in <span class="math-container">$O(\log_2 n)$<...
habedi/stack-exchange-dataset
105,472
Amortized time complexity for double stack emulated queue
<p>Assume that we have a data type <span class="math-container">$stack$</span> which has two operation <span class="math-container">$push$</span> and <span class="math-container">$pop$</span>, both operations' time complexity is <span class="math-container">$O(1)$</span> in worst case. The <span class="math-container">...
algorithms time complexity amortized analysis stacks queues
1
Amortized time complexity for double stack emulated queue -- (algorithms time complexity amortized analysis stacks queues) <p>Assume that we have a data type <span class="math-container">$stack$</span> which has two operation <span class="math-container">$push$</span> and <span class="math-container">$pop$</span>, both...
habedi/stack-exchange-dataset