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 |
|---|---|---|---|---|---|---|
89,842 | Average Case Analysis for finding max and min value on an array | <p>Given the following algorithm, to find the maximum and minimum values of an array - don't mind the language:</p>

<pre><code>MaxMin(A[1..n])
 max = A[1];
 min = A[1];
 for (i = 2; i<=n; i++)
 if (A[i] > max)
 max = A[i];
 else if (A[i] < min)... | complexity theory algorithm analysis probabilistic algorithms | 1 | Average Case Analysis for finding max and min value on an array -- (complexity theory algorithm analysis probabilistic algorithms)
<p>Given the following algorithm, to find the maximum and minimum values of an array - don't mind the language:</p>

<pre><code>MaxMin(A[1..n])
 max = A[1];
 min = A[1... | habedi/stack-exchange-dataset |
89,845 | How can I determine the input size of an algorithm? | <p>Could you explain to me the input size of the algorithm with these cases? I can't understand the cases with multiple input parameters. Thanks.</p>

<pre><code>algorithm_1( a[1,...,n], b[1,...,n] )
 for i ← 1 to legth[a] step 1 do
 for j ← 1 to legth[b] step 1 do
 x++
 ... | algorithms complexity theory algorithm analysis | 1 | How can I determine the input size of an algorithm? -- (algorithms complexity theory algorithm analysis)
<p>Could you explain to me the input size of the algorithm with these cases? I can't understand the cases with multiple input parameters. Thanks.</p>

<pre><code>algorithm_1( a[1,...,n], b[1,...,n] )
 ... | habedi/stack-exchange-dataset |
89,851 | Regularity condition in the master Theorem in the presence of Landau notation for f | <p>There already are many questions and answers about the importance of the regularity condition in case 3 of the Master Theorem. My question is about when can we safely assume the regularity condition is satisfied when f is only provided as a $\Theta(g(n))$, which is actually what happens most of the time when we don'... | algorithms master theorem | 1 | Regularity condition in the master Theorem in the presence of Landau notation for f -- (algorithms master theorem)
<p>There already are many questions and answers about the importance of the regularity condition in case 3 of the Master Theorem. My question is about when can we safely assume the regularity condition is ... | habedi/stack-exchange-dataset |
89,853 | Armstrong's axioms more precisely 'inference rules': what's the distinction? | <p>"more precisely 'inference rules'" is what <a href="https://en.m.wikipedia.org/wiki/Armstrong%27s_axioms" rel="nofollow noreferrer">wikipedia</a> says <a href="https://en.m.wikipedia.org/wiki/Functional_dependency#Properties_and_axiomatization_of_functional_dependencies" rel="nofollow noreferrer">twice</a>.</p>
... | database theory | 1 | Armstrong's axioms more precisely 'inference rules': what's the distinction? -- (database theory)
<p>"more precisely 'inference rules'" is what <a href="https://en.m.wikipedia.org/wiki/Armstrong%27s_axioms" rel="nofollow noreferrer">wikipedia</a> says <a href="https://en.m.wikipedia.org/wiki/Functional_dependency#Prope... | habedi/stack-exchange-dataset |
89,856 | Why doesn't the C/C++ compilers create different tokens for different types of numbers? | <p>Based on <a href="https://www.geeksforgeeks.org/cc-tokens/" rel="nofollow noreferrer">GeeksforGeeks</a> and many other sites, the C/C++ compilers will create the same token for <code>float</code>/<code>int</code> etc.</p>

<p>However if we have something like this:</p>

<pre><code>int A[10.5];
</... | compilers parsers | 1 | Why doesn't the C/C++ compilers create different tokens for different types of numbers? -- (compilers parsers)
<p>Based on <a href="https://www.geeksforgeeks.org/cc-tokens/" rel="nofollow noreferrer">GeeksforGeeks</a> and many other sites, the C/C++ compilers will create the same token for <code>float</code>/<code>int<... | habedi/stack-exchange-dataset |
89,859 | What is a graceful algorithm to generate this number sequence | <pre><code>0 0
1 1
1 0 2
1 0 0 4 
1 0 1 5 
1 0 0 0 8
1 0 0 1 9
1 0 1 1 11
1 0 0 0 0 16
1 0 0 0 1 17
1 0 0 1 1 19
1 0 1 0 ... | algorithms binary | 1 | What is a graceful algorithm to generate this number sequence -- (algorithms binary)
<pre><code>0 0
1 1
1 0 2
1 0 0 4 
1 0 1 5 
1 0 0 0 8
1 0 0 1 9
1 0 1 1 11
1 0 ... | habedi/stack-exchange-dataset |
89,861 | Number of elements with lower index equal to some element, for all items on an array | <blockquote>
 <p>Let $A$ be an array of size $n$, and $f(i, r, a_r)$ be the number of indices $k$ such that $a_k$ = $a_r$ and $i \le k \le r$. </p>
</blockquote>

<p><em>Example to clarify:</em></p>

<p>Imagine the array: $[1, 2, 3, 2, 2, 3, 4, 5]$. $f(0, 3, a_3)$, for example, would be equal t... | algorithms binary trees arrays searching | 1 | Number of elements with lower index equal to some element, for all items on an array -- (algorithms binary trees arrays searching)
<blockquote>
 <p>Let $A$ be an array of size $n$, and $f(i, r, a_r)$ be the number of indices $k$ such that $a_k$ = $a_r$ and $i \le k \le r$. </p>
</blockquote>

<p><em>Ex... | habedi/stack-exchange-dataset |
89,865 | Is von Neumann's randomness in sin quote no longer applicable? | <p>Some chap said the following:</p>

<blockquote>
 <p>Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin.</p>
</blockquote>

<p>That's always taken to mean that you can't generate true random numbers with just a computer. And he said ... | randomness data compression entropy random number generator | 1 | Is von Neumann's randomness in sin quote no longer applicable? -- (randomness data compression entropy random number generator)
<p>Some chap said the following:</p>

<blockquote>
 <p>Anyone who attempts to generate random numbers by deterministic means is, of course, living in a state of sin.</p>
</blo... | habedi/stack-exchange-dataset |
89,875 | 3-Col using each colour exactly $|V|/3$ times | <p>Is the following problem in P?</p>

<p>Does a graph $G$ have $3$-colouring, where each colour is used exactly $|V|/3$ times?</p>

<p>I believe it is as we are trying to sample three sets (one for each colour) of vertices without replacement, giving a running time of $O(|V|^5)$. The first set is for t... | complexity theory computability np complete np decision problem | 1 | 3-Col using each colour exactly $|V|/3$ times -- (complexity theory computability np complete np decision problem)
<p>Is the following problem in P?</p>

<p>Does a graph $G$ have $3$-colouring, where each colour is used exactly $|V|/3$ times?</p>

<p>I believe it is as we are trying to sample three sets... | habedi/stack-exchange-dataset |
89,878 | How to solve a recurrence relation with a sum? | <p>How do I solve the following recurrence relation?</p>

<blockquote>
 <p>$$
T(n) = 1 + \sum_{j=0}^{n-1} T(j).
$$</p>
</blockquote>

<p>I thought of solving it by generating its recursion tree. I found that the height of the tree would be equal to $n$ but wasn't able to find the cost o... | recurrence relation discrete mathematics | 1 | How to solve a recurrence relation with a sum? -- (recurrence relation discrete mathematics)
<p>How do I solve the following recurrence relation?</p>

<blockquote>
 <p>$$
T(n) = 1 + \sum_{j=0}^{n-1} T(j).
$$</p>
</blockquote>

<p>I thought of solving it by generating its recursion tree.... | habedi/stack-exchange-dataset |
89,886 | How is Rank Selection better than Random selection and RWS? | <p>I'm having a rough time understanding the Rank Selection method for Genetic Algorithms. Here is what I think it does:</p>

<ul>
<li>Tour1's Fitness: 0.87 </li>
<li>Tour2's Fitness: 1.22 </li>
<li>Tour3's Fitness: 1.03</li>
<li>Tour4's Fitness: 0.58</li>
</ul>

<p>We rank them usin... | genetic algorithms selection problem | 1 | How is Rank Selection better than Random selection and RWS? -- (genetic algorithms selection problem)
<p>I'm having a rough time understanding the Rank Selection method for Genetic Algorithms. Here is what I think it does:</p>

<ul>
<li>Tour1's Fitness: 0.87 </li>
<li>Tour2's Fitness: 1.22 </li>
<li... | habedi/stack-exchange-dataset |
89,888 | Generating uniformly random bits from a stream of arbitrarily biased bits | <p>Say we have a function called GenBiasedBit. This function returns 1 with probability p (where p is an unknown real number between 0 and 1 exclusive) and returns 0 with probability 1 − p. How could I write a Las Vegas algorithm (called GenUnbiasedBit) that returns 1 or 0 with equal (nonzero) probability, using calls ... | randomized algorithms randomness | 1 | Generating uniformly random bits from a stream of arbitrarily biased bits -- (randomized algorithms randomness)
<p>Say we have a function called GenBiasedBit. This function returns 1 with probability p (where p is an unknown real number between 0 and 1 exclusive) and returns 0 with probability 1 − p. How could I write ... | habedi/stack-exchange-dataset |
89,902 | Calculating Frequency of Terms with Zipf's Law | <p>I'm studying for an exam and came across this question. I feel like it's much simpler than I am making it out to be, but I'm not sure.</p>

<p>Suppose we have a corpus in which Zipf’s Law holds. If the most frequent term occurs one million times, and the next most frequent term occurs 250,000 times, how ofte... | information theory information retrieval | 1 | Calculating Frequency of Terms with Zipf's Law -- (information theory information retrieval)
<p>I'm studying for an exam and came across this question. I feel like it's much simpler than I am making it out to be, but I'm not sure.</p>

<p>Suppose we have a corpus in which Zipf’s Law holds. If the most frequent ... | habedi/stack-exchange-dataset |
89,915 | number of queries to recover the permutation | <p>Imagine this game. I pick a permutation $p$ of $1..n$ and give you an oracle. When the oracle is queried with any sequence of $n$ numbers $\in 1..n$, it masks each number by applying some unknown bijection $f$ and then permutes the masked values using $p$. Your goal is to repeatedly query the oracle to recover $p$ w... | complexity theory permutations | 1 | number of queries to recover the permutation -- (complexity theory permutations)
<p>Imagine this game. I pick a permutation $p$ of $1..n$ and give you an oracle. When the oracle is queried with any sequence of $n$ numbers $\in 1..n$, it masks each number by applying some unknown bijection $f$ and then permutes the mask... | habedi/stack-exchange-dataset |
89,918 | Decision Tree Learning Deviation - Russell and Norvig | <p>I am working through the Russell and Norvig AI book and came across the following on the top of page 706.</p>

<p>The section concerns Decision Tree pruning and testing a given attribute against the null hypothesis. The example at hand deals with a binary decision tree and $p_k$ denotes the number of positiv... | machine learning artificial intelligence decision tree | 1 | Decision Tree Learning Deviation - Russell and Norvig -- (machine learning artificial intelligence decision tree)
<p>I am working through the Russell and Norvig AI book and came across the following on the top of page 706.</p>

<p>The section concerns Decision Tree pruning and testing a given attribute against ... | habedi/stack-exchange-dataset |
89,928 | Relation between size of hashtable and number of values to keep expected number of collisions below/equal to 1 | <p>This is an exam question from my algorithms and data structures course.</p>

<p>You imagine an hash function with h: U->{0,..m} (this is from the original question, but i think m-1 would be correct) and n values to hash.
You want to keep the expected number of collisions below or equal to 1.
How do y... | data structures probability theory hashing | 1 | Relation between size of hashtable and number of values to keep expected number of collisions below/equal to 1 -- (data structures probability theory hashing)
<p>This is an exam question from my algorithms and data structures course.</p>

<p>You imagine an hash function with h: U->{0,..m} (this is from the orig... | habedi/stack-exchange-dataset |
89,929 | $T(n) = 2T(n-1)$ Recurrences | <p>What would be the complexity of the following recurrence? </p>

<p>$$T(n) = 2T(n-1)$$</p>
 | algorithms time complexity recurrence relation | 1 | $T(n) = 2T(n-1)$ Recurrences -- (algorithms time complexity recurrence relation)
<p>What would be the complexity of the following recurrence? </p>

<p>$$T(n) = 2T(n-1)$$</p>
 | habedi/stack-exchange-dataset |
89,934 | Can an operating system without api still work? | <p>In theory operating system is a special program run by itself without help so that also mean normal program can still run by itself mean that the need for api is not must have so finally can we have an os without api ?</p>
 | operating systems api design | 1 | Can an operating system without api still work? -- (operating systems api design)
<p>In theory operating system is a special program run by itself without help so that also mean normal program can still run by itself mean that the need for api is not must have so finally can we have an os without api ?</p>
 | habedi/stack-exchange-dataset |
89,936 | Finding the Entropy of a random experiment with probability of $\frac{1}{3}$ | <p>Entropy is the randomness collected by an operating system or application for use in Cryptography or other uses that require random data. The formula for Entropy is $$H(p_1, ..., p_k)=-\sum_{i=1}^{k} p_i\log_2(p_i)[bit]$$</p>

<p>So if I were to calculate the Entropy of a coin toss. it would be 
$$H(\fra... | randomness information theory cryptography entropy | 1 | Finding the Entropy of a random experiment with probability of $\frac{1}{3}$ -- (randomness information theory cryptography entropy)
<p>Entropy is the randomness collected by an operating system or application for use in Cryptography or other uses that require random data. The formula for Entropy is $$H(p_1, ..., p_k)=... | habedi/stack-exchange-dataset |
89,952 | Problem with forming a context-free grammar describing a language | <p>I've been trying for hours to figure out, how to form a CFG describing this language $L$: 
$$L=\{ w\in\{a,b\}^* \mid w\text{ is of the form }a^nxb^{n+2}\text{, where }x\text{ is a string of length }3\text{ in }\{a,b\}^* \}.$$</p>

<p>The problem I'm having is related to the first $n$ of $a$'s. I can't wr... | formal languages context free formal grammars | 1 | Problem with forming a context-free grammar describing a language -- (formal languages context free formal grammars)
<p>I've been trying for hours to figure out, how to form a CFG describing this language $L$: 
$$L=\{ w\in\{a,b\}^* \mid w\text{ is of the form }a^nxb^{n+2}\text{, where }x\text{ is a string of length... | habedi/stack-exchange-dataset |
89,962 | Leftist Tree initialization in O(n) time | <p>In the book <em>Handbook of Data Structures and Applications</em>, section 5.2.5, (copy of the relevant section <a href="http://web.onda.com.br/abveiga/capitulo5-ingles.pdf" rel="nofollow noreferrer">available here</a>) about leftist queues, the author(s) state the following:</p>

<blockquote>
 <p>For t... | data structures time complexity priority queues | 1 | Leftist Tree initialization in O(n) time -- (data structures time complexity priority queues)
<p>In the book <em>Handbook of Data Structures and Applications</em>, section 5.2.5, (copy of the relevant section <a href="http://web.onda.com.br/abveiga/capitulo5-ingles.pdf" rel="nofollow noreferrer">available here</a>) abo... | habedi/stack-exchange-dataset |
89,968 | Is this lower bound proof for the comparison-based sorting problem correct? | <p>Here is a lower bound proof for the comparison-based sorting problem:</p>

<ul>
<li>Any comparison-based sorting algorithm can be considered to work by putting elements into their final positions one by one (Take the last time one element is put into its final position.).</li>
<li>To put the element ... | algorithms sorting lower bounds | 1 | Is this lower bound proof for the comparison-based sorting problem correct? -- (algorithms sorting lower bounds)
<p>Here is a lower bound proof for the comparison-based sorting problem:</p>

<ul>
<li>Any comparison-based sorting algorithm can be considered to work by putting elements into their final positi... | habedi/stack-exchange-dataset |
89,981 | Find smallest enclosing circle | <p>On a 2d plane, there is a large circle centered at $(0, 0)$ with a radius of $R_{{o}}$. It encloses $\sim 100$ or so smaller circles distributed randomly across the parent circle otherwise with known radii and positions with respect to the origin. (It is possible that some smaller sub-circles are partially or entire... | algorithms computational geometry counting square grid | 1 | Find smallest enclosing circle -- (algorithms computational geometry counting square grid)
<p>On a 2d plane, there is a large circle centered at $(0, 0)$ with a radius of $R_{{o}}$. It encloses $\sim 100$ or so smaller circles distributed randomly across the parent circle otherwise with known radii and positions with r... | habedi/stack-exchange-dataset |
89,982 | Intuitive way to understand "Run-Length Encoding" | <p>Run-Length Encoding is the simple form of lossless data compression in which compression in which <em>runs</em> (execution) of data are stored as a single data value and count rather than as the original <em>run</em> (execution). </p>

<p>Now the definition is there but what's an intuitive way of thinking ab... | complexity theory optimization runtime analysis data compression signal processing | 1 | Intuitive way to understand "Run-Length Encoding" -- (complexity theory optimization runtime analysis data compression signal processing)
<p>Run-Length Encoding is the simple form of lossless data compression in which compression in which <em>runs</em> (execution) of data are stored as a single data value and count rat... | habedi/stack-exchange-dataset |
89,986 | What is the name for a function's "return arity"? | <p>The <em>number of parameters a function has</em> (and thus the number of arguments it can take) is known as <em>arity</em>. What is the name for <em>the number of values a function returns</em>? I'm not asking for the "size" of a function's return values. A function returning a tuple returns a single, composite, val... | terminology | 1 | What is the name for a function's "return arity"? -- (terminology)
<p>The <em>number of parameters a function has</em> (and thus the number of arguments it can take) is known as <em>arity</em>. What is the name for <em>the number of values a function returns</em>? I'm not asking for the "size" of a function's return va... | habedi/stack-exchange-dataset |
89,989 | Is this passage from the textbook Artificial Intelligence: A Modern Approach incorrect? | <p>On page 383, section 10.2. of the <em>Algorithms for Planning as State Space Search</em> chapter of the textbook <em>Artificial Intelligence: A Modern Approach</em>, the following passage appears:</p>

<p><a href="https://i.stack.imgur.com/1w1bA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.... | artificial intelligence planning | 1 | Is this passage from the textbook Artificial Intelligence: A Modern Approach incorrect? -- (artificial intelligence planning)
<p>On page 383, section 10.2. of the <em>Algorithms for Planning as State Space Search</em> chapter of the textbook <em>Artificial Intelligence: A Modern Approach</em>, the following passage app... | habedi/stack-exchange-dataset |
89,997 | Difficulty in updating the balance factor of nodes in AVL tree | <p><a href="https://i.stack.imgur.com/fJBrf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fJBrf.jpg" alt="enter image description here"></a></p>

<p>In this figure x,y,z are the nodes on which rotation is performed and T1, T2, T3, T4 are the subtrees.
I have understood how the rotation ... | algorithms data structures binary trees balanced search trees | 1 | Difficulty in updating the balance factor of nodes in AVL tree -- (algorithms data structures binary trees balanced search trees)
<p><a href="https://i.stack.imgur.com/fJBrf.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fJBrf.jpg" alt="enter image description here"></a></p>

<p>In this figu... | habedi/stack-exchange-dataset |
90,013 | Minimum capacity cut reduction from digraph with two edge weight sets | <p>Given a digraph $G$ and $f, g : E(G) \mapsto \mathbb{R}$, how would you find a cut $(X,\bar{X})$ with $s \in X$ and $t \in \bar{X}$ such that $\sum_{e \in \delta^+(X)}{f(e)} - \sum_{e \in \delta^-(X)}{g(e)}$ is minimized?</p>

<p>$\delta^+(X)$ is the set of edges going out of $X$ and $\delta^-(X)$ is the set... | graphs optimization combinatorics network flow | 1 | Minimum capacity cut reduction from digraph with two edge weight sets -- (graphs optimization combinatorics network flow)
<p>Given a digraph $G$ and $f, g : E(G) \mapsto \mathbb{R}$, how would you find a cut $(X,\bar{X})$ with $s \in X$ and $t \in \bar{X}$ such that $\sum_{e \in \delta^+(X)}{f(e)} - \sum_{e \in \delta^... | habedi/stack-exchange-dataset |
90,016 | Proof that AND-OR graph decision problem is NP-hard | <p>Given an directed acyclic AND-OR graph, where each non-terminal nodes are labelled as either AND or OR. The terminal nodes are the nodes which have no outgoing edges. Children of a node are the vertices all the outgoing edges of the node points to.</p>

<p>A solution graph for a node $S$ on an AND-OR graph $... | np complete np hard np decision problem | 1 | Proof that AND-OR graph decision problem is NP-hard -- (np complete np hard np decision problem)
<p>Given an directed acyclic AND-OR graph, where each non-terminal nodes are labelled as either AND or OR. The terminal nodes are the nodes which have no outgoing edges. Children of a node are the vertices all the outgoing ... | habedi/stack-exchange-dataset |
90,022 | Proving that no finite automaton can recognize a Dyck language | <p>I was reading up on finite automata and I came across an interesting fact near the end of the <a href="https://en.wikipedia.org/wiki/Deterministic_finite_automaton" rel="nofollow noreferrer">Wikipedia page</a>.</p>

<blockquote>
 <p>The classic example of a simply described language that no DFA can
... | formal languages finite automata | 1 | Proving that no finite automaton can recognize a Dyck language -- (formal languages finite automata)
<p>I was reading up on finite automata and I came across an interesting fact near the end of the <a href="https://en.wikipedia.org/wiki/Deterministic_finite_automaton" rel="nofollow noreferrer">Wikipedia page</a>.</p>&#... | habedi/stack-exchange-dataset |
90,025 | How to represent a map data structure mathematically | <p>Wondering how to represent a map object such as the following mathematically:</p>

<pre><code>var foo = {
 a: 10,
 b: 'bar',
 c: true
}
</code></pre>

<p>You could say that it was a function like this:</p>

<pre><code>foo(x, y, z)
</code></pre>

<p>where $x$... | type theory notation mathematical foundations | 1 | How to represent a map data structure mathematically -- (type theory notation mathematical foundations)
<p>Wondering how to represent a map object such as the following mathematically:</p>

<pre><code>var foo = {
 a: 10,
 b: 'bar',
 c: true
}
</code></pre>

<p>You could say that i... | habedi/stack-exchange-dataset |
90,026 | What equivalence relation does this algorithm produce for an cyclic directed graph with labeled edges? | <p>I have a directed graph, which can be cyclic, where each node contains a value.</p>

<p>Nodes are not labeled, and different nodes can contain the same value.</p>

<p>The outgoing edges of a node are ordered, or labeled, (1, 2, 3, ... N), where N is the number of outgoing edges from the node. (That ... | graphs time complexity | 1 | What equivalence relation does this algorithm produce for an cyclic directed graph with labeled edges? -- (graphs time complexity)
<p>I have a directed graph, which can be cyclic, where each node contains a value.</p>

<p>Nodes are not labeled, and different nodes can contain the same value.</p>

<p>The... | habedi/stack-exchange-dataset |
90,032 | Is there a method to compress all data without loss (lossless compression)? | <p>I know that the answer is no but I'm not sure why. Here's where I started. We know that all data with length $n$ Bits and minimum $1$ Bit can be compressed, either lossless or lossy. But how do I continue? Why is it impossible to compress all the data without loss?</p>
 | algorithms complexity theory nondeterminism information theory data compression | 1 | Is there a method to compress all data without loss (lossless compression)? -- (algorithms complexity theory nondeterminism information theory data compression)
<p>I know that the answer is no but I'm not sure why. Here's where I started. We know that all data with length $n$ Bits and minimum $1$ Bit can be compressed,... | habedi/stack-exchange-dataset |
90,044 | prove A is co-re | <p>Working on some cs theory and solving a problem on computationally [=recursively] enumerable languages: </p>

<blockquote>
 <p>A language $A\subseteq \{0,1\}^*$ is co-c.e. if and only if there is a decidable language 
 $B\subseteq \{0,1\}^*$ such that, for all $x\in\{0,1\}^*$,</p>
 
 <p>$... | turing machines computability church turing thesis | 1 | prove A is co-re -- (turing machines computability church turing thesis)
<p>Working on some cs theory and solving a problem on computationally [=recursively] enumerable languages: </p>

<blockquote>
 <p>A language $A\subseteq \{0,1\}^*$ is co-c.e. if and only if there is a decidable language 
 $B\subs... | habedi/stack-exchange-dataset |
90,063 | time complexity when power is involved in iteration | <p>How do I calculate the time complexity of the following method? Would you please provide explanation? I know it's going to involve <code>sqrt(n) * <something></code>. I Just don't know what that <code><something></code> is.</p>

<pre><code>public void timeComplexity(int[] arr){
 int n = ar... | algorithm analysis time complexity loops | 1 | time complexity when power is involved in iteration -- (algorithm analysis time complexity loops)
<p>How do I calculate the time complexity of the following method? Would you please provide explanation? I know it's going to involve <code>sqrt(n) * <something></code>. I Just don't know what that <code><somethin... | habedi/stack-exchange-dataset |
90,068 | Optimizing Fleury's algorithm to work in O(|V|+|E|) | <p>The time complexity of Fleury's algorithm is $O(|E|^2)$ because for each edge I have to check whether it is a bridge or not and that takes $O(|V|+|E|)$ time. But, instead of that if I store my bridges in a hash table by a traversal at the beginning and then print the Eulerian tour (checking for each bridge in $O(1)$... | algorithms graphs eulerian paths | 1 | Optimizing Fleury's algorithm to work in O(|V|+|E|) -- (algorithms graphs eulerian paths)
<p>The time complexity of Fleury's algorithm is $O(|E|^2)$ because for each edge I have to check whether it is a bridge or not and that takes $O(|V|+|E|)$ time. But, instead of that if I store my bridges in a hash table by a trave... | habedi/stack-exchange-dataset |
90,069 | Interval scheduling problem with priorities | <p>I have a problem that is similar to the interval scheduling algorithm but it involves priorities. My data sets consist of the following data:</p>

<ul>
<li><strong>Cars</strong> with the start and end time of parking, along with their one or more attributes (e.g. electric vehicle, motorcycle, handicapped... | algorithms optimization scheduling integer programming | 1 | Interval scheduling problem with priorities -- (algorithms optimization scheduling integer programming)
<p>I have a problem that is similar to the interval scheduling algorithm but it involves priorities. My data sets consist of the following data:</p>

<ul>
<li><strong>Cars</strong> with the start and end ... | habedi/stack-exchange-dataset |
90,076 | How to solve this mapping reduction problem by proving the computability of this function? | <p>I am working on a mapping reduction problem. Define the union of two languages $L_1,L_2\subseteq\{0,1\}^*$ to be $L_1 \cup L_2 = \{x0\mid x \in L_1\} \cup \{y1\mid y \in L_2\}$. I want to prove that $L_1 \le_m L_1 \cup L_2$. </p>

<p>I was reading about the mapping reduction. According to mapping reductions,... | turing machines computability reductions | 1 | How to solve this mapping reduction problem by proving the computability of this function? -- (turing machines computability reductions)
<p>I am working on a mapping reduction problem. Define the union of two languages $L_1,L_2\subseteq\{0,1\}^*$ to be $L_1 \cup L_2 = \{x0\mid x \in L_1\} \cup \{y1\mid y \in L_2\}$. I ... | habedi/stack-exchange-dataset |
90,081 | Complexity of divide and conquer algorithm with a quadratic merge function | <p>Consider the following pseudocode:</p>

<pre><code>int divide(int l , int r){
 if r - l > 3 then
 mid = (l + r) / 2
 divide(l , mid)
 divide(mid + 1, r)
 return merge(l, mid, r)
 else
 return bruteforce_solution(l, r)
}
</code></... | complexity theory time complexity divide and conquer | 1 | Complexity of divide and conquer algorithm with a quadratic merge function -- (complexity theory time complexity divide and conquer)
<p>Consider the following pseudocode:</p>

<pre><code>int divide(int l , int r){
 if r - l > 3 then
 mid = (l + r) / 2
 divide(l , mid)
 ... | habedi/stack-exchange-dataset |
90,109 | Minimum path cover--- Disjointed paths with minimum total number of edges | <p>Let $T=(\mathcal{V},\mathcal{E})$ be an udirected acyclic graph and $|\mathcal{V}|=n$. Let $\mathcal{V'}$ be $\mathcal{V'}\subset \mathcal{V}$ where $|\mathcal{V'}|=2m\leq n$. There are $2m \choose 2$ pairs of nodes in the set $\mathcal{V'}$. For each pair of nodes $(w,w')$ in the set $\mathcal{V'}$, there is a uniq... | algorithms graphs optimization | 1 | Minimum path cover--- Disjointed paths with minimum total number of edges -- (algorithms graphs optimization)
<p>Let $T=(\mathcal{V},\mathcal{E})$ be an udirected acyclic graph and $|\mathcal{V}|=n$. Let $\mathcal{V'}$ be $\mathcal{V'}\subset \mathcal{V}$ where $|\mathcal{V'}|=2m\leq n$. There are $2m \choose 2$ pairs ... | habedi/stack-exchange-dataset |
90,118 | The Entropy of the phrase "Eile Mit Weile" | <p>I want to calculate the Entropy of the phrase "Eile mit Weile". I found the probability of each letter as the following</p>

<p>$$P(e)=\frac{4}{12}$$
$$P(i)=\frac{3}{12}$$
$$P(l)=\frac{2}{12}$$
$$P(m)=\frac{1}{12}$$
$$P(t)=\frac{1}{12}$$
$$P(w)=\frac{1}{12}$$</p>

<p>Then I used t... | algorithms complexity theory optimization information theory entropy | 1 | The Entropy of the phrase "Eile Mit Weile" -- (algorithms complexity theory optimization information theory entropy)
<p>I want to calculate the Entropy of the phrase "Eile mit Weile". I found the probability of each letter as the following</p>

<p>$$P(e)=\frac{4}{12}$$
$$P(i)=\frac{3}{12}$$
$$P(l)=\frac... | habedi/stack-exchange-dataset |
90,119 | How to find LCA in a directed acyclic graph? | <p>Firstly, I am trying to understand the meaning of LCA in DAG. I read a definition somewhere-"Define the height of a vertex v in a DAG to be the length of the longest path from root to v. Among the vertices that are ancestors of both v and w, the one with the greatest height is an LCA of v and w."</p>

<p>In ... | algorithms graphs | 1 | How to find LCA in a directed acyclic graph? -- (algorithms graphs)
<p>Firstly, I am trying to understand the meaning of LCA in DAG. I read a definition somewhere-"Define the height of a vertex v in a DAG to be the length of the longest path from root to v. Among the vertices that are ancestors of both v and w, the one... | habedi/stack-exchange-dataset |
90,121 | How can I prove that $T(n)=\sqrt{n}T(\sqrt{n})+n$ grows as $\Theta(n\log \log{n})$? | <p>How can I prove that if $T(n) = \sqrt{n}T(\sqrt{n}) + n$ then $T(n) = \Theta(n\log\log n)$?</p>

<p>I tried to define $T(n)$ by $G(n)$, prove about $G(n)$, and then to return to $T(n)$, but it's not working..</p>
 | complexity theory recursion | 1 | How can I prove that $T(n)=\sqrt{n}T(\sqrt{n})+n$ grows as $\Theta(n\log \log{n})$? -- (complexity theory recursion)
<p>How can I prove that if $T(n) = \sqrt{n}T(\sqrt{n}) + n$ then $T(n) = \Theta(n\log\log n)$?</p>

<p>I tried to define $T(n)$ by $G(n)$, prove about $G(n)$, and then to return to $T(n)$, but it... | habedi/stack-exchange-dataset |
90,122 | Finding Big O of 1/n + 1/n+2 ... 1/n' | <p>The number of computations of an algorithm is $n'm\sum_{x=0}^{n'-m} 1/(m+x)$. What is the complexity of the algorithm ?</p>

<p>Thanx for help.</p>
 | asymptotics | 1 | Finding Big O of 1/n + 1/n+2 ... 1/n' -- (asymptotics)
<p>The number of computations of an algorithm is $n'm\sum_{x=0}^{n'-m} 1/(m+x)$. What is the complexity of the algorithm ?</p>

<p>Thanx for help.</p>
 | habedi/stack-exchange-dataset |
90,126 | Big O of an algorithm that relies on convergence | <p>I'm wondering if its possible to express the time complexity of an algorithm that relies on convergence using Big $O$ notation.</p>

<p>Is it fair to say that we can't reason about an algorithm's scalability based on input size if we also have to rely on convergence - unless there's some facet of the algorit... | algorithms algorithm analysis asymptotics | 1 | Big O of an algorithm that relies on convergence -- (algorithms algorithm analysis asymptotics)
<p>I'm wondering if its possible to express the time complexity of an algorithm that relies on convergence using Big $O$ notation.</p>

<p>Is it fair to say that we can't reason about an algorithm's scalability based... | habedi/stack-exchange-dataset |
90,127 | Does the circuit value problem require only log space in alternating Turing machines | <p>Why does the circuit value problem run in log space on an alternating Turing machine? It is claimed to be so in my university's lecture notes. Also, it is claimed that monotone circuit value problem has the same space complexity on an alternating Turing machine.</p>

<p>I think it requires at least linear sp... | complexity theory turing machines space complexity | 1 | Does the circuit value problem require only log space in alternating Turing machines -- (complexity theory turing machines space complexity)
<p>Why does the circuit value problem run in log space on an alternating Turing machine? It is claimed to be so in my university's lecture notes. Also, it is claimed that monotone... | habedi/stack-exchange-dataset |
90,131 | Finding missing number in an unsorted array | <blockquote>
 <p>You are given an unsorted array of all the integers in the range $0$
 to $n = 2^k -1$ except for one integer, called the missing number.
 Find a divide and conquer algorithm to find the missing number in time
 $O(n)$. If you wish, you may use the fact that an algorithm
 $median... | algorithms time complexity divide and conquer | 1 | Finding missing number in an unsorted array -- (algorithms time complexity divide and conquer)
<blockquote>
 <p>You are given an unsorted array of all the integers in the range $0$
 to $n = 2^k -1$ except for one integer, called the missing number.
 Find a divide and conquer algorithm to find the missing... | habedi/stack-exchange-dataset |
90,134 | Can a computable function converge to an uncomputable number? | <p>Does there exist a computable function $f:\mathbb{N}\rightarrow \mathbb{Q}$ such that:</p>

<ul>
<li>For all $t\in\mathbb{N}: 0\le f(t) < X$</li>
<li>$\lim\limits_{t\rightarrow\infty} f(t) = X$</li>
</ul>

<p>Where $X$ is an uncomputable real number.</p>

<p>The only reference... | computability | 1 | Can a computable function converge to an uncomputable number? -- (computability)
<p>Does there exist a computable function $f:\mathbb{N}\rightarrow \mathbb{Q}$ such that:</p>

<ul>
<li>For all $t\in\mathbb{N}: 0\le f(t) < X$</li>
<li>$\lim\limits_{t\rightarrow\infty} f(t) = X$</li>
</ul>
&#x... | habedi/stack-exchange-dataset |
90,136 | Can we load the data on the bus on multiple registers at the same time? | <p>So in the book that I'm reading it says at a time only the data of one register can be on the data bus and only one register can load the data. the first part i get but what about the second part?</p>

<p>why can't we just turn on the load parameter for both of the registers at the same time?</p>

<p... | computer architecture | 1 | Can we load the data on the bus on multiple registers at the same time? -- (computer architecture)
<p>So in the book that I'm reading it says at a time only the data of one register can be on the data bus and only one register can load the data. the first part i get but what about the second part?</p>

<p>why c... | habedi/stack-exchange-dataset |
90,138 | Could a standardized ternary system be more efficient than the binary system? | <p>Could a standardized ternary (base-3) system be more efficient than the binary (base-2) system? Binary is efficient for processing using logic gates, but can be bulky when using for file storage or file transfer. I am interested in the feasibility of a ternary system both for file storage, file transfer, and computa... | algorithms computer architecture communication protocols storage binary | 1 | Could a standardized ternary system be more efficient than the binary system? -- (algorithms computer architecture communication protocols storage binary)
<p>Could a standardized ternary (base-3) system be more efficient than the binary (base-2) system? Binary is efficient for processing using logic gates, but can be b... | habedi/stack-exchange-dataset |
90,142 | Why is the number of digits (bits) in the binary representation of a positive integer $n$ is the integral part of $1 + \log_2 n$? | <p>I've stumbled on <a href="https://en.wikipedia.org/wiki/Binary_logarithm#Information_theory" rel="nofollow noreferrer">this definition on Wikipedia</a>, and I can't figure out why.</p>

<p>I could probably start the demonstration by saying that, with $n$ bits, you can create $2^n$ possible different numbers,... | combinatorics arithmetic | 1 | Why is the number of digits (bits) in the binary representation of a positive integer $n$ is the integral part of $1 + \log_2 n$? -- (combinatorics arithmetic)
<p>I've stumbled on <a href="https://en.wikipedia.org/wiki/Binary_logarithm#Information_theory" rel="nofollow noreferrer">this definition on Wikipedia</a>, and ... | habedi/stack-exchange-dataset |
90,144 | Meaning of "pushing x down" and "pulling x up" in database query handling | <p>In <a href="http://pi3.informatik.uni-mannheim.de/~moer/querycompiler.pdf" rel="nofollow noreferrer">this book</a> there is a lot of mention of "pushing x down". For example:</p>

<blockquote>
 <h3>Pushing NOT operations down and eliminating them</h3>
 
 <p>NOT operations need to be <strong>pu... | database theory | 1 | Meaning of "pushing x down" and "pulling x up" in database query handling -- (database theory)
<p>In <a href="http://pi3.informatik.uni-mannheim.de/~moer/querycompiler.pdf" rel="nofollow noreferrer">this book</a> there is a lot of mention of "pushing x down". For example:</p>

<blockquote>
 <h3>Pushing NOT... | habedi/stack-exchange-dataset |
90,145 | sub-optimal but fast partition generation | <p>I have a set of N integers that I want to partition into m subsets. I want these subsets to be well-balanced wrt some criterion say that minimize the max difference between the size of all subsets. But I am not really interested in <strong>THE</strong> optimal solution. I am interested in a <strong>FAST</strong> alg... | algorithms combinatorics discrete mathematics partitions integer partitions | 1 | sub-optimal but fast partition generation -- (algorithms combinatorics discrete mathematics partitions integer partitions)
<p>I have a set of N integers that I want to partition into m subsets. I want these subsets to be well-balanced wrt some criterion say that minimize the max difference between the size of all subse... | habedi/stack-exchange-dataset |
90,147 | Group tuples to satisfy constraints | <p>This is a problem that involves matching students with various skills into groups so that there are as many groups as possible while ensuring that each group has certain skills present. I've reduced it to this:</p>

<ol>
<li>Given a set of $N$ people with $S$ skills where $A_{n,s}$ is the quantity of ski... | algorithms combinatorics matching | 1 | Group tuples to satisfy constraints -- (algorithms combinatorics matching)
<p>This is a problem that involves matching students with various skills into groups so that there are as many groups as possible while ensuring that each group has certain skills present. I've reduced it to this:</p>

<ol>
<li>Given... | habedi/stack-exchange-dataset |
90,149 | Analysis of time complexity of travelling salesman problem | <p>Recursive definition for travelling salesman problem can be written like this :-</p>

<p><code>T(i,S)=min((i,j)+T(j,S-{j})) for all j belonging to S, when S is not equal to NULL</code></p>

<p><code>T(i,S)=(i,S) when S is equal to NULL</code></p>

<p>Here, T(i,S) denotes the tour starting fro... | algorithms graphs time complexity | 1 | Analysis of time complexity of travelling salesman problem -- (algorithms graphs time complexity)
<p>Recursive definition for travelling salesman problem can be written like this :-</p>

<p><code>T(i,S)=min((i,j)+T(j,S-{j})) for all j belonging to S, when S is not equal to NULL</code></p>

<p><code>T(i,... | habedi/stack-exchange-dataset |
90,154 | For multi-tape Turing machines, can we assume that each tape can be in its own state independently of the other tapes? | <p>When we consider multi-tape Turing machines, we can assume that each tape is accessed with a separate head and each head can move independently of the other heads. But can we assume that each tape can be in its own state independently of the other tapes (for example, tape 1 in state A, tape 2 in state F, tape 3 in s... | turing machines | 1 | For multi-tape Turing machines, can we assume that each tape can be in its own state independently of the other tapes? -- (turing machines)
<p>When we consider multi-tape Turing machines, we can assume that each tape is accessed with a separate head and each head can move independently of the other heads. But can we as... | habedi/stack-exchange-dataset |
90,157 | Find longest path in graph with N nodes and N edges | <p>We have given weighted undirected connected graph with $n$ nodes and $n$ edges, we want to find the longest path in it. Note that the path should be in each node at most once. Since the graph has $n$ edges clearly it has exactly 1 cycle, and removing 1 edge from this cycle will lead us to a tree.</p>

<p>Cle... | graphs weighted graphs | 1 | Find longest path in graph with N nodes and N edges -- (graphs weighted graphs)
<p>We have given weighted undirected connected graph with $n$ nodes and $n$ edges, we want to find the longest path in it. Note that the path should be in each node at most once. Since the graph has $n$ edges clearly it has exactly 1 cycle,... | habedi/stack-exchange-dataset |
90,159 | Do we generally store the degree of each vertex in the linked list implementation? if not, why? | <p>So generally speaking, when we implement the graph using linked list, do we store the degree of each edge too?</p>

<p>I'm asking this because if a question in my exam stated that we implemented this graph using linked list, do i assume we can access the degree of each edge in o(1) or not? this matters becau... | graphs data structures | 1 | Do we generally store the degree of each vertex in the linked list implementation? if not, why? -- (graphs data structures)
<p>So generally speaking, when we implement the graph using linked list, do we store the degree of each edge too?</p>

<p>I'm asking this because if a question in my exam stated that we im... | habedi/stack-exchange-dataset |
90,170 | The set of valid sentences in FO is not decidable as a consequence of rec. inseparability | <p>Two given languages $L_1$ and $L_2$ are called <em>recursively separable</em> iff there exists a recursive languge $R$ such that $L_1 \subseteq R$ and $L_2 \cap R = \emptyset$.</p>

<p>Now consider first order logic, and some finite axiomatisation of $\mathbb N$ in it (surely this is way to weak, as we have ... | complexity theory computability logic undecidability first order logic | 1 | The set of valid sentences in FO is not decidable as a consequence of rec. inseparability -- (complexity theory computability logic undecidability first order logic)
<p>Two given languages $L_1$ and $L_2$ are called <em>recursively separable</em> iff there exists a recursive languge $R$ such that $L_1 \subseteq R$ and ... | habedi/stack-exchange-dataset |
90,172 | Self loops in max flow problem | <p>So, there can be different types of edges in a directed graph while solving the max flow problem. There can be reverse edges, multiple edges and self loops. </p>

<p>What is the significance of self loops in it? </p>

<p>How is it related to flow in the graph?</p>

<p>Let there be a graph lik... | algorithms graphs network flow | 1 | Self loops in max flow problem -- (algorithms graphs network flow)
<p>So, there can be different types of edges in a directed graph while solving the max flow problem. There can be reverse edges, multiple edges and self loops. </p>

<p>What is the significance of self loops in it? </p>

<p>How is it rel... | habedi/stack-exchange-dataset |
90,179 | Computational Complexity of a special case of Integer Programming | <p>Integer Linear Programming (ILP) is NP-complete. However, there are special instances that can be solved in polynomial time. I am curious about the following integer program (IP) with equations and inequalities in $y_i, c_i, x \in \mathbb Z$ of the following form:</p>

<p>$$\begin{align*}
A_i + B_i y_i+ ... | complexity theory integer programming | 1 | Computational Complexity of a special case of Integer Programming -- (complexity theory integer programming)
<p>Integer Linear Programming (ILP) is NP-complete. However, there are special instances that can be solved in polynomial time. I am curious about the following integer program (IP) with equations and inequaliti... | habedi/stack-exchange-dataset |
90,184 | Saving time finding a result by guessing first? | <p>I am currently taking a graduate course about Image Processing in electrical engineering and while this question doesn't particularly relate to the class itself but rather some concepts in the algorithms we utilize.</p>

<p>One of the algorithms that we utilized was called, "Image Correlation" in order to fi... | algorithms runtime analysis | 1 | Saving time finding a result by guessing first? -- (algorithms runtime analysis)
<p>I am currently taking a graduate course about Image Processing in electrical engineering and while this question doesn't particularly relate to the class itself but rather some concepts in the algorithms we utilize.</p>

<p>One ... | habedi/stack-exchange-dataset |
90,186 | Removing vertices that belong to a given set from a graph | <p>If I'm given a graph $G$ with the set of vertices $V$ and a set $B \subseteq V$, can I remove all the vertices $\in B$ from $G$, as well as all edges that connect any other vertex to a vertex $\in B$ in linear time ($O(V + E)$)? It can be assumed that checking if a vertex $\in B$ is $O(1)$.</p>

<p>My though... | graphs graph traversal | 1 | Removing vertices that belong to a given set from a graph -- (graphs graph traversal)
<p>If I'm given a graph $G$ with the set of vertices $V$ and a set $B \subseteq V$, can I remove all the vertices $\in B$ from $G$, as well as all edges that connect any other vertex to a vertex $\in B$ in linear time ($O(V + E)$)? It... | habedi/stack-exchange-dataset |
90,202 | Sorting a stack using Bubble sort | <p>How to sort a stack using bubble sort? Can use another stack if necessary.</p>
 | algorithms sorting stacks | 1 | Sorting a stack using Bubble sort -- (algorithms sorting stacks)
<p>How to sort a stack using bubble sort? Can use another stack if necessary.</p>
 | habedi/stack-exchange-dataset |
90,216 | Show a sequence of distinct Primes number is O(log n) | <p>Suppose I have a sequence:</p>

<p>$$n = \prod_{i=1}^{r(n)} p_i^{d_i}$$</p>

<p>for some primes $p_1 < p_2 < \dots < p_{r(n)}$, and each $d_i \geq 1$ an integer. The function $r(n)$ denotes the number of distinct primes divisor of $n$.</p>

<p>I'm trying to show $r(n) = O(\log n)$.</... | primes | 1 | Show a sequence of distinct Primes number is O(log n) -- (primes)
<p>Suppose I have a sequence:</p>

<p>$$n = \prod_{i=1}^{r(n)} p_i^{d_i}$$</p>

<p>for some primes $p_1 < p_2 < \dots < p_{r(n)}$, and each $d_i \geq 1$ an integer. The function $r(n)$ denotes the number of distinct primes diviso... | habedi/stack-exchange-dataset |
90,229 | Is it possible to make a language that can build upon itself perfectly? | <p>First of all, note that I'll have to explain my thoughts in a layman's terms.</p>

<p>There are so many high-level programming languages out there that compete with each other. This means we have to build the same functionality over and over again in each language.</p>

<p>Therefore, I wonder the fol... | programming languages functional programming mathematical programming | 1 | Is it possible to make a language that can build upon itself perfectly? -- (programming languages functional programming mathematical programming)
<p>First of all, note that I'll have to explain my thoughts in a layman's terms.</p>

<p>There are so many high-level programming languages out there that compete wi... | habedi/stack-exchange-dataset |
90,230 | Registers of Control Unit and Arithmetic Logic Unit | <p>For an Instruction fetch cycle we have the flowing registers in a CPU.</p>

<ol>
<li><p>Memory Address Register (MAR)</p></li>
<li><p>Memory Buffer Register (MBR)</p></li>
<li><p>Program Counter (PC)</p></li>
<li><p>Instruction Register (IR):</p></li>
<li><p>Accumulator Register:</p></li>... | computer architecture | 1 | Registers of Control Unit and Arithmetic Logic Unit -- (computer architecture)
<p>For an Instruction fetch cycle we have the flowing registers in a CPU.</p>

<ol>
<li><p>Memory Address Register (MAR)</p></li>
<li><p>Memory Buffer Register (MBR)</p></li>
<li><p>Program Counter (PC)</p></li>
<li><... | habedi/stack-exchange-dataset |
90,233 | Test a bit substring function | <p>How do we test the following function?</p>

<p><code>bits(bitstring, i, j)</code></p>

<p>which returns a copy of the substring from <code>i</code> to <code>j</code> of some <code>bitstring</code>.</p>

<p>Consider the fixed 32-bit value:</p>

<p><code>bitstring=0x12345678</code></p>&... | strings software testing bit manipulation testing | 1 | Test a bit substring function -- (strings software testing bit manipulation testing)
<p>How do we test the following function?</p>

<p><code>bits(bitstring, i, j)</code></p>

<p>which returns a copy of the substring from <code>i</code> to <code>j</code> of some <code>bitstring</code>.</p>

<p>Co... | habedi/stack-exchange-dataset |
90,242 | Kolmogorov Complexity proving there exists a constant for when if two strings are equal length | <p>When talking about kolmogorov complexity, I understand that it describes true randomness of given (for now) a string <span class="math-container">$x$</span>, if we can describe x in less than the <span class="math-container">$|x|$</span> then its complexity is said to be</p>
<blockquote>
<p><span class="math... | turing machines information theory kolmogorov complexity | 1 | Kolmogorov Complexity proving there exists a constant for when if two strings are equal length -- (turing machines information theory kolmogorov complexity)
<p>When talking about kolmogorov complexity, I understand that it describes true randomness of given (for now) a string <span class="math-container">$x$</span>, if... | habedi/stack-exchange-dataset |
90,247 | How to solve this recurrence involving binomial coefficients? | <p>How to solve the following recurrence involving binomial coefficients, where $c$ is a constant non-negative integer, and $n$ and $k$ are non-negative integers ($n \ge k \ge 0$)?</p>

<p>$$
A(n,k) = A(n-1,k) + A(n-1,k-1) + c, \\
A(n,0) = 1, A(n,n) = 1
$$</p>

<hr>

<p><strong><em>M... | recurrence relation generating functions | 1 | How to solve this recurrence involving binomial coefficients? -- (recurrence relation generating functions)
<p>How to solve the following recurrence involving binomial coefficients, where $c$ is a constant non-negative integer, and $n$ and $k$ are non-negative integers ($n \ge k \ge 0$)?</p>

<p>$$
A(n,k) =... | habedi/stack-exchange-dataset |
90,259 | Why can we assume an algorithm can be represented as a bit string? | <p>I am starting read a book about Computational Complexity and Turing Machines. Here is quote:</p>

<blockquote>
 <p>An algorithm (i.e., a machine) can be represented as a bit string once
 we decide on some canonical encoding.</p>
</blockquote>

<p>This assertion is provided as a simple f... | algorithms turing machines computability computation models | 1 | Why can we assume an algorithm can be represented as a bit string? -- (algorithms turing machines computability computation models)
<p>I am starting read a book about Computational Complexity and Turing Machines. Here is quote:</p>

<blockquote>
 <p>An algorithm (i.e., a machine) can be represented as a bi... | habedi/stack-exchange-dataset |
90,264 | GPR registers in computer | <p>How to ensure data integrity in General Purpose Registers (GPR registers) given their limited number (for x86 their number is 6),and on the other hand that they are used simultaneously by all processes?</p>
 | computer architecture | 1 | GPR registers in computer -- (computer architecture)
<p>How to ensure data integrity in General Purpose Registers (GPR registers) given their limited number (for x86 their number is 6),and on the other hand that they are used simultaneously by all processes?</p>
 | habedi/stack-exchange-dataset |
90,267 | Where is the second face in a graph with 3 nodes? | <p>I understand that to work out the number of faces of a connected planar graph, you use Euler's formula F = A - N + 2, where A is the number of arcs and N is the number of nodes.</p>

<p>For a triangle node (3 arcs and 3 nodes), the number of faces would therefore be 3 - 3 + 2 = 2.</p>

<p>But I can't... | graphs planar graphs | 1 | Where is the second face in a graph with 3 nodes? -- (graphs planar graphs)
<p>I understand that to work out the number of faces of a connected planar graph, you use Euler's formula F = A - N + 2, where A is the number of arcs and N is the number of nodes.</p>

<p>For a triangle node (3 arcs and 3 nodes), the n... | habedi/stack-exchange-dataset |
90,270 | Number of words in $\{pi,po\}^*$ of length at most 9 | <p>I have a language $L^*$ for $L = \{pi,po\}$ (I think pi counts as one letter and po also as one letter otherwise a max length of 9 is not possible).</p>

<p>The question is how many words I can make with $L^*$ where the maximum length is 9.</p>

<p>The answer is 31, but I do not know how it got calcu... | combinatorics word combinatorics | 1 | Number of words in $\{pi,po\}^*$ of length at most 9 -- (combinatorics word combinatorics)
<p>I have a language $L^*$ for $L = \{pi,po\}$ (I think pi counts as one letter and po also as one letter otherwise a max length of 9 is not possible).</p>

<p>The question is how many words I can make with $L^*$ where th... | habedi/stack-exchange-dataset |
90,273 | Among a number of sets, how to find the one that includes the highest number of other sets? | <p>I have a large number of sets, <code>A, B, C, ...</code> where each set includes a few integers. I would like to find the set that includes the highest number of other sets. </p>

<p>A brute-force solution is to compare each set with all other sets and count the number of sets that are included in this set. ... | sets | 1 | Among a number of sets, how to find the one that includes the highest number of other sets? -- (sets)
<p>I have a large number of sets, <code>A, B, C, ...</code> where each set includes a few integers. I would like to find the set that includes the highest number of other sets. </p>

<p>A brute-force solution i... | habedi/stack-exchange-dataset |
90,276 | Avoiding correlated values and reduced collision resistance in multiple hash states | <p>I need to design a hash function that fits this criteria:</p>

<ol>
<li>Limited to 32-bit integer operations (for compatibility with JavaScript bitwise operations, my target system)</li>
<li>Produces an n-bit hash digest, greater or equal to 64-bit, with the expected collision probability of a hash o... | algorithm analysis probability theory hash hashing algorithm design | 1 | Avoiding correlated values and reduced collision resistance in multiple hash states -- (algorithm analysis probability theory hash hashing algorithm design)
<p>I need to design a hash function that fits this criteria:</p>

<ol>
<li>Limited to 32-bit integer operations (for compatibility with JavaScript bitw... | habedi/stack-exchange-dataset |
90,278 | On NP and PP in RP? | <p>Does $NP\subseteq RP\implies NP=RP$?</p>

<p>Does $PP\subseteq RP\implies \oplus P=NP=RP$?</p>

<p>At least what additional minimal conditions will give truth of above?</p>
 | complexity theory complexity classes | 1 | On NP and PP in RP? -- (complexity theory complexity classes)
<p>Does $NP\subseteq RP\implies NP=RP$?</p>

<p>Does $PP\subseteq RP\implies \oplus P=NP=RP$?</p>

<p>At least what additional minimal conditions will give truth of above?</p>
 | habedi/stack-exchange-dataset |
90,286 | Algorithm to sort n numbers from 0 to $n^m$ in $\mathcal{O}(n)$? where m is a constant | <p>So i came upon this question where:</p>

<p>we have to sort $n$ numbers between $0$ and $n^3$ and the answer of time complexity is $\mathcal{O}(n)$ and the author solved it this way:</p>

<p>first we convert the base of these numbers to $n$ in $\mathcal{O}(n)$, therefore now we have numbers with maxi... | algorithms sorting | 1 | Algorithm to sort n numbers from 0 to $n^m$ in $\mathcal{O}(n)$? where m is a constant -- (algorithms sorting)
<p>So i came upon this question where:</p>

<p>we have to sort $n$ numbers between $0$ and $n^3$ and the answer of time complexity is $\mathcal{O}(n)$ and the author solved it this way:</p>

<p... | habedi/stack-exchange-dataset |
90,288 | Turing machine + time dilation = solve the halting problem? | <p>There are relativistic spacetimes (e.g. M-H spacetimes; see Hogarth 1994) where a worldline of infinite duration can be contained in the past of a finite observer. This means that a normal observer can have access to an infinite number of a computation steps.</p>

<p>Assuming it's possible for a computer to ... | turing machines halting problem church turing thesis hypercomputation | 1 | Turing machine + time dilation = solve the halting problem? -- (turing machines halting problem church turing thesis hypercomputation)
<p>There are relativistic spacetimes (e.g. M-H spacetimes; see Hogarth 1994) where a worldline of infinite duration can be contained in the past of a finite observer. This means that a ... | habedi/stack-exchange-dataset |
90,304 | Union of fixed and floating point types | <p>Say I have two real number types. They may be floating or fixed point. How can I construct a new type whose values are at least the union of the two with the minimal number of bits?</p>

<p>There are 3 cases to consider:</p>

<p><strong>Fixed (Qa.x) $\cup$ Fixed (Qb.y)</strong> - I think the best her... | floating point numerical algorithms dependent types typing | 1 | Union of fixed and floating point types -- (floating point numerical algorithms dependent types typing)
<p>Say I have two real number types. They may be floating or fixed point. How can I construct a new type whose values are at least the union of the two with the minimal number of bits?</p>

<p>There are 3 cas... | habedi/stack-exchange-dataset |
90,309 | What is the formal way to prove this is still a minimum spanning tree? | <p>I don't get the formal way of proving the following cases:</p>

<p>Suppose I have a minimum spanning tree $T$ in a graph $G(V, E)$, with positive edge weights $w$, I want to prove the following:</p>

<p>1) If I increase the edge weight of an edge that is not in $T$, then my resulting tree is still th... | algorithms graphs data structures minimum spanning tree | 1 | What is the formal way to prove this is still a minimum spanning tree? -- (algorithms graphs data structures minimum spanning tree)
<p>I don't get the formal way of proving the following cases:</p>

<p>Suppose I have a minimum spanning tree $T$ in a graph $G(V, E)$, with positive edge weights $w$, I want to pro... | habedi/stack-exchange-dataset |
90,311 | Are too many function calls bad(as in slows speed performance) for programs written using interpretor-based scripting language(JavaScript, Perl)? | <p>The interpreters used for running scripting language (i.e., JavaScript, Perl, PHP, etc. ) programs go line-by-line. Isn't it better to Avoid too many function invocations for programs written in said scripting languages? However, Avoiding writing functions would be really a pain because you would have huge blocks ... | interpreters | 1 | Are too many function calls bad(as in slows speed performance) for programs written using interpretor-based scripting language(JavaScript, Perl)? -- (interpreters)
<p>The interpreters used for running scripting language (i.e., JavaScript, Perl, PHP, etc. ) programs go line-by-line. Isn't it better to Avoid too many fu... | habedi/stack-exchange-dataset |
90,315 | All finite languages can be decribed using a regular expression? | <p>I have a question.
All finite languages can be decribed using a regular expression?</p>
 | formal languages regular languages regular expressions | 1 | All finite languages can be decribed using a regular expression? -- (formal languages regular languages regular expressions)
<p>I have a question.
All finite languages can be decribed using a regular expression?</p>
 | habedi/stack-exchange-dataset |
90,329 | Is it possible to create a CFG with succesive palindromes? | <p>In one of my homework I am requested to find a Context-free-grammar (CFG) and a push down automaton (PDA) for the following language:</p>

<p>$L = \{x_1\#x_2\#...\#x_k | k \geq 2, \text{ each } x_i \in \{a, b\}^*, \text{ and for some } i \text{ and } j, x_i=x_j^\mathcal{R}\}$</p>

<p>My problem is th... | formal languages context free | 1 | Is it possible to create a CFG with succesive palindromes? -- (formal languages context free)
<p>In one of my homework I am requested to find a Context-free-grammar (CFG) and a push down automaton (PDA) for the following language:</p>

<p>$L = \{x_1\#x_2\#...\#x_k | k \geq 2, \text{ each } x_i \in \{a, b\}^*, \... | habedi/stack-exchange-dataset |
90,333 | Find All possible Pairs in given Array | <p>It is required to count number of unordered pairs in an <em>array of size n</em> ,</p>

<p><strong>l[i]+l[j] = 2*l[k]</strong> , where <em>1<=i< j<=n and 1<=k<= n</em></p>

<p>My Approach:</p>

<pre><code>l = [1,3,5,4,2,5]
l.sort() 
l2 = [] 
for i in l:
 l2.a... | arrays | 1 | Find All possible Pairs in given Array -- (arrays)
<p>It is required to count number of unordered pairs in an <em>array of size n</em> ,</p>

<p><strong>l[i]+l[j] = 2*l[k]</strong> , where <em>1<=i< j<=n and 1<=k<= n</em></p>

<p>My Approach:</p>

<pre><code>l = [1,3,5,4,2,5]
... | habedi/stack-exchange-dataset |
90,340 | Given an array $A$, find all quadruples $(i,j,k,\ell)$ such that $i<j<k<\ell$ and $A[i]=A[k]$ and $A[j]=A[\ell]$? | <p>I have an array $A$ of $n$ integers. I need to find all quadruples $(i,j,k,\ell)$ such that $i<j<k<\ell$ and $A[i]=A[k]$ and $A[j]=A[\ell]$. What is the best way to do this? </p>

<p>My attempt is an exhaustive search algorithm that works as follows:</p>

<ul>
<li>Generate all quadruples... | algorithms | 1 | Given an array $A$, find all quadruples $(i,j,k,\ell)$ such that $i<j<k<\ell$ and $A[i]=A[k]$ and $A[j]=A[\ell]$? -- (algorithms)
<p>I have an array $A$ of $n$ integers. I need to find all quadruples $(i,j,k,\ell)$ such that $i<j<k<\ell$ and $A[i]=A[k]$ and $A[j]=A[\ell]$. What is the best way to do this? </p>... | habedi/stack-exchange-dataset |
90,344 | Efficient alternatives to inclusion-exclusion | <p>Say you've got a number of sets $S_1,...,S_n$ given and are supposed to calculate $\,\,\displaystyle\big|\bigcup_{i=1}^n S_i\big|$ .</p>

<p>The basic approach probably would be to use the classic inclusion-exclusion principle $\displaystyle\sum_{\emptyset \not= I \subseteq \{1, \dotsc, n\}} \left(-1\right)^... | combinatorics | 1 | Efficient alternatives to inclusion-exclusion -- (combinatorics)
<p>Say you've got a number of sets $S_1,...,S_n$ given and are supposed to calculate $\,\,\displaystyle\big|\bigcup_{i=1}^n S_i\big|$ .</p>

<p>The basic approach probably would be to use the classic inclusion-exclusion principle $\displaystyle\su... | habedi/stack-exchange-dataset |
90,348 | Fastest way to search a word in a word list? | <p>I have a word list like "English Open Word List" used to create word games.
The list is in txt file with space between words, like;
aa
aah
aahed
.........and so on.
I want to search it while typing the letters in the word, like google suggestions in the search bar.
What is the fastest alg... | algorithms search algorithms databases lists | 1 | Fastest way to search a word in a word list? -- (algorithms search algorithms databases lists)
<p>I have a word list like "English Open Word List" used to create word games.
The list is in txt file with space between words, like;
aa
aah
aahed
.........and so on.
I want to search it while typing ... | habedi/stack-exchange-dataset |
90,358 | Extend reachability to total ordering | <p>Given a finite DAG $G = (V, E)$ with $|E| \in \mathcal{O}(|V|)$, I want to compute a total ordering $<$ over $V$ that is compatible to reachability: If there is a transition $(u, v) \in E$, then $u < v$.</p>

<p>The only way I could think of was to use Floyd-Warshall to compute a reachability matrix an... | algorithms graphs dag ordering | 1 | Extend reachability to total ordering -- (algorithms graphs dag ordering)
<p>Given a finite DAG $G = (V, E)$ with $|E| \in \mathcal{O}(|V|)$, I want to compute a total ordering $<$ over $V$ that is compatible to reachability: If there is a transition $(u, v) \in E$, then $u < v$.</p>

<p>The only way I co... | habedi/stack-exchange-dataset |
90,375 | Is it possible for a stack-based programming language to be concurrent? | <p>I have been reading about stack-based programming languages, such as <a href="https://en.wikipedia.org/wiki/Forth_(programming_language)" rel="noreferrer">FORTH</a> and <a href="http://progopedia.com/language/cat/" rel="noreferrer">Cat</a>, and it seems that given their nature, they can only execute one action at a ... | concurrency stacks evaluation strategies | 1 | Is it possible for a stack-based programming language to be concurrent? -- (concurrency stacks evaluation strategies)
<p>I have been reading about stack-based programming languages, such as <a href="https://en.wikipedia.org/wiki/Forth_(programming_language)" rel="noreferrer">FORTH</a> and <a href="http://progopedia.com... | habedi/stack-exchange-dataset |
90,389 | Travelling salesman problem with small edge weights | <p>Are there any advantages in finding the shortest tour for the problem if edge weights are much smaller than the number of vertices?</p>

<p>Let's say the maximum edge weight is $n$, and the number of vertices is $n!$, and the adjacency matrix is dense and all distances $d_{ij}$ satisfy $0 \le d_{ij} \le n$. ... | algorithms optimization traveling salesman | 1 | Travelling salesman problem with small edge weights -- (algorithms optimization traveling salesman)
<p>Are there any advantages in finding the shortest tour for the problem if edge weights are much smaller than the number of vertices?</p>

<p>Let's say the maximum edge weight is $n$, and the number of vertices ... | habedi/stack-exchange-dataset |
90,390 | What machine learning training algorithm to use for this kind of string dataset? | <p>I am working on a project where I have to train the following data-set using machine learning algorithm. One of my friend suggested decision tree, but I have never seen a situation where independent variable has more than 100 values in decision tree. I need help for choosing algorithm. Dataset is custom made and sma... | algorithms machine learning decision tree | 1 | What machine learning training algorithm to use for this kind of string dataset? -- (algorithms machine learning decision tree)
<p>I am working on a project where I have to train the following data-set using machine learning algorithm. One of my friend suggested decision tree, but I have never seen a situation where in... | habedi/stack-exchange-dataset |
90,397 | Is there a name for this tree traversal? | <p>This came when I was looking at block scoping in compiler design.</p>

<pre><code>{ A { B } { C {D} {E} } }
</code></pre>

<p>For the above pseudo code, the order in which the scope varies as we scan left to right is A B A C D C E C A, where A to E represent scopes.</p>

<p>A pars... | trees compilers parsers | 1 | Is there a name for this tree traversal? -- (trees compilers parsers)
<p>This came when I was looking at block scoping in compiler design.</p>

<pre><code>{ A { B } { C {D} {E} } }
</code></pre>

<p>For the above pseudo code, the order in which the scope varies as we scan left to right is A ... | habedi/stack-exchange-dataset |
90,413 | Bias or not when finding patterns using data mining techniques? | <p>I am currently following a course on Data Mining and i am very curious about the deeper underlying method. As far as i have learned so far data mining is about finding unknown patterns that can be useful and provide new knowledge about your data.</p>

<p>In data mining, is it okay to start from expectations ... | machine learning data mining big data | 1 | Bias or not when finding patterns using data mining techniques? -- (machine learning data mining big data)
<p>I am currently following a course on Data Mining and i am very curious about the deeper underlying method. As far as i have learned so far data mining is about finding unknown patterns that can be useful and pr... | habedi/stack-exchange-dataset |
90,415 | Can we define a program by means of a walk of a graph induced by the category of types? | <p>After reading about Category Theory at <a href="https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/" rel="nofollow noreferrer">https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/</a> I was wondering whether we can represent any program by means of a wal... | functional programming category theory haskell | 1 | Can we define a program by means of a walk of a graph induced by the category of types? -- (functional programming category theory haskell)
<p>After reading about Category Theory at <a href="https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/" rel="nofollow noreferrer">https://bartoszmil... | habedi/stack-exchange-dataset |
90,423 | Transforming undirected maximum spanning tree into directed augmented network | <p>I am having trouble transforming a maximum weighted spanning tree into a directed tree such that each node is allowed at most one parent node. Taken from page 141 <a href="http://www.cs.technion.ac.il/~dang/journal_papers/friedman1997Bayesian.pdf" rel="nofollow noreferrer">Friedman et. al (1997)</a>, the outline of ... | spanning trees graphical models bayesian network | 1 | Transforming undirected maximum spanning tree into directed augmented network -- (spanning trees graphical models bayesian network)
<p>I am having trouble transforming a maximum weighted spanning tree into a directed tree such that each node is allowed at most one parent node. Taken from page 141 <a href="http://www.cs... | habedi/stack-exchange-dataset |
90,424 | Why does this recurrence give O(n) time? | <p>Given this following recurrence: $$T(n) = T(n/2) + O(n)$$Find the final time complexity.</p>

<p>My first thought is $O(n\log n)$, since there is at most $\log n$ times the 
$O(n)$ will appear. </p>

<p>However, if we adopt the following analysis and let $n=2^m$, then we have:</p>

<p>$$... | algorithms algorithm analysis | 1 | Why does this recurrence give O(n) time? -- (algorithms algorithm analysis)
<p>Given this following recurrence: $$T(n) = T(n/2) + O(n)$$Find the final time complexity.</p>

<p>My first thought is $O(n\log n)$, since there is at most $\log n$ times the 
$O(n)$ will appear. </p>

<p>However, if we ad... | habedi/stack-exchange-dataset |
90,426 | Complexity Sorting a finite set of numbers from 0,..,N | <p>I have a set of elements $x_1,...,x_N$, they take values $x_i \in \{0,...,N\} $ for all $i \in \{1,...,N\}$; I need to sort them. I think I can do that with complexity $\mathcal{O}(N)$, where I can create a matrix of $N\times N+1$ where the colomns represent the sorted values of the range, i.e., $\{0,1,2,...,N\}$, ... | algorithm analysis time complexity | 1 | Complexity Sorting a finite set of numbers from 0,..,N -- (algorithm analysis time complexity)
<p>I have a set of elements $x_1,...,x_N$, they take values $x_i \in \{0,...,N\} $ for all $i \in \{1,...,N\}$; I need to sort them. I think I can do that with complexity $\mathcal{O}(N)$, where I can create a matrix of $N\t... | habedi/stack-exchange-dataset |
90,433 | Kolmogorov complexity of prefixes of computable sequences | <blockquote>
<p>Let the characteristic sequence of a set <span class="math-container">$A ⊆ \mathbb{Z^+}$</span> be the following infinite binary sequence:</p>
<p><span class="math-container">$$χ_A = b_1b_2b_3\ldots,$$</span></p>
<p>whose <span class="math-container">$n$</span><sup>th</sup> bit is 1 if <span... | kolmogorov complexity | 1 | Kolmogorov complexity of prefixes of computable sequences -- (kolmogorov complexity)
<blockquote>
<p>Let the characteristic sequence of a set <span class="math-container">$A ⊆ \mathbb{Z^+}$</span> be the following infinite binary sequence:</p>
<p><span class="math-container">$$χ_A = b_1b_2b_3\ldots,$$</span></p... | habedi/stack-exchange-dataset |
90,435 | A cache memory has a line size of eight 64-bit words and a capacity of 4K words | <p>A cache memory has a line size of eight 64-bit words and a capacity of 4K words. The main memory size that is cacheable is 1024 Mbits. Assuming that the addressing is done at the byte level, show the format of main memory addresses using 8-way set-associative mapping. </p>

<p>So here's what I have underst... | computer architecture cpu cache | 1 | A cache memory has a line size of eight 64-bit words and a capacity of 4K words -- (computer architecture cpu cache)
<p>A cache memory has a line size of eight 64-bit words and a capacity of 4K words. The main memory size that is cacheable is 1024 Mbits. Assuming that the addressing is done at the byte level, show th... | habedi/stack-exchange-dataset |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.