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
114,812
prove that {$↔,⊕$} is incomplete set?
<p>How do i prove that Is {<span class="math-container">$↔,⊕$</span>} not a complete set ? I have no clue how to prove it .</p>&#xA;
logic discrete mathematics propositional logic
1
prove that {$↔,⊕$} is incomplete set? -- (logic discrete mathematics propositional logic) <p>How do i prove that Is {<span class="math-container">$↔,⊕$</span>} not a complete set ? I have no clue how to prove it .</p>&#xA;
habedi/stack-exchange-dataset
114,815
Why is it not possible to prove that two Turing Machines calculate the same function?
<p>I was wondering why it is not possible. Is it because the corresponding language is not decidable, or because of the fact that it is not guaranteed that a Turing machine halts on every input?</p>&#xA;
formal languages turing machines undecidability halting problem
1
Why is it not possible to prove that two Turing Machines calculate the same function? -- (formal languages turing machines undecidability halting problem) <p>I was wondering why it is not possible. Is it because the corresponding language is not decidable, or because of the fact that it is not guaranteed that a Turing ...
habedi/stack-exchange-dataset
114,819
How can I calculate the maximum sum/product of sequence?
<p>I am looking for an algorithm in <span class="math-container">$O(N^2)$</span> that finds the maximum value that be obtained from a sequence of real numbers greater than 0 (e.g. <span class="math-container">$\{ 1, 2, 3 , 4\}$</span>) by inserting a plus (<span class="math-container">$+$</span>) or multiplication (<sp...
algorithms optimization arithmetic
1
How can I calculate the maximum sum/product of sequence? -- (algorithms optimization arithmetic) <p>I am looking for an algorithm in <span class="math-container">$O(N^2)$</span> that finds the maximum value that be obtained from a sequence of real numbers greater than 0 (e.g. <span class="math-container">$\{ 1, 2, 3 , ...
habedi/stack-exchange-dataset
114,830
Algorithm Design: Efficient O(n) algorithm to get the ith to jth largest elements in an array
<p>I am trying to design an efficient algorithm that retrieves the ith to jth largest elements in an array. For example, if the following array is the input:</p>&#xA;&#xA;<pre><code>[10, 14, 18, 3, 21, 25, 27]&#xA;i = 2&#xA;j = 4&#xA;</code></pre>&#xA;&#xA;<p>The following array is returned:</p>&#xA;&#xA;<pre><code>[25...
algorithms algorithm analysis optimization arrays quicksort
1
Algorithm Design: Efficient O(n) algorithm to get the ith to jth largest elements in an array -- (algorithms algorithm analysis optimization arrays quicksort) <p>I am trying to design an efficient algorithm that retrieves the ith to jth largest elements in an array. For example, if the following array is the input:</p>...
habedi/stack-exchange-dataset
114,834
Can Dijkstra's algorithm outperform A star, in terms of vertices checked?
<p>I know Dijkstra's algorithm can be seen as a specific case of A star, when the estimation heuristic used simply returns 0, so I know that A star with this specific heuristic can not check more vertices than Dijkstra's algorithm. What I'm asking however is the following. Given an A star algorithm with some heuristic ...
algorithms search algorithms a star search
1
Can Dijkstra's algorithm outperform A star, in terms of vertices checked? -- (algorithms search algorithms a star search) <p>I know Dijkstra's algorithm can be seen as a specific case of A star, when the estimation heuristic used simply returns 0, so I know that A star with this specific heuristic can not check more ve...
habedi/stack-exchange-dataset
114,844
Grassfire vs BFS
<p>Expanding on this question : </p>&#xA;&#xA;<p><a href="https://cs.stackexchange.com/questions/98516/why-is-dijkstras-algorithm-more-popular-compared-to-grassfire-algorithm">Why is Dijkstra&#39;s Algorithm more popular compared to Grassfire algorithm?</a></p>&#xA;&#xA;<p>What are the differences between grassfire and...
algorithms time complexity search algorithms
1
Grassfire vs BFS -- (algorithms time complexity search algorithms) <p>Expanding on this question : </p>&#xA;&#xA;<p><a href="https://cs.stackexchange.com/questions/98516/why-is-dijkstras-algorithm-more-popular-compared-to-grassfire-algorithm">Why is Dijkstra&#39;s Algorithm more popular compared to Grassfire algorithm?...
habedi/stack-exchange-dataset
114,853
I came up with a way to modify Dijkstra's Algorithm to handle graphs with negative edge weighs
<ol>&#xA;<li>Add a constant <span class="math-container">$c\geq |w_{min}|$</span> to each edge of <span class="math-container">$G$</span>, so that each edge now has non-negative weight. </li>&#xA;<li>Run Dijkstra's algorithm</li>&#xA;</ol>&#xA;&#xA;<p>Can anyone tell me if this is viable or if it fails?</p>&#xA;
algorithms graphs weighted graphs
1
I came up with a way to modify Dijkstra's Algorithm to handle graphs with negative edge weighs -- (algorithms graphs weighted graphs) <ol>&#xA;<li>Add a constant <span class="math-container">$c\geq |w_{min}|$</span> to each edge of <span class="math-container">$G$</span>, so that each edge now has non-negative weight. ...
habedi/stack-exchange-dataset
114,856
Is inverse CNF polynomial?
<p>Suppose we are given a CNF formula <span class="math-container">$F$</span> with <span class="math-container">$n$</span> variables and <span class="math-container">$m$</span> clauses. The question is whether we can represent <span class="math-container">$\lnot F$</span> as a CNF formula with the number of clauses pol...
satisfiability
1
Is inverse CNF polynomial? -- (satisfiability) <p>Suppose we are given a CNF formula <span class="math-container">$F$</span> with <span class="math-container">$n$</span> variables and <span class="math-container">$m$</span> clauses. The question is whether we can represent <span class="math-container">$\lnot F$</span> ...
habedi/stack-exchange-dataset
114,860
Non-Boolean SAT
<p>I was wondering about the complexity of SAT tests with variables <span class="math-container">$x_i = 0 \lor 1 \lor 2 \dots \lor n$</span>, with clauses being of the form <span class="math-container">$x_i = a \implies x_j \neq b$</span>. When <span class="math-container">$n=2$</span>, we have 2SAT, which has linear t...
algorithms propositional logic constraint satisfaction sat solvers
1
Non-Boolean SAT -- (algorithms propositional logic constraint satisfaction sat solvers) <p>I was wondering about the complexity of SAT tests with variables <span class="math-container">$x_i = 0 \lor 1 \lor 2 \dots \lor n$</span>, with clauses being of the form <span class="math-container">$x_i = a \implies x_j \neq b$<...
habedi/stack-exchange-dataset
114,861
Types and Programming Languages - proof for theorem about principles of induction of terms
<p><a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">Types and Programming Languages</a> book introduces a theorem about principles of induction on term (p. 31, theorem 3.3.4):</p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose P is a predicate on terms.</p>&#xA; &#xA; <p>Induction on depth:</p>&#...
type theory
1
Types and Programming Languages - proof for theorem about principles of induction of terms -- (type theory) <p><a href="https://www.cis.upenn.edu/~bcpierce/tapl/" rel="nofollow noreferrer">Types and Programming Languages</a> book introduces a theorem about principles of induction on term (p. 31, theorem 3.3.4):</p>&#xA...
habedi/stack-exchange-dataset
114,877
Efficient algorithm to filter off points from a point cloud
<p>I have a master point cloud, which essentially just a list of points with <code>{x,y}</code> coordinates. </p>&#xA;&#xA;<p>The point cloud is HUGE ( like, it can contain more than 1 million points). The problem now is that I have another (sub)set of point clouds, and I need to check whether the points inside the sec...
algorithms computational geometry
1
Efficient algorithm to filter off points from a point cloud -- (algorithms computational geometry) <p>I have a master point cloud, which essentially just a list of points with <code>{x,y}</code> coordinates. </p>&#xA;&#xA;<p>The point cloud is HUGE ( like, it can contain more than 1 million points). The problem now is ...
habedi/stack-exchange-dataset
114,885
How is the problem, {⟨G⟩|G has no triangle} in Logspace?
<p>I read this problem as a part of my course curriculum, in my professor's notes. I am not able to understand about the standard solution, that if I list all the possible triplets of vertices as 3-tuples in the tape, then how come my solution is limited to log-space?</p>&#xA;&#xA;<p>As far as my understanding, listing...
graphs turing machines space complexity
1
How is the problem, {⟨G⟩|G has no triangle} in Logspace? -- (graphs turing machines space complexity) <p>I read this problem as a part of my course curriculum, in my professor's notes. I am not able to understand about the standard solution, that if I list all the possible triplets of vertices as 3-tuples in the tape, ...
habedi/stack-exchange-dataset
114,888
Distinct Binary Heaps
<p>I have <span class="math-container">$n$</span> elements out of <span class="math-container">$n-1$</span> are distinct. The repeated element is either minimum or maximum element. I need to figure out how many distinct max heaps can be made from it.</p>&#xA;&#xA;<p><em>My analysis</em> : I started with <span class="ma...
algorithms binary trees recursion heaps
1
Distinct Binary Heaps -- (algorithms binary trees recursion heaps) <p>I have <span class="math-container">$n$</span> elements out of <span class="math-container">$n-1$</span> are distinct. The repeated element is either minimum or maximum element. I need to figure out how many distinct max heaps can be made from it.</p...
habedi/stack-exchange-dataset
114,894
Fitting a polynomial to a set of points or to a skeleton
<h2>Available data</h2>&#xA;&#xA;<p>Available to me is a set of points which can be represented as shown in image 1:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/YZh6o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YZh6o.png" alt="Original data"></a></p>&#xA;&#xA;<p>Also available to me is a n...
image processing polynomials
1
Fitting a polynomial to a set of points or to a skeleton -- (image processing polynomials) <h2>Available data</h2>&#xA;&#xA;<p>Available to me is a set of points which can be represented as shown in image 1:</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/YZh6o.png" rel="nofollow noreferrer"><img src="https://i.stac...
habedi/stack-exchange-dataset
114,905
Decidability of the language of all deterministic LBA where all states are reachable
<p>I have a exam task with 3 parts. (b) is no problem. I got a solution for (a) but the way (c) is asked makes me wonder if I even understood (a)</p>&#xA;&#xA;<p><em>(a)</em> L := { &lt; A > | A is a DFSA, where all states are reachable }. Is L decidable? Why or why not?</p>&#xA;&#xA;<p><em>(b)</em> M is a DLBA and k i...
formal languages semi decidability linear bounded automata
1
Decidability of the language of all deterministic LBA where all states are reachable -- (formal languages semi decidability linear bounded automata) <p>I have a exam task with 3 parts. (b) is no problem. I got a solution for (a) but the way (c) is asked makes me wonder if I even understood (a)</p>&#xA;&#xA;<p><em>(a)</...
habedi/stack-exchange-dataset
114,935
Let L be any non-empty language over an alphabet Σ. Show that $L^2$ ⊆ $L^3$ if and only if λ ∈ L
<p>I have this question in my Theoretical Computer Science class on the topic of Automata and Formal Languages.</p>&#xA;&#xA;<p><span class="math-container">$$ λ ∈ L \iff L^2 ⊆ L^3$$</span></p>&#xA;&#xA;<p>I thought of showing it by proving the contrapositive but I was only able to complete half of the proof (since it ...
formal languages
1
Let L be any non-empty language over an alphabet Σ. Show that $L^2$ ⊆ $L^3$ if and only if λ ∈ L -- (formal languages) <p>I have this question in my Theoretical Computer Science class on the topic of Automata and Formal Languages.</p>&#xA;&#xA;<p><span class="math-container">$$ λ ∈ L \iff L^2 ⊆ L^3$$</span></p>&#xA;&#x...
habedi/stack-exchange-dataset
114,947
A regular expression for all strings that have exactly one double letter in them?
<p>Why is the answer <code>(b + /\)(ab)*aa(ba)*(b + /\) + (a + /\)(ba)*bb(ab)*(a + /\)</code>? I'm confused and I request guidance</p>&#xA;
automata finite automata
1
A regular expression for all strings that have exactly one double letter in them? -- (automata finite automata) <p>Why is the answer <code>(b + /\)(ab)*aa(ba)*(b + /\) + (a + /\)(ba)*bb(ab)*(a + /\)</code>? I'm confused and I request guidance</p>&#xA;
habedi/stack-exchange-dataset
114,952
How to prove NP-hardness from scratch?
<p>I am working on a problem of whose complexity is unknown.&#xA;By the nature of the problem, I cannot use long edges as I please, so 3SAT and variants are almost impossible to use.</p>&#xA;&#xA;<p>Finally, I have decided to go for the most primitive method -- Turing Machines.</p>&#xA;&#xA;<p>Oddly enough, I could not...
complexity theory reductions np hard
1
How to prove NP-hardness from scratch? -- (complexity theory reductions np hard) <p>I am working on a problem of whose complexity is unknown.&#xA;By the nature of the problem, I cannot use long edges as I please, so 3SAT and variants are almost impossible to use.</p>&#xA;&#xA;<p>Finally, I have decided to go for the mo...
habedi/stack-exchange-dataset
114,959
Reducing from NPC to Co-NPC => NP = Co-NP?
<p>In my lecture we learned:</p>&#xA;&#xA;<p><code>If X is NPC and X in Co-NP =&gt; NP = Co-NP</code></p>&#xA;&#xA;<p>Would it be enough to prove <code>NP = Co-NP</code> if I reduce a problem just in one direction (from NPC to Co-NPC) in polynomial time?</p>&#xA;&#xA;<p>Or would it be necessary to show this for both di...
complexity theory complexity classes
1
Reducing from NPC to Co-NPC => NP = Co-NP? -- (complexity theory complexity classes) <p>In my lecture we learned:</p>&#xA;&#xA;<p><code>If X is NPC and X in Co-NP =&gt; NP = Co-NP</code></p>&#xA;&#xA;<p>Would it be enough to prove <code>NP = Co-NP</code> if I reduce a problem just in one direction (from NPC to Co-NPC) ...
habedi/stack-exchange-dataset
114,968
I want to know where there is the flaw in my argument
<p>I came across following problem to finding whether the following language is decidable or semi-decidable or not even a semi-decidable.</p>&#xA;&#xA;<p><span class="math-container">$L: \{\langle M\rangle: M\space is\space a\space TM\space and\space |L(M)| \ge3\}$</span></p>&#xA;&#xA;<p>Now thinking intuitively I conj...
turing machines reductions undecidability halting problem
1
I want to know where there is the flaw in my argument -- (turing machines reductions undecidability halting problem) <p>I came across following problem to finding whether the following language is decidable or semi-decidable or not even a semi-decidable.</p>&#xA;&#xA;<p><span class="math-container">$L: \{\langle M\rang...
habedi/stack-exchange-dataset
114,973
What's the meaning of this service specification
<p>What's the meaning of the example statement here?</p>&#xA;&#xA;<p>"A service specification S describes an interface: it specifies the behavior of certain program elements (functions or subprograms) through statements expressed in program logic. For instance, these might be such statements:</p>&#xA;&#xA;<ol>&#xA;<li>...
formal methods
1
What's the meaning of this service specification -- (formal methods) <p>What's the meaning of the example statement here?</p>&#xA;&#xA;<p>"A service specification S describes an interface: it specifies the behavior of certain program elements (functions or subprograms) through statements expressed in program logic. For...
habedi/stack-exchange-dataset
114,998
Is there any scenario whereby randomly shufflying a sequence improves it's compressibility?
<p>I'm performing some correlation assessment à la NIST <a href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf" rel="nofollow noreferrer">Recommendation for the Entropy Sources Used for Random Bit Generation</a>, &sect; 5.1. </p>&#xA;&#xA;<p>You take a test sequence and compress it with a s...
algorithm analysis entropy
1
Is there any scenario whereby randomly shufflying a sequence improves it's compressibility? -- (algorithm analysis entropy) <p>I'm performing some correlation assessment à la NIST <a href="https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-90B.pdf" rel="nofollow noreferrer">Recommendation for the Entropy...
habedi/stack-exchange-dataset
115,000
How to generate Deterministic finite automaton for given language
<p><strong>Problem:</strong> Write a program which generates Deterministic finite automaton which accepts given language. Language is defined with alphabet and start/end sub strings.</p>&#xA;&#xA;<p>For example: Alphabet={a,b,c}; start sub string="ab"; end sub string="cb"</p>&#xA;&#xA;<p>I need to construct DFA which w...
algorithms automata finite automata
1
How to generate Deterministic finite automaton for given language -- (algorithms automata finite automata) <p><strong>Problem:</strong> Write a program which generates Deterministic finite automaton which accepts given language. Language is defined with alphabet and start/end sub strings.</p>&#xA;&#xA;<p>For example: A...
habedi/stack-exchange-dataset
115,007
Class of languages recognised by a Forgetful Turing Machine
<p>A Forgetful Turing Machine (FTM) operates just like a normal Turing machine except that, in every instruction (i.e., transition), the letter written in the tape cell is always the letter <span class="math-container">$a$</span>, regardless of the current state and the current letter (although the read/write head is s...
formal languages turing machines
1
Class of languages recognised by a Forgetful Turing Machine -- (formal languages turing machines) <p>A Forgetful Turing Machine (FTM) operates just like a normal Turing machine except that, in every instruction (i.e., transition), the letter written in the tape cell is always the letter <span class="math-container">$a$...
habedi/stack-exchange-dataset
115,013
Unique property of a full binary tree
<p>I read a statement that was unclear to me, and was hoping to get some clarification.</p>&#xA;&#xA;<p>It said that given a full binary tree with <span class="math-container">$n &gt; 2$</span> leaves, there exists some internal node such that one third to two thirds of all <span class="math-container">$n$</span> leave...
graphs data structures
1
Unique property of a full binary tree -- (graphs data structures) <p>I read a statement that was unclear to me, and was hoping to get some clarification.</p>&#xA;&#xA;<p>It said that given a full binary tree with <span class="math-container">$n &gt; 2$</span> leaves, there exists some internal node such that one third ...
habedi/stack-exchange-dataset
115,018
General algorithm to find a minimal branching program
<p>Given a general branching program, is there an algorithm which can find an equivalent branching program <span class="math-container">$P$</span> of minimal length. That is <span class="math-container">$|P| \leq |P'|$</span> for all equivalent branching program <span class="math-container">$P'$</span>.</p>&#xA;&#xA;<p...
finite automata
1
General algorithm to find a minimal branching program -- (finite automata) <p>Given a general branching program, is there an algorithm which can find an equivalent branching program <span class="math-container">$P$</span> of minimal length. That is <span class="math-container">$|P| \leq |P'|$</span> for all equivalent ...
habedi/stack-exchange-dataset
115,024
What is the probability of comparision between smallest and greatest element in array when quick sort randomly choose the pivot element?
<p>Consider the recursive <code>quick sort</code> with <code>random pivoting</code> i.e. each time a random pivot element is chosen uniformly. When this randomized algorithm is being applied to an array with <code>n</code> distinct element, what is the <code>probability</code> that the <code>smallest</code> and the <co...
algorithms sorting randomized algorithms quicksort
1
What is the probability of comparision between smallest and greatest element in array when quick sort randomly choose the pivot element? -- (algorithms sorting randomized algorithms quicksort) <p>Consider the recursive <code>quick sort</code> with <code>random pivoting</code> i.e. each time a random pivot element is ch...
habedi/stack-exchange-dataset
115,037
Concatenate multiple integer arrays such that number of inversions in resulting array is minimal
<p>Given <code>N</code> arrays of variable length.</p>&#xA;&#xA;<p>Find a way to concatenate the arrays in such a way that the number of inversions is minimum</p>&#xA;&#xA;<p>An inversion for an array Arr can be defined as,</p>&#xA;&#xA;<p>a pair of indices <code>(i,j)</code> such that,</p>&#xA;&#xA;<pre><code>i != j&#...
algorithms data structures
1
Concatenate multiple integer arrays such that number of inversions in resulting array is minimal -- (algorithms data structures) <p>Given <code>N</code> arrays of variable length.</p>&#xA;&#xA;<p>Find a way to concatenate the arrays in such a way that the number of inversions is minimum</p>&#xA;&#xA;<p>An inversion for...
habedi/stack-exchange-dataset
115,039
Why in BFPRT (median of medians) algorithm the partition of the array by $7$ blocks would work but with the $3$ fail?
<p>I am working with the median-median algorithm or BFPRT algorithm and I seek to understand why would the partition of the array by <span class="math-container">$7$</span> blocks would work but with the <span class="math-container">$3$</span> fail?</p>&#xA;&#xA;<p>If we divide into blocks of <span class="math-contain...
algorithms algorithm analysis runtime analysis sorting order theory
1
Why in BFPRT (median of medians) algorithm the partition of the array by $7$ blocks would work but with the $3$ fail? -- (algorithms algorithm analysis runtime analysis sorting order theory) <p>I am working with the median-median algorithm or BFPRT algorithm and I seek to understand why would the partition of the arra...
habedi/stack-exchange-dataset
115,040
How to partition disagreeable people into compatible groups
<p>We have a number of people that must be partitioned into groups, but there may be people that dislike other individuals. Partition the people into the minimum number of groups such that no person is grouped with someone they don't like. (If A doesn't like B then A cannot be in a group with B. Each person must bel...
algorithms optimization sets partitions
1
How to partition disagreeable people into compatible groups -- (algorithms optimization sets partitions) <p>We have a number of people that must be partitioned into groups, but there may be people that dislike other individuals. Partition the people into the minimum number of groups such that no person is grouped wit...
habedi/stack-exchange-dataset
115,055
If you have a DFA M, how do you construct a new NFA that accepts L(M) and {e}?
<p>Suppose you're given a DFA <span class="math-container">$M$</span> with a 5 tuple of <span class="math-container">$(Q, \Sigma, \delta, q_0, F)$</span>.</p>&#xA;&#xA;<p>How do you construct an NFA that accepts <span class="math-container">$L(M)$</span> and <span class="math-container">$\{\varepsilon\}$</span>, the se...
automata
1
If you have a DFA M, how do you construct a new NFA that accepts L(M) and {e}? -- (automata) <p>Suppose you're given a DFA <span class="math-container">$M$</span> with a 5 tuple of <span class="math-container">$(Q, \Sigma, \delta, q_0, F)$</span>.</p>&#xA;&#xA;<p>How do you construct an NFA that accepts <span class="ma...
habedi/stack-exchange-dataset
115,062
generating all pairs
<p>suppose I have 6<span class="math-container">$\{0,1,2,3,4,5\}$</span> numbers.I should generate following 4 pairings of numbers where there will be 3 pairs in each pairing s.t</p>&#xA;&#xA;<ul>&#xA;<li><p>each number should be in one pair and also every number should be paired</p></li>&#xA;<li><p>a pair(like 0-1) sh...
algorithms combinatorics
1
generating all pairs -- (algorithms combinatorics) <p>suppose I have 6<span class="math-container">$\{0,1,2,3,4,5\}$</span> numbers.I should generate following 4 pairings of numbers where there will be 3 pairs in each pairing s.t</p>&#xA;&#xA;<ul>&#xA;<li><p>each number should be in one pair and also every number shoul...
habedi/stack-exchange-dataset
115,066
Minimum time to assemble multipart object
<p>I've been asked to do this task in an online assessment. I've passed, so my solution is supposedly correct, but I am unable to prove it. The task is:</p>&#xA;&#xA;<p>Given a set of parts (array of integer part sizes), worker must put them all together. Parts are assembled in pairs. To put together two parts of sizes...
algorithms
1
Minimum time to assemble multipart object -- (algorithms) <p>I've been asked to do this task in an online assessment. I've passed, so my solution is supposedly correct, but I am unable to prove it. The task is:</p>&#xA;&#xA;<p>Given a set of parts (array of integer part sizes), worker must put them all together. Parts ...
habedi/stack-exchange-dataset
115,077
Can non-metric TSP be approximated within some non-constant value?
<p>It is known that metric TSP can be approximated within some constant value, such as 3/2 through Christofides' algorithm. It is also known that non-metric TSP cannot be approximated within some constant value (unless P= NP), thanks to Sahni and Gonzalez.</p>&#xA;&#xA;<p>It isn't clear however if non-metric TSP can be...
approximation traveling salesman
1
Can non-metric TSP be approximated within some non-constant value? -- (approximation traveling salesman) <p>It is known that metric TSP can be approximated within some constant value, such as 3/2 through Christofides' algorithm. It is also known that non-metric TSP cannot be approximated within some constant value (unl...
habedi/stack-exchange-dataset
115,079
Algorithm for solving system of congruences
<p>I'm trying to understand an algorithm shown in my textbook for solving a system of congruences. The problem states:</p>&#xA;&#xA;<p>Let <span class="math-container">$r$</span> and <span class="math-container">$m$</span> be arrays of size <span class="math-container">$n$</span>, such that every two numbers (modulos) ...
algorithms
1
Algorithm for solving system of congruences -- (algorithms) <p>I'm trying to understand an algorithm shown in my textbook for solving a system of congruences. The problem states:</p>&#xA;&#xA;<p>Let <span class="math-container">$r$</span> and <span class="math-container">$m$</span> be arrays of size <span class="math-c...
habedi/stack-exchange-dataset
115,088
Is Finding A Hitting Set of Size n/2 NP-Hard?
<p>In Hitting Set problem we are given a collection E of subsets of V and we want to find smallest subset H of V which intersects (hits) every set in E.</p>&#xA;&#xA;<p>In decision version of the problem, we are asked if there exists a hitting set H of size at most k.</p>&#xA;&#xA;<p>This problem is known to be NP-hard...
reductions set cover
1
Is Finding A Hitting Set of Size n/2 NP-Hard? -- (reductions set cover) <p>In Hitting Set problem we are given a collection E of subsets of V and we want to find smallest subset H of V which intersects (hits) every set in E.</p>&#xA;&#xA;<p>In decision version of the problem, we are asked if there exists a hitting set ...
habedi/stack-exchange-dataset
115,089
Running time of algorithm (effect of j*j in for loops) - Theta Runtime
<h3>In Theta notation what are the running times of these algorithms?</h3>&#xA;<h1>Algorithm 1</h1>&#xA;<pre><code>for i=1..n&#xA; j=1&#xA; while j*j &lt;= i:&#xA; j = j + 1&#xA;</code></pre>&#xA;<p>Since the outer loop is going to n and the inner loop is going to sqrt(n). My guess is that it is Θ(n^2)</p>...
algorithms data structures asymptotics runtime analysis loops
1
Running time of algorithm (effect of j*j in for loops) - Theta Runtime -- (algorithms data structures asymptotics runtime analysis loops) <h3>In Theta notation what are the running times of these algorithms?</h3>&#xA;<h1>Algorithm 1</h1>&#xA;<pre><code>for i=1..n&#xA; j=1&#xA; while j*j &lt;= i:&#xA; j = j...
habedi/stack-exchange-dataset
115,093
Another vertex cover question?
<p>I'm not sure this is equivalent to bipartite vertex cover question. The question is:</p>&#xA;&#xA;<p>Given a BIPARTITE graph, what is the minimum number of vertex from the right side whose edges cover all vertex from the left side. </p>&#xA;&#xA;<p>e.g. In the following graph, the answer is 1, cause vertex g has con...
graphs vertex cover bipartite graph
1
Another vertex cover question? -- (graphs vertex cover bipartite graph) <p>I'm not sure this is equivalent to bipartite vertex cover question. The question is:</p>&#xA;&#xA;<p>Given a BIPARTITE graph, what is the minimum number of vertex from the right side whose edges cover all vertex from the left side. </p>&#xA;&#xA...
habedi/stack-exchange-dataset
115,097
Category theory structures to describe topics and queues
<p>What are the category theory structures describing queues and topics? By queues and topics I mean the ones described in systems like Apache Kafka, AcriveMQ or Java Messaging Service.</p>&#xA;&#xA;<p>Where I can find material about that?</p>&#xA;
category theory queues
1
Category theory structures to describe topics and queues -- (category theory queues) <p>What are the category theory structures describing queues and topics? By queues and topics I mean the ones described in systems like Apache Kafka, AcriveMQ or Java Messaging Service.</p>&#xA;&#xA;<p>Where I can find material about t...
habedi/stack-exchange-dataset
115,109
Using function composition to turn a function into point free one
<p>In <a href="https://en.wikipedia.org/wiki/Tacit_programming" rel="nofollow noreferrer">Tacit Programming</a> page on wikipedia, it is stated that the point free version of </p>&#xA;&#xA;<p><code>p x y z = f (g x y) z</code> is<br>&#xA;<code>p = ((.) f) . g</code> </p>&#xA;&#xA;<p>and that the point free version of</...
functional programming programming paradigms
1
Using function composition to turn a function into point free one -- (functional programming programming paradigms) <p>In <a href="https://en.wikipedia.org/wiki/Tacit_programming" rel="nofollow noreferrer">Tacit Programming</a> page on wikipedia, it is stated that the point free version of </p>&#xA;&#xA;<p><code>p x y ...
habedi/stack-exchange-dataset
115,125
Efficient algorithm for assigning weights to nodes in graph to create steady state flow
<p>I'm looking for an efficient algorithm (at least polynomial in the size of the graph, preferably linear) for the following problem:</p>&#xA;&#xA;<p><strong>Definitions</strong>: &#xA;Given a graph <span class="math-container">$(V,E)$</span>, with non-negative weights assigned to it's edges <span class="math-containe...
graphs network flow weighted graphs
1
Efficient algorithm for assigning weights to nodes in graph to create steady state flow -- (graphs network flow weighted graphs) <p>I'm looking for an efficient algorithm (at least polynomial in the size of the graph, preferably linear) for the following problem:</p>&#xA;&#xA;<p><strong>Definitions</strong>: &#xA;Given...
habedi/stack-exchange-dataset
115,134
Efficient data structure for matching 3D lines
<p>I'd like to</p>&#xA;&#xA;<ul>&#xA;<li>Store a set of many infinite undirected 3D lines.</li>&#xA;<li>Make lookups against this set - i.e. given an arbitrary line, ask "Does the set contain a line coincident with this one?"</li>&#xA;</ul>&#xA;&#xA;<p>The incidence-checks would of course have to be fuzzy to account fo...
data structures computational geometry sets
1
Efficient data structure for matching 3D lines -- (data structures computational geometry sets) <p>I'd like to</p>&#xA;&#xA;<ul>&#xA;<li>Store a set of many infinite undirected 3D lines.</li>&#xA;<li>Make lookups against this set - i.e. given an arbitrary line, ask "Does the set contain a line coincident with this one?...
habedi/stack-exchange-dataset
115,151
packing with time-variant weights
<p><em>This appears to be a knapsack / bin-packing problem, but I seem to have got stuck and could appreciate contributions.</em></p>&#xA;&#xA;<p><strong>Scenario 1: Tough (for me!)</strong>&#xA;There is a one day conference with a set of (4 or more) sessions.&#xA;The conference will be attended by a number of companie...
algorithms knapsack problems packing
1
packing with time-variant weights -- (algorithms knapsack problems packing) <p><em>This appears to be a knapsack / bin-packing problem, but I seem to have got stuck and could appreciate contributions.</em></p>&#xA;&#xA;<p><strong>Scenario 1: Tough (for me!)</strong>&#xA;There is a one day conference with a set of (4 or...
habedi/stack-exchange-dataset
115,158
Simple cycles of length two in an undirected graph
<p>Pedagogical question.</p>&#xA;&#xA;<p><strong>Background</strong></p>&#xA;&#xA;<p>A cycle in a graph can be defined as a sequence of vertices <span class="math-container">$v_1,\dots,v_n$</span> with <span class="math-container">$v_1=v_n$</span> such that, for each <span class="math-container">$i \in \{1,\dots,n-1\}$...
graphs pedagogy definitions
1
Simple cycles of length two in an undirected graph -- (graphs pedagogy definitions) <p>Pedagogical question.</p>&#xA;&#xA;<p><strong>Background</strong></p>&#xA;&#xA;<p>A cycle in a graph can be defined as a sequence of vertices <span class="math-container">$v_1,\dots,v_n$</span> with <span class="math-container">$v_1=...
habedi/stack-exchange-dataset
115,159
Minimum-cut with minimum number of edges
<p>I am sure many folks here know the famous min-cut max-flow theorem - the capacity of the minimum cut is equal to the maximum flow from a given source, s, to a given sink, t, in a graph.</p>&#xA;&#xA;<p>Firstly, let's state (for completeness) that an s-t cut is the partitioning of the vertices in the graph, into two ...
algorithms graphs network flow minimum cuts
1
Minimum-cut with minimum number of edges -- (algorithms graphs network flow minimum cuts) <p>I am sure many folks here know the famous min-cut max-flow theorem - the capacity of the minimum cut is equal to the maximum flow from a given source, s, to a given sink, t, in a graph.</p>&#xA;&#xA;<p>Firstly, let's state (for...
habedi/stack-exchange-dataset
115,163
The optimized numbers of variables and clauses to encode a graph coloring problem in CNF
<h2>Problem Statement</h2>&#xA;&#xA;<p>Given a finite graph <span class="math-container">$G = \langle V, E\rangle$</span>, consisting of vertice set <span class="math-container">$V$</span> and edge set <span class="math-container">$E$</span>, and a finite set of colors <span class="math-container">$C$</span>, a problem...
graphs propositional logic
1
The optimized numbers of variables and clauses to encode a graph coloring problem in CNF -- (graphs propositional logic) <h2>Problem Statement</h2>&#xA;&#xA;<p>Given a finite graph <span class="math-container">$G = \langle V, E\rangle$</span>, consisting of vertice set <span class="math-container">$V$</span> and edge s...
habedi/stack-exchange-dataset
115,184
How can $\Theta$ and $O$ complexities be different?
<p>From the definition of the <span class="math-container">$\Theta$</span>-notation,&#xA;<span class="math-container">$$f(n)=\Theta(g(n))\\\implies \exists n_0, \exists c_1,c_2\gt 0, \forall n\gt n_0, c_1\cdot g(n)\le f(n)\le c_2\cdot g(n)$$</span></p>&#xA;&#xA;<p>We can see that the inequality is followed for all <spa...
time complexity asymptotics big o notation
1
How can $\Theta$ and $O$ complexities be different? -- (time complexity asymptotics big o notation) <p>From the definition of the <span class="math-container">$\Theta$</span>-notation,&#xA;<span class="math-container">$$f(n)=\Theta(g(n))\\\implies \exists n_0, \exists c_1,c_2\gt 0, \forall n\gt n_0, c_1\cdot g(n)\le f(...
habedi/stack-exchange-dataset
115,190
What is the complexity of sum of Logarithm of an arithmetic series
<p>this is the arithmetic series:</p>&#xA;&#xA;<p><span class="math-container">$a/b,2a/b,3a/b,...,ba/b$</span></p>&#xA;&#xA;<p>The new series:</p>&#xA;&#xA;<p><span class="math-container">$log(a/b),log(2a/b),log(3a/b),...,log(ba/b)$</span></p>&#xA;&#xA;<p>I want the complexity of sum of the latter.</p>&#xA;&#xA;<p>p.s:...
complexity theory
1
What is the complexity of sum of Logarithm of an arithmetic series -- (complexity theory) <p>this is the arithmetic series:</p>&#xA;&#xA;<p><span class="math-container">$a/b,2a/b,3a/b,...,ba/b$</span></p>&#xA;&#xA;<p>The new series:</p>&#xA;&#xA;<p><span class="math-container">$log(a/b),log(2a/b),log(3a/b),...,log(ba/b...
habedi/stack-exchange-dataset
115,208
Please provide me a solution of Max-Heapify using Recursion Tree
<p>I tried my best to solve the recurrence relation.</p>&#xA;&#xA;<p><span class="math-container">$T(n) \le T(2n/3) + \Theta(1)$</span></p>&#xA;&#xA;<p>Using the recursion tree.</p>&#xA;&#xA;<p>I could reach out the boundary condition when at depth <code>i</code>:</p>&#xA;&#xA;<p><span class="math-container">$i= \log_{...
algorithms recurrence relation heap sort
1
Please provide me a solution of Max-Heapify using Recursion Tree -- (algorithms recurrence relation heap sort) <p>I tried my best to solve the recurrence relation.</p>&#xA;&#xA;<p><span class="math-container">$T(n) \le T(2n/3) + \Theta(1)$</span></p>&#xA;&#xA;<p>Using the recursion tree.</p>&#xA;&#xA;<p>I could reach o...
habedi/stack-exchange-dataset
115,214
Is Palindrome subset of a regular language regular?
<p>Suppose we have <span class="math-container">$L$</span> being a regular language with alphabet <span class="math-container">$\Sigma$</span>, if we define <span class="math-container">$M=\{ x \in \Sigma^{*} \mid xx^{R} \in L \}$</span>, then we know that <span class="math-container">$M$</span> contains all half cop...
formal languages regular languages finite automata pumping lemma
1
Is Palindrome subset of a regular language regular? -- (formal languages regular languages finite automata pumping lemma) <p>Suppose we have <span class="math-container">$L$</span> being a regular language with alphabet <span class="math-container">$\Sigma$</span>, if we define <span class="math-container">$M=\{ x \in ...
habedi/stack-exchange-dataset
115,216
On the hardness of satisfying K number of linear constraints
<p><strong>Background:</strong> Normally in linear programing we have some objective function&#xA;<span class="math-container">$$\text{maximize}\sum_{i = 1}^n a_i x_i $$</span>&#xA;<span class="math-container">$$\text{subject to} \sum_{i =1}^n b_{ji}x_i \leq c_j \text{ for all } 1 \leq j \leq m$$</span>&#xA;where <span...
algorithms complexity theory np complete linear programming
1
On the hardness of satisfying K number of linear constraints -- (algorithms complexity theory np complete linear programming) <p><strong>Background:</strong> Normally in linear programing we have some objective function&#xA;<span class="math-container">$$\text{maximize}\sum_{i = 1}^n a_i x_i $$</span>&#xA;<span class="...
habedi/stack-exchange-dataset
115,226
Proving $({L_A}^* L_B)^+ = (L_A \cup L_B)^*L_B$
<p>I'm trying to prove the following identity:&#xA;<span class="math-container">$$ ({L_A}^*\ L_B)^+ = (L_A \cup L_B)^*L_B $$</span></p>&#xA;&#xA;<p>which is clearly true as both sides will exactly match <strong>"<em>any sequence of A and B ending with B</em>"</strong> :</p>&#xA;&#xA;<p><span class="math-container">$$ ...
regular languages
1
Proving $({L_A}^* L_B)^+ = (L_A \cup L_B)^*L_B$ -- (regular languages) <p>I'm trying to prove the following identity:&#xA;<span class="math-container">$$ ({L_A}^*\ L_B)^+ = (L_A \cup L_B)^*L_B $$</span></p>&#xA;&#xA;<p>which is clearly true as both sides will exactly match <strong>"<em>any sequence of A and B ending w...
habedi/stack-exchange-dataset
115,231
What does the following algorithm approximate? (Assume m>1,ϵ>0)
<p><code>x = m;&#xA;y = 1;&#xA;While (x-y &gt; ϵ)&#xA;{&#xA; x = (x+y)/2;&#xA; y = m/x;&#xA;}&#xA;print(x);</code></p>&#xA;&#xA;<p>The answer is m½, its the Babylonian algorithm for square roots.&#xA;I understand the algorithm but haven't been able to reverse engineer what this code does (which is the point of th...
algorithms c
1
What does the following algorithm approximate? (Assume m>1,ϵ>0) -- (algorithms c) <p><code>x = m;&#xA;y = 1;&#xA;While (x-y &gt; ϵ)&#xA;{&#xA; x = (x+y)/2;&#xA; y = m/x;&#xA;}&#xA;print(x);</code></p>&#xA;&#xA;<p>The answer is m½, its the Babylonian algorithm for square roots.&#xA;I understand the algorithm but h...
habedi/stack-exchange-dataset
115,232
Finding the fastest sorting algorithm
<p>I was thinking about how many compares it takes to sort a list of comparable data, and I had an algorithm I was wondering the viability of.</p>&#xA;&#xA;<p>(Its not unlikely that someone has come up with this before me [though I didn't find anything by researching it]. So if either this isn't useful, or someone has ...
sorting
1
Finding the fastest sorting algorithm -- (sorting) <p>I was thinking about how many compares it takes to sort a list of comparable data, and I had an algorithm I was wondering the viability of.</p>&#xA;&#xA;<p>(Its not unlikely that someone has come up with this before me [though I didn't find anything by researching i...
habedi/stack-exchange-dataset
115,233
Derive a while loop runs in $\Theta( \sqrt{n} )$
<p>I know for a fact that algorithm <strong>A</strong> runs in <span class="math-container">$\Theta(\sqrt{n})$</span>, but how does one derive that fact?</p>&#xA;&#xA;<p>Algorithm <strong>A</strong></p>&#xA;&#xA;<pre><code>i = 0&#xA;s = 0&#xA;while s &lt;= n:&#xA; s += i&#xA; i += 1&#xA;</code></pre>&#xA;&#xA;<p>...
algorithms algorithm analysis time complexity runtime analysis
1
Derive a while loop runs in $\Theta( \sqrt{n} )$ -- (algorithms algorithm analysis time complexity runtime analysis) <p>I know for a fact that algorithm <strong>A</strong> runs in <span class="math-container">$\Theta(\sqrt{n})$</span>, but how does one derive that fact?</p>&#xA;&#xA;<p>Algorithm <strong>A</strong></p>&...
habedi/stack-exchange-dataset
115,241
Method to construct a finite state machine for a finite-size language L
<p>I need to define a method to construct a finite automata for a finite language L (part of my proof for something else).&#xA;My idea:</p>&#xA;&#xA;<ol>&#xA;<li>Create <span class="math-container">$|L|$</span> accepting states.</li>&#xA;<li>For each input string <span class="math-container">$s$</span> from <span class...
formal languages regular languages finite automata
1
Method to construct a finite state machine for a finite-size language L -- (formal languages regular languages finite automata) <p>I need to define a method to construct a finite automata for a finite language L (part of my proof for something else).&#xA;My idea:</p>&#xA;&#xA;<ol>&#xA;<li>Create <span class="math-conta...
habedi/stack-exchange-dataset
115,247
Strongly connected graph proof
<p>Here I have a proof related to strongly connected graph from Algorithms book.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/6mx1D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6mx1D.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>However, when I run DFS on the following 2 stron...
graphs graph traversal
1
Strongly connected graph proof -- (graphs graph traversal) <p>Here I have a proof related to strongly connected graph from Algorithms book.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/6mx1D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6mx1D.png" alt="enter image description here"></a></p>&#...
habedi/stack-exchange-dataset
115,249
creating a binary search tree (manual)
<p>I've been given the following values to add to a binary search tree (in the order given)</p>&#xA;&#xA;<p>56, 35, 55, 58, 29, 15, 16, 5, 71, 92, 69, 95</p>&#xA;&#xA;<p>and this is what my tree ended up like:</p>&#xA;&#xA;<p>but apparently it's wrong?</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/47IHg.png" rel="...
binary search trees
1
creating a binary search tree (manual) -- (binary search trees) <p>I've been given the following values to add to a binary search tree (in the order given)</p>&#xA;&#xA;<p>56, 35, 55, 58, 29, 15, 16, 5, 71, 92, 69, 95</p>&#xA;&#xA;<p>and this is what my tree ended up like:</p>&#xA;&#xA;<p>but apparently it's wrong?</p>...
habedi/stack-exchange-dataset
115,258
Does a type-1 automaton always have to terminate?
<p>For push-down automata it seems obvious to me that a program must always terminate (given the input is finite), because for each input symbol they advance until eventually they run out of symbols and then terminate.</p>&#xA;&#xA;<p>The opposite is true for Turing machines as they read their input from the tape and a...
formal languages linear bounded automata termination
1
Does a type-1 automaton always have to terminate? -- (formal languages linear bounded automata termination) <p>For push-down automata it seems obvious to me that a program must always terminate (given the input is finite), because for each input symbol they advance until eventually they run out of symbols and then term...
habedi/stack-exchange-dataset
115,260
Path finding through bipartite graph
<p>Is there a path finding algorithm that exploits a directed bipartite graphs' structure? </p>&#xA;&#xA;<p>I found this: <a href="https://cs.stackexchange.com/questions/47379/shortest-path-for-weighted-directed-bipartite-graphs">Shortest-Path for Weighted Directed Bipartite Graphs</a> but it didn't seem like the OP ne...
bipartite graph
1
Path finding through bipartite graph -- (bipartite graph) <p>Is there a path finding algorithm that exploits a directed bipartite graphs' structure? </p>&#xA;&#xA;<p>I found this: <a href="https://cs.stackexchange.com/questions/47379/shortest-path-for-weighted-directed-bipartite-graphs">Shortest-Path for Weighted Direc...
habedi/stack-exchange-dataset
115,273
Why log-space reduction is used for NL-completeness while PSPACE reduction isn't used for PSPACE completeness?
<p>NL-Complete languages are defined by Log-space reduction, while PSPACE complete languages are defined by poly-time many-to-one reduction.</p>&#xA;<p>According to these posts :</p>&#xA;<p><a href="https://cs.stackexchange.com/questions/96947/why-not-polynomial-space-reductions-for-pspace-hardness?rq=1">Why not polyno...
complexity theory time complexity reductions complexity classes space complexity
1
Why log-space reduction is used for NL-completeness while PSPACE reduction isn't used for PSPACE completeness? -- (complexity theory time complexity reductions complexity classes space complexity) <p>NL-Complete languages are defined by Log-space reduction, while PSPACE complete languages are defined by poly-time many-...
habedi/stack-exchange-dataset
115,282
What are the elements of the modular ring mod 7?
<p>Are the elements of a modular ring simply the set of all the numbers from 1 to p−1? </p>&#xA;&#xA;<p>in this case p−1 = 6 ?</p>&#xA;&#xA;<p>I asked this on the math stack exchange <a href="https://math.stackexchange.com/q/3375667">https://math.stackexchange.com/q/3375667</a> and was told that 0 is included in the th...
cryptography modular arithmetic
1
What are the elements of the modular ring mod 7? -- (cryptography modular arithmetic) <p>Are the elements of a modular ring simply the set of all the numbers from 1 to p−1? </p>&#xA;&#xA;<p>in this case p−1 = 6 ?</p>&#xA;&#xA;<p>I asked this on the math stack exchange <a href="https://math.stackexchange.com/q/3375667">...
habedi/stack-exchange-dataset
115,284
Divide $n$ gifts among three people so as to minimize the difference in the total cost of gifts between the most lucky and the most unlucky people
<blockquote>&#xA; <p>Divide <span class="math-container">$n$</span> gifts of different values among three people so as to minimize the difference in the total cost of the gifts for the most lucky and the most unlucky persons.</p>&#xA;</blockquote>&#xA;&#xA;<p>The total value of <span class="math-container">$n$</span> ...
algorithms dynamic programming knapsack problems
1
Divide $n$ gifts among three people so as to minimize the difference in the total cost of gifts between the most lucky and the most unlucky people -- (algorithms dynamic programming knapsack problems) <blockquote>&#xA; <p>Divide <span class="math-container">$n$</span> gifts of different values among three people so as...
habedi/stack-exchange-dataset
115,286
Give an example of a connected graph where α(G) =100 and β(G) = 200
<p>So I need to find a form of a graph such that its vertex cover is twice that of its matching, but I am running into problems brainstorming, I know K3 is of this form, but not one at such a magnitude.</p>&#xA;
graphs matching vertex cover
1
Give an example of a connected graph where α(G) =100 and β(G) = 200 -- (graphs matching vertex cover) <p>So I need to find a form of a graph such that its vertex cover is twice that of its matching, but I am running into problems brainstorming, I know K3 is of this form, but not one at such a magnitude.</p>&#xA;
habedi/stack-exchange-dataset
115,307
Is language {M | M halts and print "Hello World"} recursively enumerable?
<p>Is language {M | M halts and print "Hello World"} recursively enumerable?&#xA;I'm not sure my proof is correct.&#xA;Let universal Turing machine U start another Turing machine M2 that reads result of work of given Turing machine M1, which halts on "Hello World" and goes to infinite loop otherwise. Then M2(M1) halts ...
turing machines
1
Is language {M | M halts and print "Hello World"} recursively enumerable? -- (turing machines) <p>Is language {M | M halts and print "Hello World"} recursively enumerable?&#xA;I'm not sure my proof is correct.&#xA;Let universal Turing machine U start another Turing machine M2 that reads result of work of given Turing m...
habedi/stack-exchange-dataset
115,308
Is $\Gamma \vdash x x : T$ possible in the simply typed lambda calculus?
<p>Is <span class="math-container">$\Gamma \vdash x x : T$</span> possible?</p>&#xA;&#xA;<p>This problem appears on page 104 of Benjamin Pierce's "Types and Programming Languages".</p>&#xA;&#xA;<p>My conclusion is that it is was the case then we would get <span class="math-container">$x: T_1 \to T_2$</span> and <span c...
lambda calculus types
1
Is $\Gamma \vdash x x : T$ possible in the simply typed lambda calculus? -- (lambda calculus types) <p>Is <span class="math-container">$\Gamma \vdash x x : T$</span> possible?</p>&#xA;&#xA;<p>This problem appears on page 104 of Benjamin Pierce's "Types and Programming Languages".</p>&#xA;&#xA;<p>My conclusion is that i...
habedi/stack-exchange-dataset
115,309
Is Space Complexity Always Less Than Or Equal To Time Complexity?
<p><strong>Background</strong><br>&#xA;I am working on proving a novel problem to be P-Complete, and this requires using a logspace reduction to reduce some known P-Complete problem to the novel problem. Particularly, I am reducing the Circuit Value Problem, the de facto P-Complete problem, to the novel problem. </p>&#...
complexity theory time complexity space complexity
1
Is Space Complexity Always Less Than Or Equal To Time Complexity? -- (complexity theory time complexity space complexity) <p><strong>Background</strong><br>&#xA;I am working on proving a novel problem to be P-Complete, and this requires using a logspace reduction to reduce some known P-Complete problem to the novel pro...
habedi/stack-exchange-dataset
115,310
What is Round Robin's behavior when a process comes at the same time that the old process is swapped out?
<p>Let's say there are two processes: p1 and p2, their arrival time and service time are 0,2 and 3,1 respectively. The time quantum is 2s.</p>&#xA;&#xA;<p>After excuting for two seconds, will the processor excute p2 or continue excuting p1?</p>&#xA;
scheduling process scheduling
1
What is Round Robin's behavior when a process comes at the same time that the old process is swapped out? -- (scheduling process scheduling) <p>Let's say there are two processes: p1 and p2, their arrival time and service time are 0,2 and 3,1 respectively. The time quantum is 2s.</p>&#xA;&#xA;<p>After excuting for two ...
habedi/stack-exchange-dataset
115,317
Büchi automaton to Linear Temporal Logic
<p>Given a Büchi automaton what is the procedure to build an equivalent LTL formula? And what is its size?</p>&#xA;&#xA;<p>I'm looking for references but I haven't found them so far.</p>&#xA;
automata linear temporal logic buchi automata
1
Büchi automaton to Linear Temporal Logic -- (automata linear temporal logic buchi automata) <p>Given a Büchi automaton what is the procedure to build an equivalent LTL formula? And what is its size?</p>&#xA;&#xA;<p>I'm looking for references but I haven't found them so far.</p>&#xA;
habedi/stack-exchange-dataset
115,318
How does $\mathsf{NP} \subset \mathsf{P}/\mathsf{poly}$ imply these two inclusions?
<p>In the proof of Theorem 1 in <a href="http://drops.dagstuhl.de/opus/volltexte/2019/10852/pdf/LIPIcs-CCC-2019-30.pdf" rel="nofollow noreferrer">this paper</a> by Chen, McKay, Murray, and Williams the authors assume <span class="math-container">$\mathsf{NP} \subset \mathsf{P}/\mathsf{poly}$</span> and (in different pa...
complexity theory circuits
1
How does $\mathsf{NP} \subset \mathsf{P}/\mathsf{poly}$ imply these two inclusions? -- (complexity theory circuits) <p>In the proof of Theorem 1 in <a href="http://drops.dagstuhl.de/opus/volltexte/2019/10852/pdf/LIPIcs-CCC-2019-30.pdf" rel="nofollow noreferrer">this paper</a> by Chen, McKay, Murray, and Williams the au...
habedi/stack-exchange-dataset
115,328
question about algorithm
<p>as you know we have equivalent condition for graphs so I want to ask a very basic question and please help me what is exactly w1(e1) and w1(e2) and w2(e1) and w2(e1) ?&#xA;If e1 means path from A to B so w1 means the weight of the path e1 and so what about w2 and what does it mean means ?&#xA;is there any link for t...
algorithms graphs weighted graphs
1
question about algorithm -- (algorithms graphs weighted graphs) <p>as you know we have equivalent condition for graphs so I want to ask a very basic question and please help me what is exactly w1(e1) and w1(e2) and w2(e1) and w2(e1) ?&#xA;If e1 means path from A to B so w1 means the weight of the path e1 and so what ab...
habedi/stack-exchange-dataset
115,330
Given a set of intervals $(I_n)_n$ contained in $[0, L]$, compute the longest interval in $[0, L]$ which has empty intersection with all $(I_n)_n$
<p>Let be <span class="math-container">$(I_n)_n$</span> a set of <span class="math-container">$p$</span> intervals each contained in <span class="math-container">$[0, L]$</span> for <span class="math-container">$L \geq 1$</span>.</p>&#xA;&#xA;<p>I define <span class="math-container">$(J_n = [a_n, b_n])_n$</span> the se...
search trees counting intervals
1
Given a set of intervals $(I_n)_n$ contained in $[0, L]$, compute the longest interval in $[0, L]$ which has empty intersection with all $(I_n)_n$ -- (search trees counting intervals) <p>Let be <span class="math-container">$(I_n)_n$</span> a set of <span class="math-container">$p$</span> intervals each contained in <sp...
habedi/stack-exchange-dataset
115,336
Is there a concept called "white waveforms" in computer science?
<p>It sounds like the <a href="https://youtu.be/zH2s4XSEWO0?t=150" rel="nofollow noreferrer">lecturer</a> is speaking</p>&#xA;&#xA;<blockquote>&#xA; <p>If you for example want to play a&#xA; music file, mp3 file, well you know, given&#xA; that you've taken a programming course&#xA; before, all right? How would you ...
terminology
1
Is there a concept called "white waveforms" in computer science? -- (terminology) <p>It sounds like the <a href="https://youtu.be/zH2s4XSEWO0?t=150" rel="nofollow noreferrer">lecturer</a> is speaking</p>&#xA;&#xA;<blockquote>&#xA; <p>If you for example want to play a&#xA; music file, mp3 file, well you know, given&#x...
habedi/stack-exchange-dataset
115,337
Equivalence from multi-tape to single-tape implies limited write space?
<p>Suppose I have the following subroutine, to a more complex program, that uses spaces to the right of the tape:</p>&#xA;&#xA;<p><span class="math-container">$A$</span>: "adds a $ at the beginning of the tape."</p>&#xA;&#xA;<p>So we have:&#xA;<span class="math-container">$$&#xA;\begin{array}{lc}&#xA;\text{Before }: &a...
turing machines automata
1
Equivalence from multi-tape to single-tape implies limited write space? -- (turing machines automata) <p>Suppose I have the following subroutine, to a more complex program, that uses spaces to the right of the tape:</p>&#xA;&#xA;<p><span class="math-container">$A$</span>: "adds a $ at the beginning of the tape."</p>&#x...
habedi/stack-exchange-dataset
115,352
Why $o(\log n)$ bits instead of $O(\log n)$ bits needed for succinct data structure?
<p>Succinct data structure = succinct representation of data + bits for indexing. <a href="https://www.cs.helsinki.fi/u/puglisi/dct2015/slides10.pdf" rel="nofollow noreferrer">Link</a></p>&#xA;&#xA;<p>Let <span class="math-container">$S$</span> be subset of of <span class="math-container">$\{1,2,\ldots,n\}$</span> th...
data structures
1
Why $o(\log n)$ bits instead of $O(\log n)$ bits needed for succinct data structure? -- (data structures) <p>Succinct data structure = succinct representation of data + bits for indexing. <a href="https://www.cs.helsinki.fi/u/puglisi/dct2015/slides10.pdf" rel="nofollow noreferrer">Link</a></p>&#xA;&#xA;<p>Let <span cla...
habedi/stack-exchange-dataset
115,355
What is the density of a regular language $L$ over an alphabet $\Sigma$ in $\Sigma^n$?
<p>In other words, what is the likelihood that a recognizer of a given regular language will accept a&#xA;random string of length <span class="math-container">$n$</span>?</p>&#xA;&#xA;<p>&nbsp;</p>&#xA;&#xA;<p><strong>If there is only a single non-terminal <span class="math-container">$A$</span></strong>, then there ar...
regular languages formal grammars combinatorics probability theory
1
What is the density of a regular language $L$ over an alphabet $\Sigma$ in $\Sigma^n$? -- (regular languages formal grammars combinatorics probability theory) <p>In other words, what is the likelihood that a recognizer of a given regular language will accept a&#xA;random string of length <span class="math-container">$n...
habedi/stack-exchange-dataset
115,360
Pick a random number in a pool with duplicates in O(1) time and less than O(n) space?
<p>Imagine trying to pick a random number from a pool of numbers that contains: </p>&#xA;&#xA;<p>i1 times the number 1<br>&#xA;i2 times the number 2<br>&#xA;i3 times the number 3<br>&#xA;... etc </p>&#xA;&#xA;<p>For example picking a random number in a pool of<br>&#xA;30 times the number 1<br>&#xA;90 times the number...
algorithms complexity theory
1
Pick a random number in a pool with duplicates in O(1) time and less than O(n) space? -- (algorithms complexity theory) <p>Imagine trying to pick a random number from a pool of numbers that contains: </p>&#xA;&#xA;<p>i1 times the number 1<br>&#xA;i2 times the number 2<br>&#xA;i3 times the number 3<br>&#xA;... etc </p...
habedi/stack-exchange-dataset
115,367
Time-complexity for basic multiplication and division algorithms
<p>The algorithms below has been taken from Discrete Mathematics and it's Applications 7th edition book by Rosen.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/fZowr.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fZowr.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>p.253 says that...
algorithms time complexity big o notation
1
Time-complexity for basic multiplication and division algorithms -- (algorithms time complexity big o notation) <p>The algorithms below has been taken from Discrete Mathematics and it's Applications 7th edition book by Rosen.</p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/fZowr.png" rel="nofollow noreferrer"><img s...
habedi/stack-exchange-dataset
115,368
How is β-reduction a 2-morphism in Category theory?
<p>According to <a href="https://golem.ph.utexas.edu/category/2006/08/categorifying_cccs_seeing_comp.html" rel="nofollow noreferrer">Categorifying CCCs: Computation as a Process</a>, computation or β-reduction process in untyped-lambda calculus is in fact a 2-morphism in category theory. </p>&#xA;&#xA;<p>Can someone p...
lambda calculus type theory category theory
1
How is β-reduction a 2-morphism in Category theory? -- (lambda calculus type theory category theory) <p>According to <a href="https://golem.ph.utexas.edu/category/2006/08/categorifying_cccs_seeing_comp.html" rel="nofollow noreferrer">Categorifying CCCs: Computation as a Process</a>, computation or β-reduction process i...
habedi/stack-exchange-dataset
115,371
Black Box Decision problem for NFA
<p>Suppose we are given an NFA <span class="math-container">$M$</span> (without <span class="math-container">$\epsilon$</span>-transitions) that we only know the alphabet <span class="math-container">$\Sigma$</span> and the number of states <span class="math-container">$|Q|$</span> but we do not know any other details ...
automata
1
Black Box Decision problem for NFA -- (automata) <p>Suppose we are given an NFA <span class="math-container">$M$</span> (without <span class="math-container">$\epsilon$</span>-transitions) that we only know the alphabet <span class="math-container">$\Sigma$</span> and the number of states <span class="math-container">$...
habedi/stack-exchange-dataset
115,381
How to Get Started in Computer Science
<p>I am wondering how to get started in studying theoretical computer science and how to apply it to my programming. I am fairly comfortable with basic programming, having been programming in mainly C++ but also Java for the past couple of years, so I don't necessarily need an introduction to programming.</p>&#xA;&#xA;...
software engineering
1
How to Get Started in Computer Science -- (software engineering) <p>I am wondering how to get started in studying theoretical computer science and how to apply it to my programming. I am fairly comfortable with basic programming, having been programming in mainly C++ but also Java for the past couple of years, so I don...
habedi/stack-exchange-dataset
115,387
Derive a while loop (which seemingly have some logarithmic traits) runs in $\Theta(n)$
<p>I know for a fact that algorithm <strong>A</strong> runs in <span class="math-container">$\Theta(n)$</span>, but how does one derive that?</p>&#xA;&#xA;<p>Algorithm <strong>A</strong></p>&#xA;&#xA;<pre><code>i = 1&#xA;while i ≤ n&#xA; s = 0&#xA; while s ≤ i&#xA; s = s + 1&#xA; i = 2 ∗ i&#xA;</code></pre>&#xA;&...
algorithm analysis asymptotics runtime analysis big o notation
1
Derive a while loop (which seemingly have some logarithmic traits) runs in $\Theta(n)$ -- (algorithm analysis asymptotics runtime analysis big o notation) <p>I know for a fact that algorithm <strong>A</strong> runs in <span class="math-container">$\Theta(n)$</span>, but how does one derive that?</p>&#xA;&#xA;<p>Algorit...
habedi/stack-exchange-dataset
115,400
What is a sticky bit in computer architecture?
<p>I am reading about a counter implementation in RISC Architecture. The specification reads, </p>&#xA;&#xA;<blockquote>&#xA; <p>Sticky overflow bit is set when the counter wraps through zero. </p>&#xA;</blockquote>&#xA;&#xA;<p>I can infer that the overflow bit is set when the counter reaches maximum value(all 1's) an...
computer architecture
1
What is a sticky bit in computer architecture? -- (computer architecture) <p>I am reading about a counter implementation in RISC Architecture. The specification reads, </p>&#xA;&#xA;<blockquote>&#xA; <p>Sticky overflow bit is set when the counter wraps through zero. </p>&#xA;</blockquote>&#xA;&#xA;<p>I can infer that ...
habedi/stack-exchange-dataset
115,404
Is Newton's algorithm really this much better than conjugate gradient descent?
<p>I have a function I'm minimizing. I'm using conjugate gradient descent and the Newton algorithm.</p>&#xA;&#xA;<p>I am experiencing that the Newton algorithm is absurdly faster. Like, it finishes it 5-6 iterations, while the conjugate gradient takes 2000 iterations (and regular gradient descent takes 5000 iterations)...
optimization gradient descent
1
Is Newton's algorithm really this much better than conjugate gradient descent? -- (optimization gradient descent) <p>I have a function I'm minimizing. I'm using conjugate gradient descent and the Newton algorithm.</p>&#xA;&#xA;<p>I am experiencing that the Newton algorithm is absurdly faster. Like, it finishes it 5-6 i...
habedi/stack-exchange-dataset
115,405
How to evaluate all possible groups of adjacent tiles in 2D array?
<p>I'm working on a tile based game idea in Javascript. It's a math puzzle game where players move around tiles with numbers on them, and the goal is to connect groups of tiles that have a sum of certain goal number, for example 5 or 7 or 9.&#xA;<a href="https://i.stack.imgur.com/ErH8c.png" rel="nofollow noreferrer"><i...
algorithms graphs graph traversal
1
How to evaluate all possible groups of adjacent tiles in 2D array? -- (algorithms graphs graph traversal) <p>I'm working on a tile based game idea in Javascript. It's a math puzzle game where players move around tiles with numbers on them, and the goal is to connect groups of tiles that have a sum of certain goal numbe...
habedi/stack-exchange-dataset
115,406
What kind of error are these?
<p>I was following a discussion on a forum where a person has asked whether the following generates lexical errors or not,</p>&#xA;&#xA;<blockquote>&#xA; <p>(1) char p="gate;</p>&#xA; &#xA; <p>(2) int /* n;</p>&#xA; &#xA; <p>(3) printf("%d, n);</p>&#xA;</blockquote>&#xA;&#xA;<p>When I tried to run them on my CPP c...
syntax
1
What kind of error are these? -- (syntax) <p>I was following a discussion on a forum where a person has asked whether the following generates lexical errors or not,</p>&#xA;&#xA;<blockquote>&#xA; <p>(1) char p="gate;</p>&#xA; &#xA; <p>(2) int /* n;</p>&#xA; &#xA; <p>(3) printf("%d, n);</p>&#xA;</blockquote>&#xA;&#...
habedi/stack-exchange-dataset
115,416
Range intersection with bounding box?
<p>I have a lexicographical order on integer <span class="math-container">$n$</span>-tuples, where <span class="math-container">$(x,y,\dots) &gt; (a,b,\dots)$</span> if <span class="math-container">$x&gt;a$</span> or if <span class="math-container">$x=a$</span> and <span class="math-container">$y&gt;b$</span>, and so o...
algorithms
1
Range intersection with bounding box? -- (algorithms) <p>I have a lexicographical order on integer <span class="math-container">$n$</span>-tuples, where <span class="math-container">$(x,y,\dots) &gt; (a,b,\dots)$</span> if <span class="math-container">$x&gt;a$</span> or if <span class="math-container">$x=a$</span> and ...
habedi/stack-exchange-dataset
115,417
Search Algorithm with two areas of solutions
<p>I need some help with a problem. I have currently an algorithm. This algorithm gives me a true or false for a variable which I need to iterate( e. g. From 0 to 100} . Till now I solved it with a brute force method. So I just enhance the variable by a factor, enter the variable to the algorithm till I get a true. &#x...
algorithm analysis search algorithms iteration b method
1
Search Algorithm with two areas of solutions -- (algorithm analysis search algorithms iteration b method) <p>I need some help with a problem. I have currently an algorithm. This algorithm gives me a true or false for a variable which I need to iterate( e. g. From 0 to 100} . Till now I solved it with a brute force meth...
habedi/stack-exchange-dataset
115,422
Minimizing the iterative sum of pairs of numbers in a list
<p>Given the tuple (list, value):</p>&#xA;&#xA;<p><span class="math-container">$$\left(\left[x_1, x_2, \cdots x_n\right], y\right)$$</span></p>&#xA;&#xA;<p>You may choose two adjacent values in the list to modify the tuple as:</p>&#xA;&#xA;<p><span class="math-container">$$\left(\left[x_1, x_2, \cdots x_{i-1}, (x_i + x...
algorithms lists subset sum
1
Minimizing the iterative sum of pairs of numbers in a list -- (algorithms lists subset sum) <p>Given the tuple (list, value):</p>&#xA;&#xA;<p><span class="math-container">$$\left(\left[x_1, x_2, \cdots x_n\right], y\right)$$</span></p>&#xA;&#xA;<p>You may choose two adjacent values in the list to modify the tuple as:</...
habedi/stack-exchange-dataset
115,429
Example of a code that can be decoded using bounded distance decoder
<p>In the book <em>Information theory, Inference and Learning Algorithm</em>, in chapter 13, MacKay defines bounded distance decoding</p>&#xA;&#xA;<blockquote>&#xA; <p>A bounded distance decoder is a decoder that returns the closest codeword to a received binary vector <span class="math-container">$\mathbf{r}$</span> ...
coding theory error correcting codes
1
Example of a code that can be decoded using bounded distance decoder -- (coding theory error correcting codes) <p>In the book <em>Information theory, Inference and Learning Algorithm</em>, in chapter 13, MacKay defines bounded distance decoding</p>&#xA;&#xA;<blockquote>&#xA; <p>A bounded distance decoder is a decoder ...
habedi/stack-exchange-dataset
115,438
Does this shuffle have non-zero probability for all permutations?
<p>I was trying to do some code golf, when I created the following algorithm to shuffle a string:</p>&#xA;&#xA;<pre><code>for(;k--&gt;0;y=s,s="")for(var c:y.split(""))s=Math.random()&lt;.5?s+c:c+s;&#xA;</code></pre>&#xA;&#xA;<p>To explain better what it does, I've recreated it in Python:</p>&#xA;&#xA;<pre><code>import ...
algorithms strings probability theory randomized algorithms
1
Does this shuffle have non-zero probability for all permutations? -- (algorithms strings probability theory randomized algorithms) <p>I was trying to do some code golf, when I created the following algorithm to shuffle a string:</p>&#xA;&#xA;<pre><code>for(;k--&gt;0;y=s,s="")for(var c:y.split(""))s=Math.random()&lt;.5?...
habedi/stack-exchange-dataset
115,444
Modifying the genetic algorithm
<p>I have a multi-objective optimization problem (NP-complete). To solve it, I've decided to use the genetic algorithm.</p>&#xA;&#xA;<p>I have 3 "areas" of optimization, say parameters <code>a</code>, <code>b</code> and <code>c</code>, so cost function for my problem is <code>C(F) = a + b + c -&gt; min</code>.</p>&#xA;...
algorithms optimization genetic algorithms
1
Modifying the genetic algorithm -- (algorithms optimization genetic algorithms) <p>I have a multi-objective optimization problem (NP-complete). To solve it, I've decided to use the genetic algorithm.</p>&#xA;&#xA;<p>I have 3 "areas" of optimization, say parameters <code>a</code>, <code>b</code> and <code>c</code>, so c...
habedi/stack-exchange-dataset
115,461
Average codeword length in Huffman encoding at most log n
<p>I am interested in the following question:</p>&#xA;<blockquote>&#xA;<p>Prove that the average length of a codeword constructed by Huffman's algorithm has average length at most <span class="math-container">$\log n$</span>, where <span class="math-container">$n$</span> is the number of codewords.</p>&#xA;</blockquote...
algorithms proof techniques information theory huffman coding
1
Average codeword length in Huffman encoding at most log n -- (algorithms proof techniques information theory huffman coding) <p>I am interested in the following question:</p>&#xA;<blockquote>&#xA;<p>Prove that the average length of a codeword constructed by Huffman's algorithm has average length at most <span class="ma...
habedi/stack-exchange-dataset
115,462
Difference between Image Analysis and Computer Vision
<p>I have searched the web and I have only found the differences between Image Processing and Computer Vison (<a href="https://cs.stackexchange.com/questions/7050/what-are-the-differences-between-computer-vision-and-image-processing">also in this website too</a>). In addition, sometimes Image Analysis is confused with ...
computer vision
1
Difference between Image Analysis and Computer Vision -- (computer vision) <p>I have searched the web and I have only found the differences between Image Processing and Computer Vison (<a href="https://cs.stackexchange.com/questions/7050/what-are-the-differences-between-computer-vision-and-image-processing">also in thi...
habedi/stack-exchange-dataset
115,466
Showing the language of TMs that halt on a decidable set of words is not in RE
<p>I need to show that the following language, L = {<span class="math-container">$\langle M \rangle$</span> | The set of words which M halts on is decidable}, is not recursively enumerable. In the instructions they advise thinking of a reduction that is similar to the one used in the proof for Rice's Theorem in Sipser'...
complexity theory turing machines
1
Showing the language of TMs that halt on a decidable set of words is not in RE -- (complexity theory turing machines) <p>I need to show that the following language, L = {<span class="math-container">$\langle M \rangle$</span> | The set of words which M halts on is decidable}, is not recursively enumerable. In the instr...
habedi/stack-exchange-dataset
115,485
Why does going from 2's complement (in binary) to the positive value by completing to 1 then adding 1 work?
<p>I'm studying Computer science and this has confused me for a long time since our professor didn't give any proof.</p>&#xA;&#xA;<p>When changing from 2's complement to the positive value, we can go in reverse (by subtracting 1, then using 1's complement), and that's clear why it works.</p>&#xA;&#xA;<p>But our profess...
binary
1
Why does going from 2's complement (in binary) to the positive value by completing to 1 then adding 1 work? -- (binary) <p>I'm studying Computer science and this has confused me for a long time since our professor didn't give any proof.</p>&#xA;&#xA;<p>When changing from 2's complement to the positive value, we can go ...
habedi/stack-exchange-dataset
115,487
Height of epsilon-balanced binary search tree
<p>In <a href="https://stackoverflow.com/a/41942815/4614840">Balanced Binary Search Trees on the basis of size of left and right child subtrees</a>, Hannes says:</p>&#xA;&#xA;<blockquote>&#xA; <p>For example, one can say, a BST is balanced, if each subtree has at&#xA; most epsilon * n nodes, where epsilon &lt; 1 (for...
binary trees balanced search trees binary search trees
1
Height of epsilon-balanced binary search tree -- (binary trees balanced search trees binary search trees) <p>In <a href="https://stackoverflow.com/a/41942815/4614840">Balanced Binary Search Trees on the basis of size of left and right child subtrees</a>, Hannes says:</p>&#xA;&#xA;<blockquote>&#xA; <p>For example, one ...
habedi/stack-exchange-dataset
115,490
Could anyone prove why O(n^(log n)) < O((log n)^n)?
<p>Could someone provide a rigorous proof of why <span class="math-container">$O(n^{log n}) \leq O((\log n)^n)$</span> is true? I'm trying to do this by induction but it isn't working. Thanks.</p>&#xA;
algorithms
1
Could anyone prove why O(n^(log n)) < O((log n)^n)? -- (algorithms) <p>Could someone provide a rigorous proof of why <span class="math-container">$O(n^{log n}) \leq O((\log n)^n)$</span> is true? I'm trying to do this by induction but it isn't working. Thanks.</p>&#xA;
habedi/stack-exchange-dataset
115,495
Are you allowed to use index variables in grammars?
<p>If we say that the grammar for the language <span class="math-container">$L = \{ww \mid w \in \{a,b\}^*\}$</span>, is:</p>&#xA;&#xA;<p><span class="math-container">$\begin{align}&#xA;S &amp;\rightarrow A_1A_2S \mid B_1B_2S \mid Z_2\\&#xA;A_2A_1 &amp;\rightarrow A_1A_2\\&#xA;A_2B_1 &amp;\rightarrow B_1A_2\\&#xA;B_2A_...
formal languages formal grammars
1
Are you allowed to use index variables in grammars? -- (formal languages formal grammars) <p>If we say that the grammar for the language <span class="math-container">$L = \{ww \mid w \in \{a,b\}^*\}$</span>, is:</p>&#xA;&#xA;<p><span class="math-container">$\begin{align}&#xA;S &amp;\rightarrow A_1A_2S \mid B_1B_2S \mid...
habedi/stack-exchange-dataset
115,499
number of permutation with k inversions
<p>We are given two numbers N and K.</p>&#xA;&#xA;<p>N &lt;= 10^9.</p>&#xA;&#xA;<p>K&lt;=min{1000,(N*(N-1))/2}</p>&#xA;&#xA;<p>We need to find numbers of permutations of ( 1 to N ) such that inversions are exactly K. </p>&#xA;&#xA;<p>If N was &lt;= 10^3. It would be a simple Dynamic programming question.</p>&#xA;&#xA;<...
algorithms data structures dynamic programming permutations mergesort
1
number of permutation with k inversions -- (algorithms data structures dynamic programming permutations mergesort) <p>We are given two numbers N and K.</p>&#xA;&#xA;<p>N &lt;= 10^9.</p>&#xA;&#xA;<p>K&lt;=min{1000,(N*(N-1))/2}</p>&#xA;&#xA;<p>We need to find numbers of permutations of ( 1 to N ) such that inversions are...
habedi/stack-exchange-dataset