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
112,374
Struggling to understand the symbolism around the big oh formal definition
<p>I'm struggling to understand what exactly <code>T(n)</code>, and <code>f(n)</code> is in the above text:</p>&#xA;&#xA;<blockquote>&#xA; <p>When we compute the time complexity T(n) of an algorithm we rarely get&#xA; an exact result, just an estimate. That’s fine, in computer science we&#xA; are typically only inte...
asymptotics big o notation
1
Struggling to understand the symbolism around the big oh formal definition -- (asymptotics big o notation) <p>I'm struggling to understand what exactly <code>T(n)</code>, and <code>f(n)</code> is in the above text:</p>&#xA;&#xA;<blockquote>&#xA; <p>When we compute the time complexity T(n) of an algorithm we rarely get...
habedi/stack-exchange-dataset
112,381
Recursive Bubble Sort Complexity
<p>I have this code for a recursive bubble sort:</p>&#xA;&#xA;<pre><code>def bubble_sort_recursive(list_):&#xA; global counter&#xA; for i in range(len(list_)):&#xA; counter += 1&#xA; try:&#xA; if list_[i + 1] &lt; list_[i]:&#xA; list_[i], list_[i + 1] = list_[i + 1], list_[...
algorithms complexity theory sorting
1
Recursive Bubble Sort Complexity -- (algorithms complexity theory sorting) <p>I have this code for a recursive bubble sort:</p>&#xA;&#xA;<pre><code>def bubble_sort_recursive(list_):&#xA; global counter&#xA; for i in range(len(list_)):&#xA; counter += 1&#xA; try:&#xA; if list_[i + 1] &lt; ...
habedi/stack-exchange-dataset
112,396
State true or false --> x = Θ(n⁴), y = Θ(n²) therefore x/y = Θ(n²)
<p>State true or false&#xA;<span class="math-container">$x=\Theta(n^4)$</span>, <span class="math-container">$y=\Theta(n^2)$</span> therefore <span class="math-container">$x/y=\Theta(n^2)$</span></p>&#xA;&#xA;<p>I think the ans is true,but in the book it says false. What is the explanation?</p>&#xA;&#xA;<p>My reason fo...
algorithms time complexity
1
State true or false --> x = Θ(n⁴), y = Θ(n²) therefore x/y = Θ(n²) -- (algorithms time complexity) <p>State true or false&#xA;<span class="math-container">$x=\Theta(n^4)$</span>, <span class="math-container">$y=\Theta(n^2)$</span> therefore <span class="math-container">$x/y=\Theta(n^2)$</span></p>&#xA;&#xA;<p>I think t...
habedi/stack-exchange-dataset
112,405
Does the Hack computer from "The Elements of Computing Systems" use Von Neumann architecture?
<p>I'm reading "The Elements of Computing Systems" (subtitled "Building a Modern Computer from First Principles - Nand to Tetris Companion) by Noam Nisan and Shimon Schocken.</p>&#xA;&#xA;<p>Chapter 4 is about machine language, and more specifically the machine language used on their computer platform called Hack. Sect...
terminology computer architecture
1
Does the Hack computer from "The Elements of Computing Systems" use Von Neumann architecture? -- (terminology computer architecture) <p>I'm reading "The Elements of Computing Systems" (subtitled "Building a Modern Computer from First Principles - Nand to Tetris Companion) by Noam Nisan and Shimon Schocken.</p>&#xA;&#xA...
habedi/stack-exchange-dataset
112,407
Checking whether the win-loss standings of a league are possible
<p>You're hosting a 1 v 1 basketball league with a game schedule. At the end of the league you have each player report their supposed win-loss record (there are no ties), but you want to check whether the proposed standings were actually possible given the schedule.</p>&#xA;&#xA;<p>For example: you have four players (A...
algorithms time complexity
1
Checking whether the win-loss standings of a league are possible -- (algorithms time complexity) <p>You're hosting a 1 v 1 basketball league with a game schedule. At the end of the league you have each player report their supposed win-loss record (there are no ties), but you want to check whether the proposed standings...
habedi/stack-exchange-dataset
112,409
Variations of the halting problem
<p>Let <span class="math-container">$M$</span> be an arbitrary Turing machine and <span class="math-container">$w \in \{0, 1\}^{*}$</span> be a binary string.</p>&#xA;&#xA;<p>The language <span class="math-container">$\text{HALT} = \{\langle M, w \rangle : M ~\text{halts on input} ~w \}$</span> is undecidable by the fa...
halting problem
1
Variations of the halting problem -- (halting problem) <p>Let <span class="math-container">$M$</span> be an arbitrary Turing machine and <span class="math-container">$w \in \{0, 1\}^{*}$</span> be a binary string.</p>&#xA;&#xA;<p>The language <span class="math-container">$\text{HALT} = \{\langle M, w \rangle : M ~\text...
habedi/stack-exchange-dataset
112,418
Can an alphabet for a Turing machine contain subsets of other alphabets?
<p>For example;</p>&#xA;&#xA;<p>Is {0,1,{a,b,c},d,e} a valid alphabet to form a language over and is it usable in any context?</p>&#xA;
formal languages turing machines
1
Can an alphabet for a Turing machine contain subsets of other alphabets? -- (formal languages turing machines) <p>For example;</p>&#xA;&#xA;<p>Is {0,1,{a,b,c},d,e} a valid alphabet to form a language over and is it usable in any context?</p>&#xA;
habedi/stack-exchange-dataset
112,424
Determining equivalence classes of $\{w \in \{0,1\}^*\mid$ the $k$-bit of $w$ from the right is 1$\}$
<p>I want to formally write the equivalence classes of the following language:&#xA;<span class="math-container">$$L_k = \{w \in \{0,1\}^*\mid\text{ the } k\text{-th bit of }w\text{ from the right is } 1\}$$</span></p>&#xA;&#xA;<p>I understand the definition of equivalence classes, yet struggle to come up with a clear i...
formal languages automata regular languages context free
1
Determining equivalence classes of $\{w \in \{0,1\}^*\mid$ the $k$-bit of $w$ from the right is 1$\}$ -- (formal languages automata regular languages context free) <p>I want to formally write the equivalence classes of the following language:&#xA;<span class="math-container">$$L_k = \{w \in \{0,1\}^*\mid\text{ the } k\...
habedi/stack-exchange-dataset
112,439
How to cover given entries in a matrix with minimum number of rows and columns?
<p>We have a matrix of 0 and 1. We want to cover all the 1's. We can cover a raw or a column with a plate. We want to use the minimum number of plates.</p>&#xA;&#xA;<p>example </p>&#xA;&#xA;<p>0 0 1 0</p>&#xA;&#xA;<p>0 1 0 1</p>&#xA;&#xA;<p>0 0 1 0</p>&#xA;&#xA;<p>0 0 1 0</p>&#xA;&#xA;<p>cover 3rd column and 2nd raw. ...
algorithms data structures matrices assignment problem
1
How to cover given entries in a matrix with minimum number of rows and columns? -- (algorithms data structures matrices assignment problem) <p>We have a matrix of 0 and 1. We want to cover all the 1's. We can cover a raw or a column with a plate. We want to use the minimum number of plates.</p>&#xA;&#xA;<p>example </p...
habedi/stack-exchange-dataset
112,445
Representation of the concatenation at the type level
<p>I would like to learn more about concatenative programming through the creation of a small simple language, based on the stack and following the concatenative paradigm.</p>&#xA;&#xA;<p>Unfortunately, I haven't found many resources concerning concatenative languages and their implementation, so excuse me in advance f...
logic programming languages compilers type theory type checking
1
Representation of the concatenation at the type level -- (logic programming languages compilers type theory type checking) <p>I would like to learn more about concatenative programming through the creation of a small simple language, based on the stack and following the concatenative paradigm.</p>&#xA;&#xA;<p>Unfortuna...
habedi/stack-exchange-dataset
112,448
How can i prove that MAX-CUT is in NP?
<p>How can i show/explain/prove that Max-Cut is in NP?&#xA;"For a graph, a maximum cut is a cut whose size is at least the size of any other cut. The problem of finding a maximum cut in a graph is known as the Max-Cut Problem."</p>&#xA;&#xA;<p>Thanks!</p>&#xA;
np max cut
1
How can i prove that MAX-CUT is in NP? -- (np max cut) <p>How can i show/explain/prove that Max-Cut is in NP?&#xA;"For a graph, a maximum cut is a cut whose size is at least the size of any other cut. The problem of finding a maximum cut in a graph is known as the Max-Cut Problem."</p>&#xA;&#xA;<p>Thanks!</p>&#xA;
habedi/stack-exchange-dataset
112,451
How do I minimize the cost of some algorithm that performs some operation on a list?
<p>I stumbled upon this problem whilst studying the complexity of a simple algorithm. I used set-theoretic notation, but all the <span class="math-container">$S_i$</span>'s are lists (I couldn't think of a better way to write the problem precisely). The "hint" is more of a conjecture which I can't prove than a hint.</p...
algorithms algorithm analysis discrete mathematics greedy algorithms number theory
1
How do I minimize the cost of some algorithm that performs some operation on a list? -- (algorithms algorithm analysis discrete mathematics greedy algorithms number theory) <p>I stumbled upon this problem whilst studying the complexity of a simple algorithm. I used set-theoretic notation, but all the <span class="math-...
habedi/stack-exchange-dataset
112,453
Simulating multi-tape turing machines by single-tape TM
<p>In "Computational Complexity: A modern approach", Arora and Barak proof the following Claim: </p>&#xA;&#xA;<blockquote>&#xA; <p>Define a single-tape Turing machine to be a TM that has only one read-write tape, that is used a input, work, and output tape. For every <span class="math-container">$f: \{0,1\}^* \rightar...
turing machines
1
Simulating multi-tape turing machines by single-tape TM -- (turing machines) <p>In "Computational Complexity: A modern approach", Arora and Barak proof the following Claim: </p>&#xA;&#xA;<blockquote>&#xA; <p>Define a single-tape Turing machine to be a TM that has only one read-write tape, that is used a input, work, a...
habedi/stack-exchange-dataset
112,466
Complement of languages and coNP
<p>By definition, any language (decision problem) <span class="math-container">$L$</span> is defined as a subset of <span class="math-container">$\{0,1\}^*$</span>, where <span class="math-container">$\{0,1\}$</span> is the alphabet.</p>&#xA;&#xA;<p><span class="math-container">$L^c$</span> is said to be the complement...
complexity theory formal languages decision problem co np
1
Complement of languages and coNP -- (complexity theory formal languages decision problem co np) <p>By definition, any language (decision problem) <span class="math-container">$L$</span> is defined as a subset of <span class="math-container">$\{0,1\}^*$</span>, where <span class="math-container">$\{0,1\}$</span> is the ...
habedi/stack-exchange-dataset
112,472
Algorithm for producing array of objects according to the given distribution
<p>I have a set of objects, and each object has (let's say) a <code>color</code>. Given a distribution such as:</p>&#xA;&#xA;<pre><code>red : 50%&#xA;green : 30%&#xA;blue : 20%&#xA;</code></pre>&#xA;&#xA;<p>I need to produce an N-length array of objects with a color distribution as close to this as possible. It is poss...
algorithms terminology
1
Algorithm for producing array of objects according to the given distribution -- (algorithms terminology) <p>I have a set of objects, and each object has (let's say) a <code>color</code>. Given a distribution such as:</p>&#xA;&#xA;<pre><code>red : 50%&#xA;green : 30%&#xA;blue : 20%&#xA;</code></pre>&#xA;&#xA;<p>I need t...
habedi/stack-exchange-dataset
112,481
Context-free grammar of the concatenation of a string S and subsequence of reversed S
<p>I have to find a Context-Free grammar that generates the language:</p>&#xA;&#xA;<p><span class="math-container">$L_1 = \{x\#y\ |\ y$</span> is a subsequence of <span class="math-container">$x^R$</span>, and <span class="math-container">$x\in\{a,b\}^*\}$</span>, <span class="math-container">$\Sigma=\{a,b,\#\}$</span>...
context free formal grammars pushdown automata
1
Context-free grammar of the concatenation of a string S and subsequence of reversed S -- (context free formal grammars pushdown automata) <p>I have to find a Context-Free grammar that generates the language:</p>&#xA;&#xA;<p><span class="math-container">$L_1 = \{x\#y\ |\ y$</span> is a subsequence of <span class="math-c...
habedi/stack-exchange-dataset
112,491
Selection Sort vs Insertion Sort For Reversed Array
<p>I had a question in a test, which asked me the following question:</p>&#xA;&#xA;<blockquote>&#xA; <p>Selection sort runs faster than Insertion sort for an array in reverse order.</p>&#xA;</blockquote>&#xA;&#xA;<p>Now, according to my knowledge, both of them have a time complexity of <span class="math-container">$O(...
sorting
1
Selection Sort vs Insertion Sort For Reversed Array -- (sorting) <p>I had a question in a test, which asked me the following question:</p>&#xA;&#xA;<blockquote>&#xA; <p>Selection sort runs faster than Insertion sort for an array in reverse order.</p>&#xA;</blockquote>&#xA;&#xA;<p>Now, according to my knowledge, both o...
habedi/stack-exchange-dataset
112,499
Hamiltonian non intersecting path in plane
<p><span class="math-container">$N$</span> points are located in 2D plane. Some of the pair of the points are connected by line segments. What is the complexity of the problem of existence of Hamiltonian non intersecting path? What if we consider it in special cases of graphs. </p>&#xA;
algorithms complexity theory graphs hamiltonian path
1
Hamiltonian non intersecting path in plane -- (algorithms complexity theory graphs hamiltonian path) <p><span class="math-container">$N$</span> points are located in 2D plane. Some of the pair of the points are connected by line segments. What is the complexity of the problem of existence of Hamiltonian non intersectin...
habedi/stack-exchange-dataset
112,501
Definitional equality of two propositions about propositional equality
<p>Martin Hofmann states in <a href="http://www.lfcs.inf.ed.ac.uk/reports/95/ECS-LFCS-95-327/" rel="nofollow noreferrer">Extensional Concepts in Intensional Type Theory</a> (§1.1 p.3) that:</p>&#xA;&#xA;<blockquote>&#xA; <p>It is important that definition equality is pervasive so if M and N are definitionally equal th...
type theory dependent types equality
1
Definitional equality of two propositions about propositional equality -- (type theory dependent types equality) <p>Martin Hofmann states in <a href="http://www.lfcs.inf.ed.ac.uk/reports/95/ECS-LFCS-95-327/" rel="nofollow noreferrer">Extensional Concepts in Intensional Type Theory</a> (§1.1 p.3) that:</p>&#xA;&#xA;<blo...
habedi/stack-exchange-dataset
112,503
What is the difference between a collection of Turing Machines and a family of Circuits?
<p>Given a Collection of Turing Machines <span class="math-container">$T_1, T_2, T_3,...T_n$</span> where <span class="math-container">$T_1$</span> denotes that the Turing machine can only take in an input of size 1. Is there any difference in computational power to a family of Circuits <span class="math-container">$C_...
turing machines circuits
1
What is the difference between a collection of Turing Machines and a family of Circuits? -- (turing machines circuits) <p>Given a Collection of Turing Machines <span class="math-container">$T_1, T_2, T_3,...T_n$</span> where <span class="math-container">$T_1$</span> denotes that the Turing machine can only take in an i...
habedi/stack-exchange-dataset
112,506
What publication first introduced the concept of a non-deterministic Turing machine?
<p>What publication first introduced the concept of a non-deterministic Turing machine?</p>&#xA;&#xA;<p>Turing did not define the concept in his 1936 <a href="https://www.cs.virginia.edu/~robins/Turing_Paper_1936.pdf" rel="nofollow noreferrer">paper</a>.</p>&#xA;
turing machines reference request nondeterminism
1
What publication first introduced the concept of a non-deterministic Turing machine? -- (turing machines reference request nondeterminism) <p>What publication first introduced the concept of a non-deterministic Turing machine?</p>&#xA;&#xA;<p>Turing did not define the concept in his 1936 <a href="https://www.cs.virgini...
habedi/stack-exchange-dataset
112,508
How to remove objects from an array most efficiently?
<p>I am wondering if I can rearrange an array faster when I would like to delete more than one object.</p>&#xA;&#xA;<p>You are given a List:</p>&#xA;&#xA;<ul>&#xA;<li>1</li>&#xA;<li>2</li>&#xA;<li>2</li>&#xA;<li>3</li>&#xA;<li>4</li>&#xA;<li>5 </li>&#xA;<li>7</li>&#xA;</ul>&#xA;&#xA;<p>And now you want to delete every ...
algorithms arrays memory management
1
How to remove objects from an array most efficiently? -- (algorithms arrays memory management) <p>I am wondering if I can rearrange an array faster when I would like to delete more than one object.</p>&#xA;&#xA;<p>You are given a List:</p>&#xA;&#xA;<ul>&#xA;<li>1</li>&#xA;<li>2</li>&#xA;<li>2</li>&#xA;<li>3</li>&#xA;<l...
habedi/stack-exchange-dataset
112,517
Differences between ALLTM and INF
<p>The definitions of ALLTM and INF are as follows: </p>&#xA;&#xA;<p><span class="math-container">$$\mathrm{ALLTM} = \{ \langle M \rangle \mid \text{ TM $M$ such that $L(M) = \Sigma^*$} \}. $$</span></p>&#xA;&#xA;<p><span class="math-container">$$\mathrm{INF} = \{ \langle M \rangle \mid \text{TM $M$ such that $L(M)$...
complexity theory turing machines reductions undecidability
1
Differences between ALLTM and INF -- (complexity theory turing machines reductions undecidability) <p>The definitions of ALLTM and INF are as follows: </p>&#xA;&#xA;<p><span class="math-container">$$\mathrm{ALLTM} = \{ \langle M \rangle \mid \text{ TM $M$ such that $L(M) = \Sigma^*$} \}. $$</span></p>&#xA;&#xA;<p><s...
habedi/stack-exchange-dataset
112,533
What does $|V|=O(|E|)$ mean?
<p>I was reading about Dijkstra's algorithm from <a href="http://web.stanford.edu/class/archive/cs/cs106b/cs106b.1198/lectures/Lecture24/Lecture24.pdf#page=18" rel="nofollow noreferrer">this Stanford University lecture presentation</a>. On page 18 it says Dijkstra's algorithm is <span class="math-container">$O(|V|\log|...
graphs algorithm analysis time complexity asymptotics big o notation
1
What does $|V|=O(|E|)$ mean? -- (graphs algorithm analysis time complexity asymptotics big o notation) <p>I was reading about Dijkstra's algorithm from <a href="http://web.stanford.edu/class/archive/cs/cs106b/cs106b.1198/lectures/Lecture24/Lecture24.pdf#page=18" rel="nofollow noreferrer">this Stanford University lectur...
habedi/stack-exchange-dataset
112,540
How to detect infinite loop exist in linear bounded automata (LBA)?
<p>The following theorem from Michael Sipser's book "<a href="https://books.google.com/books?id=P3f6CAAAQBAJ&amp;lpg=PP1&amp;pg=PP1#v=onepage&amp;q&amp;f=false" rel="nofollow noreferrer">Introduction to the Theory of Computation</a>" states:</p>&#xA;&#xA;<blockquote>&#xA; <p><span class="math-container">$A_{\textrm{LB...
turing machines computability undecidability
1
How to detect infinite loop exist in linear bounded automata (LBA)? -- (turing machines computability undecidability) <p>The following theorem from Michael Sipser's book "<a href="https://books.google.com/books?id=P3f6CAAAQBAJ&amp;lpg=PP1&amp;pg=PP1#v=onepage&amp;q&amp;f=false" rel="nofollow noreferrer">Introduction to...
habedi/stack-exchange-dataset
112,548
I am looking for an algorithm that can find the best possible combination of inputs, in order to determine the optimum output
<p>So as the title poorly implies, I'm looking for an algorithm that can accomplish the following task (as an example):</p>&#xA;<p>Given the inputs A(1:100), B(1:100), C(1:100), that can take on any value between 1 to 100.</p>&#xA;<p>Given the outputs X, Y, Z, which are determined by a combination of the inputs eg:</p>...
algorithms search algorithms search problem python
1
I am looking for an algorithm that can find the best possible combination of inputs, in order to determine the optimum output -- (algorithms search algorithms search problem python) <p>So as the title poorly implies, I'm looking for an algorithm that can accomplish the following task (as an example):</p>&#xA;<p>Given t...
habedi/stack-exchange-dataset
112,555
Definition of extensional and propositional equality in Martin-Lof extensional type theory
<p>Martin Hofmann states in <a href="http://www.lfcs.inf.ed.ac.uk/reports/95/ECS-LFCS-95-327/" rel="nofollow noreferrer">Extensional Concepts in Intensional Type Theory</a> (§1.1 p.[4-5]) that:</p>&#xA;&#xA;<blockquote>&#xA; <p>A similar situation occurs in extensional Martin-Lof type theory where propositional and de...
type theory dependent types equality
1
Definition of extensional and propositional equality in Martin-Lof extensional type theory -- (type theory dependent types equality) <p>Martin Hofmann states in <a href="http://www.lfcs.inf.ed.ac.uk/reports/95/ECS-LFCS-95-327/" rel="nofollow noreferrer">Extensional Concepts in Intensional Type Theory</a> (§1.1 p.[4-5])...
habedi/stack-exchange-dataset
112,557
Comparison of constructive and local-search heuristics for TSP
<p>In my high school class, we are currently looking at evaluating heuristic methods for intractable problems - especially TSP.</p>&#xA;&#xA;<p>My question is what is the advantages or disadvantages of using a constructive heuristic (like Nearest-Neighbour) compared to local search (something like 2-opt from some resea...
algorithms heuristics traveling salesman
1
Comparison of constructive and local-search heuristics for TSP -- (algorithms heuristics traveling salesman) <p>In my high school class, we are currently looking at evaluating heuristic methods for intractable problems - especially TSP.</p>&#xA;&#xA;<p>My question is what is the advantages or disadvantages of using a c...
habedi/stack-exchange-dataset
112,564
Condition in Arden's rule
<p>According to <a href="https://en.wikipedia.org/wiki/Arden%27s_rule" rel="nofollow noreferrer">Arden's rule</a>, the language equation <span class="math-container">$X= AX\cup B$</span>, with unknown <span class="math-container">$X$</span>, has the solution <span class="math-container">$X=A^*B$</span>, provided <span ...
formal languages regular languages
1
Condition in Arden's rule -- (formal languages regular languages) <p>According to <a href="https://en.wikipedia.org/wiki/Arden%27s_rule" rel="nofollow noreferrer">Arden's rule</a>, the language equation <span class="math-container">$X= AX\cup B$</span>, with unknown <span class="math-container">$X$</span>, has the solu...
habedi/stack-exchange-dataset
112,569
How strong is an oracle that avoid don't-halt
<p>Consider such an oracle:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a turing machine[1], return the halting state it falls on, or arbitary result(but don't stuck in) if the TM doesn't halt.</p>&#xA;</blockquote>&#xA;&#xA;<ol>&#xA;<li>How strong is a TM with the oracle?</li>&#xA;<li>Can the oracle exist(or does the que...
turing machines computability oracle machines
1
How strong is an oracle that avoid don't-halt -- (turing machines computability oracle machines) <p>Consider such an oracle:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a turing machine[1], return the halting state it falls on, or arbitary result(but don't stuck in) if the TM doesn't halt.</p>&#xA;</blockquote>&#xA;&#xA;<...
habedi/stack-exchange-dataset
112,575
Does the Bellman-Ford algorithm find all the negative cycles?
<p>The <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="nofollow noreferrer">Bellman-Ford algorithm</a> "can detect and report the negative cycle", but does it guarantee to find them or it may find some?</p>&#xA;&#xA;<p>The algorithm really focuses on the shortest paths, so I'm unclear if it ...
algorithms graphs
1
Does the Bellman-Ford algorithm find all the negative cycles? -- (algorithms graphs) <p>The <a href="https://en.wikipedia.org/wiki/Bellman%E2%80%93Ford_algorithm" rel="nofollow noreferrer">Bellman-Ford algorithm</a> "can detect and report the negative cycle", but does it guarantee to find them or it may find some?</p>&...
habedi/stack-exchange-dataset
112,583
Proving whether an input sequence is in a given RE language
<p>I've learned this a few years ago that this is impossible unless one simply 'executes' (in a modern computing sense) the input with the language rules, but I have some problems in just using this statement.</p>&#xA;&#xA;<ul>&#xA;<li><p>The fundamental doubt is that the statement itself is well-stated. If I'm using t...
turing machines computability
1
Proving whether an input sequence is in a given RE language -- (turing machines computability) <p>I've learned this a few years ago that this is impossible unless one simply 'executes' (in a modern computing sense) the input with the language rules, but I have some problems in just using this statement.</p>&#xA;&#xA;<u...
habedi/stack-exchange-dataset
112,600
Min Fibonacci Heap - increase key
<p>I have been trying to implementing heap data structures for use in my research work. As part of that, I am trying to implement <code>increase-key</code> operations for min-heaps. I know that min-heaps generally support <code>decrease-key</code>. I was able to write the <code>increase-key</code> operation for a binar...
algorithms data structures trees heaps
1
Min Fibonacci Heap - increase key -- (algorithms data structures trees heaps) <p>I have been trying to implementing heap data structures for use in my research work. As part of that, I am trying to implement <code>increase-key</code> operations for min-heaps. I know that min-heaps generally support <code>decrease-key</...
habedi/stack-exchange-dataset
112,612
if $L \in NP$ then its mapping reducible to HALT?
<p>This is true because every language in <span class="math-container">$NP$</span> is decidable and therefore HALTS but how do I formally show this? </p>&#xA;
np
1
if $L \in NP$ then its mapping reducible to HALT? -- (np) <p>This is true because every language in <span class="math-container">$NP$</span> is decidable and therefore HALTS but how do I formally show this? </p>&#xA;
habedi/stack-exchange-dataset
112,613
What is an example of a Turing-recognizable infinite word, which is not Turing-decidable?
<p>I am confused about Turing Machines that are able to decide languages that contain infinite words.</p>&#xA;&#xA;<ol>&#xA;<li><p>Are languages with an infinite amount of only finite strings always decidable? </p></li>&#xA;<li><p>How can a Turing Machine halt on an infinite input string? </p></li>&#xA;<li><p>Can Turin...
formal languages turing machines
1
What is an example of a Turing-recognizable infinite word, which is not Turing-decidable? -- (formal languages turing machines) <p>I am confused about Turing Machines that are able to decide languages that contain infinite words.</p>&#xA;&#xA;<ol>&#xA;<li><p>Are languages with an infinite amount of only finite strings ...
habedi/stack-exchange-dataset
112,614
Undecidable languages
<p>I'm confused on the definition of undecidable languages. </p>&#xA;&#xA;<p>Definition: For an undecidable language, there is no Turing Machine which accepts the language and makes a decision for every input string w.</p>&#xA;&#xA;<p>Can you say a language that isn't recognizable as undecidable?</p>&#xA;&#xA;<p>If giv...
undecidability
1
Undecidable languages -- (undecidability) <p>I'm confused on the definition of undecidable languages. </p>&#xA;&#xA;<p>Definition: For an undecidable language, there is no Turing Machine which accepts the language and makes a decision for every input string w.</p>&#xA;&#xA;<p>Can you say a language that isn't recogniza...
habedi/stack-exchange-dataset
112,615
Why values can not be replaced with their extensionally equal values in an intensional system?
<p>Thomas Streicher states in <a href="https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdf" rel="nofollow noreferrer">Investigations into Intensional Type Theory</a>(§Introduction p.5) that:</p>&#xA;&#xA;<blockquote>&#xA; <p>Although in Intensional constructive set theory (Intensional Type Theory) on...
type theory dependent types equality
1
Why values can not be replaced with their extensionally equal values in an intensional system? -- (type theory dependent types equality) <p>Thomas Streicher states in <a href="https://www2.mathematik.tu-darmstadt.de/~streicher/HabilStreicher.pdf" rel="nofollow noreferrer">Investigations into Intensional Type Theory</a>...
habedi/stack-exchange-dataset
112,624
Lower bound for merging $m$ sorted arrays (decision tree leaves count - permutations)
<p>I need some help understanding how to calculate the lower bound on the time complexity of merging <span class="math-container">$m$</span> sorted arrays of length <span class="math-container">$n$</span>.</p>&#xA;&#xA;<p>The bound should be <span class="math-container">$nm \lg(m)$</span>. I need to prove this using a ...
sorting lower bounds decision tree
1
Lower bound for merging $m$ sorted arrays (decision tree leaves count - permutations) -- (sorting lower bounds decision tree) <p>I need some help understanding how to calculate the lower bound on the time complexity of merging <span class="math-container">$m$</span> sorted arrays of length <span class="math-container">...
habedi/stack-exchange-dataset
112,638
Minimize cost of recursive pairwise sums: how to prove the greedy solution works?
<p>The problem is in <a href="https://cs.stackexchange.com/questions/101031/minimizing-sum-of-recursive-pairwise-sums">this other question</a>.</p>&#xA;&#xA;<p>Why does this always work? It's not clear to me how one would use induction.</p>&#xA;&#xA;<p>For <span class="math-container">$n = 3$</span>, a quick calculatio...
algorithms correctness proof greedy algorithms
1
Minimize cost of recursive pairwise sums: how to prove the greedy solution works? -- (algorithms correctness proof greedy algorithms) <p>The problem is in <a href="https://cs.stackexchange.com/questions/101031/minimizing-sum-of-recursive-pairwise-sums">this other question</a>.</p>&#xA;&#xA;<p>Why does this always work?...
habedi/stack-exchange-dataset
112,648
How to use c-gap problems to prove inapproximability?
<p>Suppose there is a specific set function with some properties - <span class="math-container">$f=2^V\to \mathcal{R}$</span>. It is known that the following problem is NP-Hard: Find <span class="math-container">$S\subseteq V, |S|\leq k$</span> such that <span class="math-container">$f(S)$</span> is maximized. My goal...
np complete np hard approximation
1
How to use c-gap problems to prove inapproximability? -- (np complete np hard approximation) <p>Suppose there is a specific set function with some properties - <span class="math-container">$f=2^V\to \mathcal{R}$</span>. It is known that the following problem is NP-Hard: Find <span class="math-container">$S\subseteq V,...
habedi/stack-exchange-dataset
112,660
Connected but not adjacent vertex
<p>Are there specific terms or adjectives in graph theory to name these two situations?</p>&#xA;<ul>&#xA;<li>Two vertices are non-adjacent (disjoint? I have seen that the term &quot;disjoint&quot; is rather used for paths with non-common vertices or edges).</li>&#xA;<li>Two connected non-adjacent vertices (the shortest...
graphs
1
Connected but not adjacent vertex -- (graphs) <p>Are there specific terms or adjectives in graph theory to name these two situations?</p>&#xA;<ul>&#xA;<li>Two vertices are non-adjacent (disjoint? I have seen that the term &quot;disjoint&quot; is rather used for paths with non-common vertices or edges).</li>&#xA;<li>Two...
habedi/stack-exchange-dataset
112,677
Need help understanding regular expressions
<p>I was reading up about formal languages (see here: <a href="https://pdfs.semanticscholar.org/18b2/d685d5e244a6bfc5a31d312f1e8d322c16a9.pdf" rel="nofollow noreferrer">https://pdfs.semanticscholar.org/18b2/d685d5e244a6bfc5a31d312f1e8d322c16a9.pdf</a>) and got confused when I started reading about this expression: 0(0+...
formal languages regular expressions
1
Need help understanding regular expressions -- (formal languages regular expressions) <p>I was reading up about formal languages (see here: <a href="https://pdfs.semanticscholar.org/18b2/d685d5e244a6bfc5a31d312f1e8d322c16a9.pdf" rel="nofollow noreferrer">https://pdfs.semanticscholar.org/18b2/d685d5e244a6bfc5a31d312f1e8...
habedi/stack-exchange-dataset
112,684
Halting problem in EXP-complete
<p>I have some troubles understanding why the halting problem is in EXP.<br>&#xA;In <a href="https://en.wikipedia.org/wiki/EXPTIME" rel="nofollow noreferrer">Wikipedia</a> the following is written:</p>&#xA;&#xA;<blockquote>&#xA; <p>It is in EXPTIME because a trivial simulation requires O(k) time, and the input k is en...
complexity theory reductions
1
Halting problem in EXP-complete -- (complexity theory reductions) <p>I have some troubles understanding why the halting problem is in EXP.<br>&#xA;In <a href="https://en.wikipedia.org/wiki/EXPTIME" rel="nofollow noreferrer">Wikipedia</a> the following is written:</p>&#xA;&#xA;<blockquote>&#xA; <p>It is in EXPTIME beca...
habedi/stack-exchange-dataset
112,688
UNDIRECTED HAMCYCLE to HAMPATH reduction
<p>I'll define the problems</p>&#xA;&#xA;<blockquote>&#xA; <p>UHAMPATH</p>&#xA; &#xA; <p>Input: A undirected graph G and 2 nodes, s and t </p>&#xA; &#xA; <p>Question: Is there a hamiltonian path from s to t in G?</p>&#xA; &#xA; <p>UHAMCYCLE</p>&#xA; &#xA; <p>Input: A undirected graph G</p>&#xA; &#xA; <p>Ques...
np complete
1
UNDIRECTED HAMCYCLE to HAMPATH reduction -- (np complete) <p>I'll define the problems</p>&#xA;&#xA;<blockquote>&#xA; <p>UHAMPATH</p>&#xA; &#xA; <p>Input: A undirected graph G and 2 nodes, s and t </p>&#xA; &#xA; <p>Question: Is there a hamiltonian path from s to t in G?</p>&#xA; &#xA; <p>UHAMCYCLE</p>&#xA; &#xA...
habedi/stack-exchange-dataset
112,693
Can you determinize an NFA in PSPACE?
<p><strong>QUESTION</strong></p>&#xA;&#xA;<p>Given some NFA <span class="math-container">$A$</span>, can you simulate the determinization of it (using Subset-Construction for example) while remaining in <span class="math-container">$PSPACE$</span>?</p>&#xA;&#xA;<p><strong>MORE DETAILS</strong></p>&#xA;&#xA;<p>I'm askin...
complexity theory computability finite automata space complexity
1
Can you determinize an NFA in PSPACE? -- (complexity theory computability finite automata space complexity) <p><strong>QUESTION</strong></p>&#xA;&#xA;<p>Given some NFA <span class="math-container">$A$</span>, can you simulate the determinization of it (using Subset-Construction for example) while remaining in <span cla...
habedi/stack-exchange-dataset
112,701
Is the reduction for HAMPATH to HAMCYCLE and UHAMPATH to UHAMCYCLE the same?
<p>HAMPATH/UHAMPATH is A directed / undirected graph G and 2 nodes s and t and is there a hamilton path from s to t? </p>&#xA;&#xA;<p>Likewise with HAMCYCLE/UHAMCYCLE but has a hamilton cycle on <span class="math-container">$G'$</span> </p>&#xA;&#xA;<p>The reduction for directed is</p>&#xA;&#xA;<p><span class="math-con...
np complete
1
Is the reduction for HAMPATH to HAMCYCLE and UHAMPATH to UHAMCYCLE the same? -- (np complete) <p>HAMPATH/UHAMPATH is A directed / undirected graph G and 2 nodes s and t and is there a hamilton path from s to t? </p>&#xA;&#xA;<p>Likewise with HAMCYCLE/UHAMCYCLE but has a hamilton cycle on <span class="math-container">$G...
habedi/stack-exchange-dataset
112,702
how to prove that log(n!) >= c n log(n) for some c >0?
<p>as reading the <a href="https://docs.google.com/file/d/0B_iQberlDeu5aS1DM3NuRGx2MVU/view" rel="nofollow noreferrer">book</a> Algorithms by Dasgupta, C.H Papadimitriou. on Page 63.</p>&#xA;&#xA;<blockquote>&#xA; <p>And it is well known that <span class="math-container">$\log(n!)≥c\cdot n\cdot\log n$</span> for some...
algorithms check my answer
1
how to prove that log(n!) >= c n log(n) for some c >0? -- (algorithms check my answer) <p>as reading the <a href="https://docs.google.com/file/d/0B_iQberlDeu5aS1DM3NuRGx2MVU/view" rel="nofollow noreferrer">book</a> Algorithms by Dasgupta, C.H Papadimitriou. on Page 63.</p>&#xA;&#xA;<blockquote>&#xA; <p>And it is well...
habedi/stack-exchange-dataset
112,708
Can a CPU be replaced without interrupting the processes running on it?
<p>When I need to replace the CPU of my computer, I turn it off, replace the hardware, then reboot it. But what if you need to replace the CPU (in a single CPU machine) without stopping the processes running on it?</p>&#xA;&#xA;<p>Is that possible, and if so, how?</p>&#xA;&#xA;<p><em>This is a theoretical question. It ...
computer architecture
1
Can a CPU be replaced without interrupting the processes running on it? -- (computer architecture) <p>When I need to replace the CPU of my computer, I turn it off, replace the hardware, then reboot it. But what if you need to replace the CPU (in a single CPU machine) without stopping the processes running on it?</p>&#x...
habedi/stack-exchange-dataset
112,715
CLIQUE $\leq_p$ SAT
<p>i'm trying to reduce CLIQUE to SAT:</p>&#xA;&#xA;<ul>&#xA;<li>Given: Graph G=(Vertices V, Edges E) and <span class="math-container">$k \in \mathbb{N}$</span></li>&#xA;<li>Output: Formular F such that if G contains a complete subgraph of size k, the formular is satisfiable (and vice versa).</li>&#xA;</ul>&#xA;&#xA;<p...
satisfiability clique polynomial time reductions
1
CLIQUE $\leq_p$ SAT -- (satisfiability clique polynomial time reductions) <p>i'm trying to reduce CLIQUE to SAT:</p>&#xA;&#xA;<ul>&#xA;<li>Given: Graph G=(Vertices V, Edges E) and <span class="math-container">$k \in \mathbb{N}$</span></li>&#xA;<li>Output: Formular F such that if G contains a complete subgraph of size k...
habedi/stack-exchange-dataset
112,720
What is the time complexity of a binary multiplication using Karatsuba Algorithm?
<p>My apologies if the question sounds naive, but I'm trying wrap my head around the idea of time complexity.</p>&#xA;&#xA;<p>In general, the Karatsuba Multiplication is said to have a time complexity of <code>O(n^1.5...)</code>.&#xA;The algorithm assumes that the addition and subtraction take about <code>O(1)</code> e...
algorithms algorithm analysis time complexity arithmetic
1
What is the time complexity of a binary multiplication using Karatsuba Algorithm? -- (algorithms algorithm analysis time complexity arithmetic) <p>My apologies if the question sounds naive, but I'm trying wrap my head around the idea of time complexity.</p>&#xA;&#xA;<p>In general, the Karatsuba Multiplication is said t...
habedi/stack-exchange-dataset
112,725
Is the P vs NP problem, an NP or co-NP problem?
<p>A few years ago, a youtube channel named hackerdashery, made an extraordinary youtube video explaining <strong>P vs NP</strong>, in a semi-vulgarized way : &#xA;<a href="https://www.youtube.com/watch?v=YX40hbAHx3s" rel="nofollow noreferrer">https://www.youtube.com/watch?v=YX40hbAHx3s</a></p>&#xA;&#xA;<p>At 7 minute...
complexity theory p vs np
1
Is the P vs NP problem, an NP or co-NP problem? -- (complexity theory p vs np) <p>A few years ago, a youtube channel named hackerdashery, made an extraordinary youtube video explaining <strong>P vs NP</strong>, in a semi-vulgarized way : &#xA;<a href="https://www.youtube.com/watch?v=YX40hbAHx3s" rel="nofollow noreferr...
habedi/stack-exchange-dataset
112,728
Intersection of O(n) expanding circles with line from the origin
<p>I am interested resolving a programming challenge problem, but I'm struggling obtaining an efficient solution.</p>&#xA;&#xA;<blockquote>&#xA; <p>Consider yourself as a point located on the origin <span class="math-container">$(0,0)$</span> of an infinite&#xA; two-dimensional flat world. There are <span class="math...
algorithms computational geometry
1
Intersection of O(n) expanding circles with line from the origin -- (algorithms computational geometry) <p>I am interested resolving a programming challenge problem, but I'm struggling obtaining an efficient solution.</p>&#xA;&#xA;<blockquote>&#xA; <p>Consider yourself as a point located on the origin <span class="mat...
habedi/stack-exchange-dataset
112,742
Is there a way to modify Kadane's Algorithm such that we know the resulting subarray?
<p>Kadane's Algorithm is an algorithm that solves the maximum subarray problem by clever dynamic programming. Is there a way to further modify the algorithm so that we would get to know the resulting subarray that produces the corresponding maximum sum? </p>&#xA;&#xA;<p>PS: I don't know whether I should post this here,...
algorithms maximum subarray
1
Is there a way to modify Kadane's Algorithm such that we know the resulting subarray? -- (algorithms maximum subarray) <p>Kadane's Algorithm is an algorithm that solves the maximum subarray problem by clever dynamic programming. Is there a way to further modify the algorithm so that we would get to know the resulting s...
habedi/stack-exchange-dataset
112,758
How do i tell if a grammar is regular or not?
<p>I know that a regular grammar has a definition </p>&#xA;&#xA;<p><span class="math-container">$$\begin{align}S &amp;\to aS\\&#xA;S &amp;\to \lambda&#xA;\end{align}$$</span></p>&#xA;&#xA;<p>But I dont really know how to apply this information to check whether or not a grammar is regular...</p>&#xA;&#xA;<p>So for examp...
regular languages formal grammars regular expressions
1
How do i tell if a grammar is regular or not? -- (regular languages formal grammars regular expressions) <p>I know that a regular grammar has a definition </p>&#xA;&#xA;<p><span class="math-container">$$\begin{align}S &amp;\to aS\\&#xA;S &amp;\to \lambda&#xA;\end{align}$$</span></p>&#xA;&#xA;<p>But I dont really know h...
habedi/stack-exchange-dataset
112,779
How to prove an implication about an upper bound mentioned in the proof of master theorem?
<p><a href="https://i.stack.imgur.com/8unXR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8unXR.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>How can we prove rigorously the proposition "Suppose the if in case 1 is true, the equation 4.23 is true"? &#xA;For given constant b and j, th...
algorithms
1
How to prove an implication about an upper bound mentioned in the proof of master theorem? -- (algorithms) <p><a href="https://i.stack.imgur.com/8unXR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8unXR.png" alt="enter image description here"></a></p>&#xA;&#xA;<p>How can we prove rigorously the pro...
habedi/stack-exchange-dataset
112,782
What is the meaning of uniform distribution of elements in an array?
<p>I was going through the concept of Interpolation search and it stated that when the elements are "uniformly distributed", it takes O(loglogn) to search an element using interpolation search. Can someone please explain me this?</p>&#xA;
algorithms data structures search algorithms arrays
1
What is the meaning of uniform distribution of elements in an array? -- (algorithms data structures search algorithms arrays) <p>I was going through the concept of Interpolation search and it stated that when the elements are "uniformly distributed", it takes O(loglogn) to search an element using interpolation search. ...
habedi/stack-exchange-dataset
112,791
TSP Variant --- Colored Path
<p>Recently I came up with a traveling-salesman-esque problem. As usual, we have <span class="math-container">$n$</span> vertices, and a weighted edge between any two vertices. However, each vertex is associated with a color, which may be repeated. Then, you are given a sequence of colors, and you want to find the shor...
np complete traveling salesman
1
TSP Variant --- Colored Path -- (np complete traveling salesman) <p>Recently I came up with a traveling-salesman-esque problem. As usual, we have <span class="math-container">$n$</span> vertices, and a weighted edge between any two vertices. However, each vertex is associated with a color, which may be repeated. Then, ...
habedi/stack-exchange-dataset
112,795
RSA cryptosystem: Encrypting a signed message
<p>I've started to read the section about the RSA cryptosystem in CLRS (page 958) and I don't understand the way it describes how to encrypt a signed message.</p>&#xA;&#xA;<p>If Bob wants to send a message <span class="math-container">$M$</span> to Alice:</p>&#xA;&#xA;<ol>&#xA;<li>Bob takes <span class="math-container"...
cryptography encryption
1
RSA cryptosystem: Encrypting a signed message -- (cryptography encryption) <p>I've started to read the section about the RSA cryptosystem in CLRS (page 958) and I don't understand the way it describes how to encrypt a signed message.</p>&#xA;&#xA;<p>If Bob wants to send a message <span class="math-container">$M$</span>...
habedi/stack-exchange-dataset
112,796
Conditions for string substitution commutativity
<p>Let's say I have two substitutions given [a:=b] and [c:=d]. What are some conditions that hold for a,b,c,d ∈Σ* iff forall s∈Σ* s[a:=b][c:=d]=s[c:=d][a:=b]</p>&#xA;&#xA;<p>Also you can assume that a,c≠ but you cannot assume so for b and d.</p>&#xA;
formal languages substrings string matching
1
Conditions for string substitution commutativity -- (formal languages substrings string matching) <p>Let's say I have two substitutions given [a:=b] and [c:=d]. What are some conditions that hold for a,b,c,d ∈Σ* iff forall s∈Σ* s[a:=b][c:=d]=s[c:=d][a:=b]</p>&#xA;&#xA;<p>Also you can assume that a,c≠ but you cannot ass...
habedi/stack-exchange-dataset
112,799
"Greater than AND smaller than" condition in integer linear program with a binary variable
<p><a href="https://cs.stackexchange.com/q/69531">I found this related question, but that's not quite it</a></p>&#xA;&#xA;<p>Is it possible to model this with integer programming:</p>&#xA;&#xA;<p><span class="math-container">$$A = \begin{cases} 1 &amp; \text{if } B \geq C \geq D \\ 0 &amp; \text{otherwise}\end{cases}$$...
linear programming integer programming constraint satisfaction
1
"Greater than AND smaller than" condition in integer linear program with a binary variable -- (linear programming integer programming constraint satisfaction) <p><a href="https://cs.stackexchange.com/q/69531">I found this related question, but that's not quite it</a></p>&#xA;&#xA;<p>Is it possible to model this with in...
habedi/stack-exchange-dataset
112,806
What is a 'dynamic entity' in computer science?
<p>I am doing some reading into computer science and how the computing system works in order to be ready for my 1st year at university doing a Computer Science degree. I came across a term within the definition for a computer system that I tried looking up for on the internet called 'dynamic entity'. The problem is, I ...
operating systems
1
What is a 'dynamic entity' in computer science? -- (operating systems) <p>I am doing some reading into computer science and how the computing system works in order to be ready for my 1st year at university doing a Computer Science degree. I came across a term within the definition for a computer system that I tried loo...
habedi/stack-exchange-dataset
112,824
Pushdown Automaton to accept all strings such that no prefix has more 1’s than 0’s
<blockquote>&#xA; <p>Design a Pushdown Automata, accepting either by final state or by&#xA; empty stack to accept the set of all strings of 0’s and 1’s such that&#xA; no prefix has more 1’s than 0’s</p>&#xA;</blockquote>&#xA;&#xA;<p>This is a homework question, but not graded.</p>&#xA;&#xA;<p>I'm not looking for the...
formal languages pushdown automata
1
Pushdown Automaton to accept all strings such that no prefix has more 1’s than 0’s -- (formal languages pushdown automata) <blockquote>&#xA; <p>Design a Pushdown Automata, accepting either by final state or by&#xA; empty stack to accept the set of all strings of 0’s and 1’s such that&#xA; no prefix has more 1’s than...
habedi/stack-exchange-dataset
112,830
Are chatbots a good example of overfitting?
<p>In my highschool class we are learning about Artificial Intelligence, and especially the problems that come with machine learning. I was wondering if chatbots like cleverbot were good examples of overfitting. Obviously, when you get a reply that doesn't make sense, is that a result of the bot modeling a training dat...
machine learning artificial intelligence
1
Are chatbots a good example of overfitting? -- (machine learning artificial intelligence) <p>In my highschool class we are learning about Artificial Intelligence, and especially the problems that come with machine learning. I was wondering if chatbots like cleverbot were good examples of overfitting. Obviously, when yo...
habedi/stack-exchange-dataset
112,854
Perfect Probabilistic Encryption still requires key length about as long as message
<p>Let <span class="math-container">$(E,D)$</span> be a probabilistic encryption scheme with <span class="math-container">$n$</span>-length keys (given a key <span class="math-container">$k$</span>, we denote the corresponding encryption function by <span class="math-container">$E_k$</span>) and <span class="math-conta...
cryptography encryption
1
Perfect Probabilistic Encryption still requires key length about as long as message -- (cryptography encryption) <p>Let <span class="math-container">$(E,D)$</span> be a probabilistic encryption scheme with <span class="math-container">$n$</span>-length keys (given a key <span class="math-container">$k$</span>, we denot...
habedi/stack-exchange-dataset
112,858
Are every problems in EXP karp reducible to any EXP-Complete?
<p>According to <a href="https://en.wikipedia.org/wiki/EXPTIME" rel="nofollow noreferrer">wikipedia</a> and other references there exists complete language <span class="math-container">$L \in EXP$</span> such that for every languages <span class="math-container">$L'$</span> in <span class="math-container">$EXP$</span> ...
algorithms polynomial time reductions
1
Are every problems in EXP karp reducible to any EXP-Complete? -- (algorithms polynomial time reductions) <p>According to <a href="https://en.wikipedia.org/wiki/EXPTIME" rel="nofollow noreferrer">wikipedia</a> and other references there exists complete language <span class="math-container">$L \in EXP$</span> such that f...
habedi/stack-exchange-dataset
112,892
What is the worst case time-complexity of removing the root of a Binary Search Tree?
<p>My answer is constant time O(1) since an implementation would naturally have the pointer to the root. However, the solution guide I am looking at argues it is O(logN).</p>&#xA;
time complexity
1
What is the worst case time-complexity of removing the root of a Binary Search Tree? -- (time complexity) <p>My answer is constant time O(1) since an implementation would naturally have the pointer to the root. However, the solution guide I am looking at argues it is O(logN).</p>&#xA;
habedi/stack-exchange-dataset
112,893
What does canonicity property mean in Type Theory?
<p>The "Computational Component" section of the <a href="https://en.wikipedia.org/wiki/Type_theory" rel="noreferrer">Type Theory - Wikipedia</a> (as well as a few papers about cubical type theory and 2d type theory) talk about <em>canonicity</em> property. <p></p>&#xA;&#xA;<ul>&#xA;<li>Would you please explain exactly ...
type theory dependent types homotopy type theory cubical type theory
1
What does canonicity property mean in Type Theory? -- (type theory dependent types homotopy type theory cubical type theory) <p>The "Computational Component" section of the <a href="https://en.wikipedia.org/wiki/Type_theory" rel="noreferrer">Type Theory - Wikipedia</a> (as well as a few papers about cubical type theory...
habedi/stack-exchange-dataset
112,902
AVL tree balance property states for the two subtrees of a node, their height can differ at most one. Why can't it be zero?
<p>I was thinking that if they were equal, say they are required to be zero this would be enforce the balance property more effectively. Can anyone explain why 1 is a satisfactory rather than just them being 0?</p>&#xA;
balanced search trees binary search trees avl trees
1
AVL tree balance property states for the two subtrees of a node, their height can differ at most one. Why can't it be zero? -- (balanced search trees binary search trees avl trees) <p>I was thinking that if they were equal, say they are required to be zero this would be enforce the balance property more effectively. Ca...
habedi/stack-exchange-dataset
112,905
HamiltonianCycles in Random Graphs
<p>Lets say we consider the Erdős-Renyi undirected random graph <span class="math-container">$G(n,p)$</span> with <span class="math-container">$V(G) = \{1,2,\cdots,n\}$</span> and <span class="math-container">$\displaystyle{P((u,v)\in E(G)) = p} \quad \forall u,v \in V $</span>.</p>&#xA;&#xA;<p>Is there anything we can...
graphs hamiltonian circuit
1
HamiltonianCycles in Random Graphs -- (graphs hamiltonian circuit) <p>Lets say we consider the Erdős-Renyi undirected random graph <span class="math-container">$G(n,p)$</span> with <span class="math-container">$V(G) = \{1,2,\cdots,n\}$</span> and <span class="math-container">$\displaystyle{P((u,v)\in E(G)) = p} \quad \...
habedi/stack-exchange-dataset
112,906
What is a batch based interface?
<p>I came across this description of Batch Interface:&#xA;"commands and directives are used to manage those commands that are entered into files and those files get executed. "</p>&#xA;&#xA;<p>I would really appreciate if someone explains in detail what Batch Interface is and how it's different from Command Line Interf...
operating systems
1
What is a batch based interface? -- (operating systems) <p>I came across this description of Batch Interface:&#xA;"commands and directives are used to manage those commands that are entered into files and those files get executed. "</p>&#xA;&#xA;<p>I would really appreciate if someone explains in detail what Batch Inte...
habedi/stack-exchange-dataset
112,907
Weird implementation of quicksort
<p>I met a wired question from the algorithm test of my school. For the first time I thought it is a normal quick-sort problem and feel confident to solve it but as I read the algorithm carefully, it is a little different from the quick sort algorithm... </p>&#xA;&#xA;<p>The original algorithm and question are:</p>&#xA...
algorithms algorithm analysis sorting
1
Weird implementation of quicksort -- (algorithms algorithm analysis sorting) <p>I met a wired question from the algorithm test of my school. For the first time I thought it is a normal quick-sort problem and feel confident to solve it but as I read the algorithm carefully, it is a little different from the quick sort a...
habedi/stack-exchange-dataset
112,917
A number of points on a line, with initial positions and speeds - find a minimum time that any two points meet
<p>How can I compute the minimum time for two points to meet in <span class="math-container">$O(N)$</span> time?</p>&#xA;&#xA;<p>All I can think is to compute the time for all the point pairs and get the minimum.</p>&#xA;&#xA;<p>Can anyone give me some hints?</p>&#xA;
algorithms
1
A number of points on a line, with initial positions and speeds - find a minimum time that any two points meet -- (algorithms) <p>How can I compute the minimum time for two points to meet in <span class="math-container">$O(N)$</span> time?</p>&#xA;&#xA;<p>All I can think is to compute the time for all the point pairs a...
habedi/stack-exchange-dataset
112,926
Injectivity verification in o(n) space and O(n) time
<p>The problem I want to solve is this: Given a list <span class="math-container">$A$</span> of <span class="math-container">$n$</span> elements, I want to verify that they are all distinct. If I were to do this "myself", I would need <span class="math-container">$O(n)$</span> space and <span class="math-container">$O(...
complexity theory computation models space complexity oracle machines
1
Injectivity verification in o(n) space and O(n) time -- (complexity theory computation models space complexity oracle machines) <p>The problem I want to solve is this: Given a list <span class="math-container">$A$</span> of <span class="math-container">$n$</span> elements, I want to verify that they are all distinct. I...
habedi/stack-exchange-dataset
112,930
Why is it that Btrees most of the times have a degree that is odd? What happens if they are even?
<p>I was watching a lecture video and the Professor states that it would be very rare to see the order of a Btree to be even. I was hoping for an explanation but he cut it off there and moved on with the lecture.</p>&#xA;
b tree
1
Why is it that Btrees most of the times have a degree that is odd? What happens if they are even? -- (b tree) <p>I was watching a lecture video and the Professor states that it would be very rare to see the order of a Btree to be even. I was hoping for an explanation but he cut it off there and moved on with the lectur...
habedi/stack-exchange-dataset
112,936
What can't guarded fragment of FO express?
<p>I have some basic confusions about the definition of the guarded fragment of first-order logic. Hopefully someone can tell me where I'm wrong.</p>&#xA;&#xA;<p>GF in FO is defined by:</p>&#xA;&#xA;<ol>&#xA;<li>Atomic formulas, <span class="math-container">$x=y$</span> and <span class="math-container">$R(x_1,...,x_n)$...
logic first order logic
1
What can't guarded fragment of FO express? -- (logic first order logic) <p>I have some basic confusions about the definition of the guarded fragment of first-order logic. Hopefully someone can tell me where I'm wrong.</p>&#xA;&#xA;<p>GF in FO is defined by:</p>&#xA;&#xA;<ol>&#xA;<li>Atomic formulas, <span class="math-c...
habedi/stack-exchange-dataset
112,940
What is known about the sets enumerated by primitive recursive functions?
<p>Let's say that a set of natural numbers <span class="math-container">$S \subseteq \mathbb{N}$</span> is <em>primitive recursively enumerable</em> if there exists some primitive recursive function <span class="math-container">$f$</span> such that <span class="math-container">$S$</span> is the range of <span class="ma...
computability reference request primitive recursion chomsky hierarchy
1
What is known about the sets enumerated by primitive recursive functions? -- (computability reference request primitive recursion chomsky hierarchy) <p>Let's say that a set of natural numbers <span class="math-container">$S \subseteq \mathbb{N}$</span> is <em>primitive recursively enumerable</em> if there exists some p...
habedi/stack-exchange-dataset
112,952
Loop invariant initialisation confusion
<p>Consider the algorithm LastMatch below, which returns the offset (shift) of the last&#xA;occurrence of the pattern P in text T, or -1 if P does not occur in T:</p>&#xA;&#xA;<pre><code>LastMatch(T,P)&#xA; for(s = T.length - P.length downto 0)&#xA; j = 1&#xA; while(j =&lt; P.length and P[j] == T[s + j])&#xA; j...
correctness proof loop invariants
1
Loop invariant initialisation confusion -- (correctness proof loop invariants) <p>Consider the algorithm LastMatch below, which returns the offset (shift) of the last&#xA;occurrence of the pattern P in text T, or -1 if P does not occur in T:</p>&#xA;&#xA;<pre><code>LastMatch(T,P)&#xA; for(s = T.length - P.length downto...
habedi/stack-exchange-dataset
112,957
Is this set computable?
<p>Let be <span class="math-container">$B$</span> a Busy Beaver function and set <span class="math-container">$W=\{\langle M \rangle :\text{$M$ stops in less than $B(10^{1000})$ steps on an empty tape}\}$</span>. Is this set computable?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I'm not sure how to approach this question. I suspect...
computability
1
Is this set computable? -- (computability) <p>Let be <span class="math-container">$B$</span> a Busy Beaver function and set <span class="math-container">$W=\{\langle M \rangle :\text{$M$ stops in less than $B(10^{1000})$ steps on an empty tape}\}$</span>. Is this set computable?</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I'm not su...
habedi/stack-exchange-dataset
112,961
An example of a computable problem that is not in P
<p>I am trying to find a simple example of a problem that is computable but not in P, I know very well that it would be enough to get one in NEXTIME-complete however the problems that I find in this set are very artificial</p>&#xA;
complexity theory computability np
1
An example of a computable problem that is not in P -- (complexity theory computability np) <p>I am trying to find a simple example of a problem that is computable but not in P, I know very well that it would be enough to get one in NEXTIME-complete however the problems that I find in this set are very artificial</p>&#...
habedi/stack-exchange-dataset
112,969
Could following be a counter example to Church-Rosser (Confluence) theorem?
<p>According to the "Type Theory and Formal Proof" book, Church-Rosser theorem (confluence) is as follow:</p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose that for a given term <span class="math-container">$M$</span>, we have <span class="math-container">$M \twoheadrightarrow_\beta N_1$</span> and <span class="math-container...
lambda calculus type theory
1
Could following be a counter example to Church-Rosser (Confluence) theorem? -- (lambda calculus type theory) <p>According to the "Type Theory and Formal Proof" book, Church-Rosser theorem (confluence) is as follow:</p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose that for a given term <span class="math-container">$M$</span>,...
habedi/stack-exchange-dataset
112,973
Network density vs connectivity
<p>I was reading <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3101653/" rel="nofollow noreferrer">this paper</a> where they mention about undirected networks:</p>&#xA;&#xA;<blockquote>&#xA; <p>"The total connectivity of a network is defined as&#xA; <span class="math-container">$C=\frac{E}{N(N-1)}$</span> whe...
graphs
1
Network density vs connectivity -- (graphs) <p>I was reading <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC3101653/" rel="nofollow noreferrer">this paper</a> where they mention about undirected networks:</p>&#xA;&#xA;<blockquote>&#xA; <p>"The total connectivity of a network is defined as&#xA; <span class="mat...
habedi/stack-exchange-dataset
112,981
Showing that $BPP \subseteq EXP$?
<p>I am trying to understand why <span class="math-container">$BPP \subseteq EXP$</span>. <a href="https://cs.stackexchange.com/questions/80106/equivalence-of-machine-m-in-bpp-and-exp">This question</a> almost gives the answer (simulate <span class="math-container">$BPP$</span> machine on all possible toin cosses and t...
complexity theory
1
Showing that $BPP \subseteq EXP$? -- (complexity theory) <p>I am trying to understand why <span class="math-container">$BPP \subseteq EXP$</span>. <a href="https://cs.stackexchange.com/questions/80106/equivalence-of-machine-m-in-bpp-and-exp">This question</a> almost gives the answer (simulate <span class="math-containe...
habedi/stack-exchange-dataset
112,984
Why does arithmetic left shift of negative number leads to positive number?
<p>According to <a href="https://en.wikipedia.org/wiki/Arithmetic_shift#Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication" rel="nofollow noreferrer">this</a> Wikipedia article, when arithmetic left shift operation is applied to a signed number, the number is multiplied by 2. But there are certain sit...
computer architecture arithmetic
1
Why does arithmetic left shift of negative number leads to positive number? -- (computer architecture arithmetic) <p>According to <a href="https://en.wikipedia.org/wiki/Arithmetic_shift#Equivalence_of_arithmetic_and_logical_left_shifts_and_multiplication" rel="nofollow noreferrer">this</a> Wikipedia article, when arith...
habedi/stack-exchange-dataset
112,989
Sliding Window Dictionary String Matching
<p>Consider the following problem. We are given a set of patterns (strings) <span class="math-container">$\Pi = \{\pi_i\}$</span>, a text <span class="math-container">$s$</span>, and a window length <span class="math-container">$k$</span>. We want a list of all shifts <span class="math-container">$0 \le i \le |s|-k$</s...
strings substrings string matching exact string matching
1
Sliding Window Dictionary String Matching -- (strings substrings string matching exact string matching) <p>Consider the following problem. We are given a set of patterns (strings) <span class="math-container">$\Pi = \{\pi_i\}$</span>, a text <span class="math-container">$s$</span>, and a window length <span class="math...
habedi/stack-exchange-dataset
112,991
How can the initial "booting" state of a computer be different at different time points?
<p>In my experience, sometimes a computer boots normally, and in a time span of days, the computer won't boot, then again, it will boot normally again. I am not a computer science expert so I assume that if a computer boots normally one time and then it doesn't, <strong>it must be</strong> due to any changes made into ...
os kernel
1
How can the initial "booting" state of a computer be different at different time points? -- (os kernel) <p>In my experience, sometimes a computer boots normally, and in a time span of days, the computer won't boot, then again, it will boot normally again. I am not a computer science expert so I assume that if a compute...
habedi/stack-exchange-dataset
112,996
Basic Theta-notation question
<p>Let <span class="math-container">$T$</span> be a function.</p>&#xA;&#xA;<p>Is it true that if <span class="math-container">$\exists f\forall n,m&gt; 0.\\ \frac m {f(n)} \leq T(n,m)\leq m$</span></p>&#xA;&#xA;<p>Then <span class="math-container">$\exists g.T(n,m)=\Theta(m\cdot g(n))$</span>?</p>&#xA;&#xA;<p>In words:...
asymptotics
1
Basic Theta-notation question -- (asymptotics) <p>Let <span class="math-container">$T$</span> be a function.</p>&#xA;&#xA;<p>Is it true that if <span class="math-container">$\exists f\forall n,m&gt; 0.\\ \frac m {f(n)} \leq T(n,m)\leq m$</span></p>&#xA;&#xA;<p>Then <span class="math-container">$\exists g.T(n,m)=\Theta(...
habedi/stack-exchange-dataset
112,998
Weighted graph clustering with maximum size constraint
<p>I'm currently trying to solve a clustering problem. I need to cluster/partition an undirected weighted graph into groups that are restricted to size <code>n</code>.&#xA;I have <code>~80000</code> nodes and <code>~260000</code> edges. Each node owns a weight <code>w</code>. The sum of all node weights in one cluster ...
graphs weighted graphs partitions clustering
1
Weighted graph clustering with maximum size constraint -- (graphs weighted graphs partitions clustering) <p>I'm currently trying to solve a clustering problem. I need to cluster/partition an undirected weighted graph into groups that are restricted to size <code>n</code>.&#xA;I have <code>~80000</code> nodes and <code>...
habedi/stack-exchange-dataset
112,999
Linear programs with strict inequalities and supremum objectives
<p>Linear programming can solve only problems with weak inequalities, such as "maximize <span class="math-container">$c x$</span> such that <span class="math-container">$A x \leq b$</span>". This makes sense, since problems with strict inequality often do not have a solution. For example "maximize <span class="math-con...
linear programming
1
Linear programs with strict inequalities and supremum objectives -- (linear programming) <p>Linear programming can solve only problems with weak inequalities, such as "maximize <span class="math-container">$c x$</span> such that <span class="math-container">$A x \leq b$</span>". This makes sense, since problems with st...
habedi/stack-exchange-dataset
113,006
Create automata from non regular grammar
<p>I have two grammars: </p>&#xA;&#xA;<pre><code> L → ε | aLcLc&#xA; L → ε | aLcLc | LL &#xA;</code></pre>&#xA;&#xA;<p>This two grammars are equals but the first one is regular, so it produces a regular language and a Finite State Automata. Instead, the second one is non regular but it might produces a regular language...
automata regular languages finite automata formal grammars regular expressions
1
Create automata from non regular grammar -- (automata regular languages finite automata formal grammars regular expressions) <p>I have two grammars: </p>&#xA;&#xA;<pre><code> L → ε | aLcLc&#xA; L → ε | aLcLc | LL &#xA;</code></pre>&#xA;&#xA;<p>This two grammars are equals but the first one is regular, so it produces a ...
habedi/stack-exchange-dataset
113,009
Could I apply the master theorem if my $N/b$ is $\varphi(N)$?
<p>Let </p>&#xA;&#xA;<p><span class="math-container">$$T(N) = \begin{cases}1 &amp; \text{if } N = 1\\&#xA;T(\varphi(N)) + \lg(\varphi(N))^3 &amp; \text{otherwise}&#xA;\end{cases}$$</span></p>&#xA;&#xA;<p>where <span class="math-container">$\varphi(N)$</span> is Euler's totient function.</p>&#xA;&#xA;<p>Can I somehow ex...
master theorem
1
Could I apply the master theorem if my $N/b$ is $\varphi(N)$? -- (master theorem) <p>Let </p>&#xA;&#xA;<p><span class="math-container">$$T(N) = \begin{cases}1 &amp; \text{if } N = 1\\&#xA;T(\varphi(N)) + \lg(\varphi(N))^3 &amp; \text{otherwise}&#xA;\end{cases}$$</span></p>&#xA;&#xA;<p>where <span class="math-container"...
habedi/stack-exchange-dataset
113,015
Computing epsilon-closure. What does $E(n) \leftarrow \{n\};$ and $E(p)$ mean?
<p>I'm currently reading "Engineering a Compiler" book. In the chapter that explanes computing epsilon-closure there is listed the following algorithm:<a href="https://i.stack.imgur.com/R2ufM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R2ufM.png" alt="enter image description here"></a></p>&#xA;&#...
finite automata compilers
1
Computing epsilon-closure. What does $E(n) \leftarrow \{n\};$ and $E(p)$ mean? -- (finite automata compilers) <p>I'm currently reading "Engineering a Compiler" book. In the chapter that explanes computing epsilon-closure there is listed the following algorithm:<a href="https://i.stack.imgur.com/R2ufM.png" rel="nofollow...
habedi/stack-exchange-dataset
113,025
Is there an algorithm to share parts of strings?
<p>Let's say that we have the strings <code>Hello, World</code>, <code>Hello</code> and <code>World</code>. The algorithm I am thinking of would create an immutable buffer that contains <code>Hello, World</code> and the previous three would then become references or slices of that one like <code>buf[0,11], buf[0,4], bu...
strings substrings string matching
1
Is there an algorithm to share parts of strings? -- (strings substrings string matching) <p>Let's say that we have the strings <code>Hello, World</code>, <code>Hello</code> and <code>World</code>. The algorithm I am thinking of would create an immutable buffer that contains <code>Hello, World</code> and the previous th...
habedi/stack-exchange-dataset
113,027
Is finding a minimal set of seed variables for a complete deduction of a system of equations NP-complete?
<p>Suppose we have a set of variables <span class="math-container">$V$</span>. We also have a set of equations <span class="math-container">$E$</span>, which are sets of at least two variables. We don't know anything about these equations, except if we know all but one of the variables in an equation, we can deduce the...
graphs np complete reductions
1
Is finding a minimal set of seed variables for a complete deduction of a system of equations NP-complete? -- (graphs np complete reductions) <p>Suppose we have a set of variables <span class="math-container">$V$</span>. We also have a set of equations <span class="math-container">$E$</span>, which are sets of at least ...
habedi/stack-exchange-dataset
113,037
Proof of sparsification lemma: What exactly does the $\pi$ operator do?
<p>In their <a href="https://www.sciencedirect.com/science/article/pii/S002200000191774X?via%3Dihub" rel="nofollow noreferrer">proof of the sparsification lemma</a>, Impagliazzo et. al describe the following operator <span class="math-container">$\pi$</span>:</p>&#xA;&#xA;<p>For a familiy of sets <span class="math-cont...
complexity theory sets
1
Proof of sparsification lemma: What exactly does the $\pi$ operator do? -- (complexity theory sets) <p>In their <a href="https://www.sciencedirect.com/science/article/pii/S002200000191774X?via%3Dihub" rel="nofollow noreferrer">proof of the sparsification lemma</a>, Impagliazzo et. al describe the following operator <sp...
habedi/stack-exchange-dataset
113,038
confusion with worst case for direct addressing
<p>In <a href="https://en.wikipedia.org/wiki/Introduction_to_Algorithms" rel="nofollow noreferrer">CLRS</a> there is an exercise for <a href="https://web.stanford.edu/class/archive/cs/cs161/cs161.1168/lecture9.pdf" rel="nofollow noreferrer">direct address table</a></p>&#xA;&#xA;<blockquote>&#xA; <p>Suppose that a dyna...
algorithms
1
confusion with worst case for direct addressing -- (algorithms) <p>In <a href="https://en.wikipedia.org/wiki/Introduction_to_Algorithms" rel="nofollow noreferrer">CLRS</a> there is an exercise for <a href="https://web.stanford.edu/class/archive/cs/cs161/cs161.1168/lecture9.pdf" rel="nofollow noreferrer">direct address ...
habedi/stack-exchange-dataset
113,054
Number of Configurations of LBA(Linear Bounded Automaton)
<p>The lemma is:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let <span class="math-container">$M$</span> be an LBA with <span class="math-container">$q$</span> states and <span class="math-container">$g$</span> symbols in the tape alphabet.&#xA; There are exactly <span class="math-container">$qng^n$</span> distinct configurati...
turing machines automata linear bounded automata
1
Number of Configurations of LBA(Linear Bounded Automaton) -- (turing machines automata linear bounded automata) <p>The lemma is:</p>&#xA;&#xA;<blockquote>&#xA; <p>Let <span class="math-container">$M$</span> be an LBA with <span class="math-container">$q$</span> states and <span class="math-container">$g$</span> symbol...
habedi/stack-exchange-dataset
113,060
O(1) distinct elements in an array implies?
<p>Could someone explain the following question - </p>&#xA;&#xA;<p>Given the following statement viz. Consider an input array a[1..n] of arbitrary numbers. It is given that&#xA;the array has only O(1) distinct elements. What does the statement imply ?</p>&#xA;&#xA;<p>Thanks.</p>&#xA;
algorithms asymptotics
1
O(1) distinct elements in an array implies? -- (algorithms asymptotics) <p>Could someone explain the following question - </p>&#xA;&#xA;<p>Given the following statement viz. Consider an input array a[1..n] of arbitrary numbers. It is given that&#xA;the array has only O(1) distinct elements. What does the statement impl...
habedi/stack-exchange-dataset
113,062
Ford Fulkerson maximum flow for all vertices
<p>Suppose we have a graph <span class="math-container">$G(E,V)$</span> with a source node <span class="math-container">$s$</span>. Now for any <span class="math-container">$t\in V \setminus s$</span> I can find the maximum flow from <span class="math-container">$s$</span> to all possible <span class="math-container">$...
graphs dynamic programming
1
Ford Fulkerson maximum flow for all vertices -- (graphs dynamic programming) <p>Suppose we have a graph <span class="math-container">$G(E,V)$</span> with a source node <span class="math-container">$s$</span>. Now for any <span class="math-container">$t\in V \setminus s$</span> I can find the maximum flow from <span cla...
habedi/stack-exchange-dataset
113,066
Counting common values in two arrays
<blockquote>&#xA; <p>given two arrays of integers A and B of size m, with values in the&#xA; range [-n,n]. I want an algorithm to count how many common values are&#xA; in A and B , if a value is repeated we only count it once , for&#xA; example : <span class="math-container">$A=\{2,2,14,3\}$</span> and <span class...
time complexity arrays
1
Counting common values in two arrays -- (time complexity arrays) <blockquote>&#xA; <p>given two arrays of integers A and B of size m, with values in the&#xA; range [-n,n]. I want an algorithm to count how many common values are&#xA; in A and B , if a value is repeated we only count it once , for&#xA; example : <sp...
habedi/stack-exchange-dataset
113,075
Doubt in definition of closure under concatenation operation in Recursive Enumerative languages
<p>I recently started studying theory of computation. </p>&#xA;&#xA;<p>Recusive enumerable language – closed under concatenation. Sir, I have a doubt regarding understanding of this. </p>&#xA;&#xA;<p>Please Note - RE shortform i am taking for Recusively enumerative language</p>&#xA;&#xA;<p>One way --> If L1, and L2 are...
turing machines computability
1
Doubt in definition of closure under concatenation operation in Recursive Enumerative languages -- (turing machines computability) <p>I recently started studying theory of computation. </p>&#xA;&#xA;<p>Recusive enumerable language – closed under concatenation. Sir, I have a doubt regarding understanding of this. </p>&#...
habedi/stack-exchange-dataset