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
97,805
Can a safe state in Banker's Algorithm cause deadlock eventually?
<p>I know that unsafe state does not always mean deadlock. That is a situation that banker's algorithm does not detect deadlock accurately. I am just wondering if there is any example of a safe state that deadlocks?</p>&#xA;
operating systems deadlocks
1
Can a safe state in Banker's Algorithm cause deadlock eventually? -- (operating systems deadlocks) <p>I know that unsafe state does not always mean deadlock. That is a situation that banker's algorithm does not detect deadlock accurately. I am just wondering if there is any example of a safe state that deadlocks?</p>&#...
habedi/stack-exchange-dataset
97,808
How to determine whether a dependent type that doesn't fit the monad instance is categorically a monad
<p><sup>[Using Idris syntax and terminology, but the question is not about Idris]</sup></p>&#xA;&#xA;<p>If a monad interface (or type class) has a constraint requiring applicative functor, a monad instance can be written by implementing either bind: <code>(&gt;&gt;=) : Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b</c...
dependent types category theory
1
How to determine whether a dependent type that doesn't fit the monad instance is categorically a monad -- (dependent types category theory) <p><sup>[Using Idris syntax and terminology, but the question is not about Idris]</sup></p>&#xA;&#xA;<p>If a monad interface (or type class) has a constraint requiring applicative ...
habedi/stack-exchange-dataset
97,810
Finding a strong loop invariant
<p>Pseudocode:</p>&#xA;&#xA;<pre><code>if n &lt; 2&#xA; return false&#xA;while n != 1&#xA; if n % 2 != 0&#xA; return false&#xA; n = n/2&#xA;return true&#xA;</code></pre>&#xA;&#xA;<p>The loop will terminate when n is odd. If n = 1, true is returned and that means that n0 was a power of 2. Otherwise it's ...
loop invariants
1
Finding a strong loop invariant -- (loop invariants) <p>Pseudocode:</p>&#xA;&#xA;<pre><code>if n &lt; 2&#xA; return false&#xA;while n != 1&#xA; if n % 2 != 0&#xA; return false&#xA; n = n/2&#xA;return true&#xA;</code></pre>&#xA;&#xA;<p>The loop will terminate when n is odd. If n = 1, true is returned and...
habedi/stack-exchange-dataset
97,812
Proving Monotonicity of Softmax Layer
<p>In the book here: <a href="http://neuralnetworksanddeeplearning.com/chap3.html" rel="nofollow noreferrer">http://neuralnetworksanddeeplearning.com/chap3.html</a></p>&#xA;&#xA;<p>If you scroll down to Exercise 2 in the Softmax Section, it says</p>&#xA;&#xA;<blockquote>&#xA; <p>Show that <span class="math-container">...
artificial intelligence neural networks
1
Proving Monotonicity of Softmax Layer -- (artificial intelligence neural networks) <p>In the book here: <a href="http://neuralnetworksanddeeplearning.com/chap3.html" rel="nofollow noreferrer">http://neuralnetworksanddeeplearning.com/chap3.html</a></p>&#xA;&#xA;<p>If you scroll down to Exercise 2 in the Softmax Section,...
habedi/stack-exchange-dataset
97,822
is the alignment between two sequences of points with 'no cross line' constraint an NP problem?
<p>Given two sequences of points(i.e. ordered points), connect the points in seq_A with the points in seq_B according to some rules. A point could be connected to 0, 1, or many points in the other sequence. But there should not be any line crossing. And each line could be assigned with a weight(controlled by relation b...
algorithms graphs algorithm analysis
1
is the alignment between two sequences of points with 'no cross line' constraint an NP problem? -- (algorithms graphs algorithm analysis) <p>Given two sequences of points(i.e. ordered points), connect the points in seq_A with the points in seq_B according to some rules. A point could be connected to 0, 1, or many point...
habedi/stack-exchange-dataset
97,836
About the relationship between non-termination and inconsistency?
<p>I've been trying to get into Agda and I noticed that it doesn't have recursion, which implies that it isn't <em>Turing-Complete</em>.</p>&#xA;&#xA;<p>From what I could understand, <strong>if</strong> Agda had <em>recursion</em>, it would make itself an <em>inconsistency</em> from a type theory perspective.</p>&#xA;&...
formal languages functional programming
1
About the relationship between non-termination and inconsistency? -- (formal languages functional programming) <p>I've been trying to get into Agda and I noticed that it doesn't have recursion, which implies that it isn't <em>Turing-Complete</em>.</p>&#xA;&#xA;<p>From what I could understand, <strong>if</strong> Agda h...
habedi/stack-exchange-dataset
97,842
is a deterministic algorithm for breadth-first traversal possible (binary heap)
<p>Imagine I have a binary heap, traversed in a breadth first manner like so:</p>&#xA;&#xA;<pre><code> 0&#xA; 1 | 2&#xA; 3 | 4 | 5 | 6&#xA;7 | 8 | 9 | 10 | 11 | 12 | 13 | 14&#xA;</code></pre>&#xA;&#xA;<p>To the left of root (0) is 1, to the right is...
binary trees
1
is a deterministic algorithm for breadth-first traversal possible (binary heap) -- (binary trees) <p>Imagine I have a binary heap, traversed in a breadth first manner like so:</p>&#xA;&#xA;<pre><code> 0&#xA; 1 | 2&#xA; 3 | 4 | 5 | 6&#xA;7 | 8 | 9 | 10 ...
habedi/stack-exchange-dataset
97,850
Why does this greedy algorithm fail to accurately determine whether a graph is a perfect matching?
<p>I came across this problem in <em>Tim Roughgarden</em>'s course on <em>Coursera</em>:</p>&#xA;&#xA;<blockquote>&#xA; <p>In this problem you are given as input a graph <span class="math-container">$T=(V,E)$</span> that is a&#xA; tree (that is, <span class="math-container">$T$</span> is undirected, connected, and ac...
algorithms graphs greedy algorithms matching
1
Why does this greedy algorithm fail to accurately determine whether a graph is a perfect matching? -- (algorithms graphs greedy algorithms matching) <p>I came across this problem in <em>Tim Roughgarden</em>'s course on <em>Coursera</em>:</p>&#xA;&#xA;<blockquote>&#xA; <p>In this problem you are given as input a graph ...
habedi/stack-exchange-dataset
97,851
Writing pseudocode to be language independent
<p>There exist 5 rules for any pseudocode , one of these rules is :&#xA;"Keep statements language independent" &#xA;I don't understand what is this rule is saying. So can someone explain it and then give an example of pseudocode written to be language independent ?&#xA;Moreover, the source for this rule is "Invitation ...
pseudocode
1
Writing pseudocode to be language independent -- (pseudocode) <p>There exist 5 rules for any pseudocode , one of these rules is :&#xA;"Keep statements language independent" &#xA;I don't understand what is this rule is saying. So can someone explain it and then give an example of pseudocode written to be language indepe...
habedi/stack-exchange-dataset
97,861
How pictures and videos are usually loaded in Memory?
<p>Lets assume I'm talking about Jpeg and Mp4 and a general video player(not sure if different ones load it differently, if they do please tell)</p>&#xA;&#xA;<p>So do video players (process) usually load the entire Jpeg or Mp4 including metadata into its own memory space right? like lets say we have a 1920x1080 pictur...
operating systems memory management virtual memory security filesystems
1
How pictures and videos are usually loaded in Memory? -- (operating systems memory management virtual memory security filesystems) <p>Lets assume I'm talking about Jpeg and Mp4 and a general video player(not sure if different ones load it differently, if they do please tell)</p>&#xA;&#xA;<p>So do video players (process...
habedi/stack-exchange-dataset
97,863
How does the problem of "Scheduling to Minimize Lateness" exhibit optimal substructure?
<p>The problem of &quot;Scheduling to Minimize Lateness&quot; is as follows (Section 4.2 of the book &quot;Algorithm Design&quot; by Jon Kleinberg and Eva Tardos):</p>&#xA;<blockquote>&#xA;<p><em><strong>Input:</strong></em> A finite set <span class="math-container">$J = {J_1, J_2, \ldots, J_n}$</span> of <span class="...
algorithms optimization dynamic programming scheduling
1
How does the problem of "Scheduling to Minimize Lateness" exhibit optimal substructure? -- (algorithms optimization dynamic programming scheduling) <p>The problem of &quot;Scheduling to Minimize Lateness&quot; is as follows (Section 4.2 of the book &quot;Algorithm Design&quot; by Jon Kleinberg and Eva Tardos):</p>&#xA;...
habedi/stack-exchange-dataset
97,869
Karp hardness of digraph coloring without monochromatic dicycle
<p>Problem statement:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Input</strong>: a digraph <span class="math-container">$G(V, A)$</span> and a natural number <span class="math-container">$k$</span></p>&#xA; &#xA; <p><strong>Output</strong>: <strong>YES</strong> if it is possible to color all vertices of <span class="...
np complete np hard np
1
Karp hardness of digraph coloring without monochromatic dicycle -- (np complete np hard np) <p>Problem statement:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>Input</strong>: a digraph <span class="math-container">$G(V, A)$</span> and a natural number <span class="math-container">$k$</span></p>&#xA; &#xA; <p><strong>Ou...
habedi/stack-exchange-dataset
97,873
Understanding NFA (nondeterministic finite automaton) with a null transition
<p><a href="https://i.stack.imgur.com/MFTDY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MFTDY.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>I'm reading <a href="https://introcs.cs.princeton.edu/" rel="nofollow noreferrer">Computer Science: An Interdisciplinary Approach</a>. It ment...
automata finite automata
1
Understanding NFA (nondeterministic finite automaton) with a null transition -- (automata finite automata) <p><a href="https://i.stack.imgur.com/MFTDY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MFTDY.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>I'm reading <a href="https://introc...
habedi/stack-exchange-dataset
97,879
SAT for positive CNF clauses with exactly half of the variables being true
<p>I am focusing here on <em>positive even SAT</em> problems, that is a CNF for which all literals are positive, and in which an even number <em>n</em> of variables occur. This is obviously trivial : just set all variables to true and all clauses are satisfied. The same if we look for an assignment that would have all...
complexity theory satisfiability
1
SAT for positive CNF clauses with exactly half of the variables being true -- (complexity theory satisfiability) <p>I am focusing here on <em>positive even SAT</em> problems, that is a CNF for which all literals are positive, and in which an even number <em>n</em> of variables occur. This is obviously trivial : just s...
habedi/stack-exchange-dataset
97,883
is this language regular and why pumping lemma doesn't work?
<p>I was told that this language is regular but as I can show below, pumping lemma is not working for it. What am I doing wrong? Is this language really regular? Why?&#xA;<a href="https://i.stack.imgur.com/55iuY.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/55iuY.png" alt="enter image description h...
formal languages regular languages pumping lemma
1
is this language regular and why pumping lemma doesn't work? -- (formal languages regular languages pumping lemma) <p>I was told that this language is regular but as I can show below, pumping lemma is not working for it. What am I doing wrong? Is this language really regular? Why?&#xA;<a href="https://i.stack.imgur.com...
habedi/stack-exchange-dataset
97,891
Why some Huffman codes have efficiency better than others?
<p>Consider the alphabet <span class="math-container">$\mathcal{A}=\{a_0,a_1,a_2,a_3\}$</span> with the the following corresponding probabilities:</p>&#xA;&#xA;<ol>&#xA;<li><span class="math-container">$\, p_{A,1}=\{0.5,0.3,0.15,0.05\}$</span></li>&#xA;<li><span class="math-container">$\, p_{A,2}=\{0.5,0.25,0.125,0.125...
huffman coding
1
Why some Huffman codes have efficiency better than others? -- (huffman coding) <p>Consider the alphabet <span class="math-container">$\mathcal{A}=\{a_0,a_1,a_2,a_3\}$</span> with the the following corresponding probabilities:</p>&#xA;&#xA;<ol>&#xA;<li><span class="math-container">$\, p_{A,1}=\{0.5,0.3,0.15,0.05\}$</spa...
habedi/stack-exchange-dataset
97,899
how to find a node that is known to everyone but doesn't know anyone?
<p>Problem I am trying to solve is this:</p>&#xA;&#xA;<p>There are n nodes, and for every pair of node <span class="math-container">$X$</span> and <span class="math-container">$Y$</span>, &#xA;the relation "<span class="math-container">$X \space knows \space Y$</span>" is either <span class="math-container">$T$</span>...
algorithms graphs
1
how to find a node that is known to everyone but doesn't know anyone? -- (algorithms graphs) <p>Problem I am trying to solve is this:</p>&#xA;&#xA;<p>There are n nodes, and for every pair of node <span class="math-container">$X$</span> and <span class="math-container">$Y$</span>, &#xA;the relation "<span class="math-co...
habedi/stack-exchange-dataset
97,901
Answering questions about the recurrence of certain aspects of an algorithm
<p>I am thoroughly confused by a problem that was brought up in class:</p>&#xA;&#xA;<p>Given the following pseudocode for a function RANDOM which generates a random number based off of recursion: </p>&#xA;&#xA;<pre><code>function RANDOM(n)&#xA;1. if n = 1 then&#xA;1.1 return 1&#xA;1.2 else&#xA;2.1 assign x = 0...
algorithms algorithm analysis recurrence relation recursion pseudocode
1
Answering questions about the recurrence of certain aspects of an algorithm -- (algorithms algorithm analysis recurrence relation recursion pseudocode) <p>I am thoroughly confused by a problem that was brought up in class:</p>&#xA;&#xA;<p>Given the following pseudocode for a function RANDOM which generates a random num...
habedi/stack-exchange-dataset
97,903
Chess Knight minimum moves to destination on an infinite board
<p>There are tones of solutions for Knights tour or shortest path for Knights movement from source cell to destination cell. most of the solutions are using BFS which seems the best algorithm. </p>&#xA;&#xA;<p>Here is my implementation using HashMap:</p>&#xA;&#xA;<pre><code> public class Knight_HashMap {&#xA;&#xA; ...
algorithms shortest path searching board games space analysis
1
Chess Knight minimum moves to destination on an infinite board -- (algorithms shortest path searching board games space analysis) <p>There are tones of solutions for Knights tour or shortest path for Knights movement from source cell to destination cell. most of the solutions are using BFS which seems the best algorith...
habedi/stack-exchange-dataset
97,905
Karp hardness of a guarding set in digraph
<p>Our problem is to decide whether a digraph has a <em>guarding set</em> of size at most <span class="math-container">$k$</span>. Definitions are following.</p>&#xA;&#xA;<p>A digraph <span class="math-container">$G(V,A)$</span> has <span class="math-container">$V(G)$</span> as its vertex set and <span class="math-cont...
complexity theory graphs np complete np hard np
1
Karp hardness of a guarding set in digraph -- (complexity theory graphs np complete np hard np) <p>Our problem is to decide whether a digraph has a <em>guarding set</em> of size at most <span class="math-container">$k$</span>. Definitions are following.</p>&#xA;&#xA;<p>A digraph <span class="math-container">$G(V,A)$</s...
habedi/stack-exchange-dataset
97,908
Maximum trailing zeros of the path
<p>Problems:</p>&#xA;&#xA;<p>A table with <span class="math-container">$n$</span> rows and <span class="math-container">$m$</span> columns is filled with number from <span class="math-container">$1$</span> to <span class="math-container">$100$</span> (duplication allowed). The player starts at <span class="math-contain...
dynamic programming number theory
1
Maximum trailing zeros of the path -- (dynamic programming number theory) <p>Problems:</p>&#xA;&#xA;<p>A table with <span class="math-container">$n$</span> rows and <span class="math-container">$m$</span> columns is filled with number from <span class="math-container">$1$</span> to <span class="math-container">$100$</s...
habedi/stack-exchange-dataset
97,914
Is Countable set always countable?
<p>Why some sets are countable and some are not countable? Say regular set are countable but how (0+1)* will be countable? It is an infinite string, then how it could be a countable set?&#xA;How the set of all non-decreasing functions from N to N are countable?&#xA;How the set of all finite partitions of N are uncounta...
automata
1
Is Countable set always countable? -- (automata) <p>Why some sets are countable and some are not countable? Say regular set are countable but how (0+1)* will be countable? It is an infinite string, then how it could be a countable set?&#xA;How the set of all non-decreasing functions from N to N are countable?&#xA;How t...
habedi/stack-exchange-dataset
97,919
Big-O with nested loops and "variables" in the T(n)
<p>So, I need to find the T(n) and then Big-O (tight upper bound) for the following piece of code:</p>&#xA;&#xA;<pre><code>int sum = 0;&#xA;for(int i = 1; i &lt; n; i *= 2) {&#xA; for(int j = n; j &gt; 0; j /= 2) {&#xA; for(int k = j; k &lt; n; k += 2) {&#xA; sum += i + j * k;&#xA; }&#xA; ...
time complexity asymptotics
1
Big-O with nested loops and "variables" in the T(n) -- (time complexity asymptotics) <p>So, I need to find the T(n) and then Big-O (tight upper bound) for the following piece of code:</p>&#xA;&#xA;<pre><code>int sum = 0;&#xA;for(int i = 1; i &lt; n; i *= 2) {&#xA; for(int j = n; j &gt; 0; j /= 2) {&#xA; for(i...
habedi/stack-exchange-dataset
97,921
Different iterations of regular expressions
<p>A four-part question dealing with formal languages and regular expressions: </p>&#xA;&#xA;<ol>&#xA;<li>How many <em>basic</em> regular expressions (using only the rules <strong>0</strong>/Ο΅, <strong>1</strong>/βˆ…, *, +, and β€’) are there to match a given string?</li>&#xA;<li>How many using just *, +, and β€’? </li>&#xA...
formal languages regular expressions combinatorics
1
Different iterations of regular expressions -- (formal languages regular expressions combinatorics) <p>A four-part question dealing with formal languages and regular expressions: </p>&#xA;&#xA;<ol>&#xA;<li>How many <em>basic</em> regular expressions (using only the rules <strong>0</strong>/Ο΅, <strong>1</strong>/βˆ…, *, +...
habedi/stack-exchange-dataset
97,930
Probability of randomly designated subsets cover the universe
<p>Let <span class="math-container">$U=\{1,2,\ldots,n\}$</span> and <span class="math-container">$S \subseteq \mathscr{P}(U)$</span>. Let <span class="math-container">$T$</span> be a subset of <span class="math-container">$S$</span>, randomly constructed selecting independently each element of <span class="math-contain...
algorithms probability theory discrete mathematics polynomial time set cover
1
Probability of randomly designated subsets cover the universe -- (algorithms probability theory discrete mathematics polynomial time set cover) <p>Let <span class="math-container">$U=\{1,2,\ldots,n\}$</span> and <span class="math-container">$S \subseteq \mathscr{P}(U)$</span>. Let <span class="math-container">$T$</span...
habedi/stack-exchange-dataset
97,939
Big O Notation Simplification in the fraction form
<p>How should I approach this one a(n) = <span class="math-container">$\frac{n^3}{log^{3}(n)}$</span>. As We can tell that <span class="math-container">$n^3$</span> grow much faster than <span class="math-container">$log^{3}(3)$</span>. All of sudden, not sure what to do, found this [post][1], which is also in the fra...
asymptotics
1
Big O Notation Simplification in the fraction form -- (asymptotics) <p>How should I approach this one a(n) = <span class="math-container">$\frac{n^3}{log^{3}(n)}$</span>. As We can tell that <span class="math-container">$n^3$</span> grow much faster than <span class="math-container">$log^{3}(3)$</span>. All of sudden,...
habedi/stack-exchange-dataset
97,947
Can interval partition solve by sort by different approach
<blockquote>&#xA; <p>The interval partitioning problem is described as follows: Given a set&#xA; {1, 2, …, n} of n requests, where ith request starts at time s(i) and&#xA; finishes at time f(i), find the minimum number of resources needed to&#xA; schedule all requests so that no two requests are assigned to the sam...
partitions
1
Can interval partition solve by sort by different approach -- (partitions) <blockquote>&#xA; <p>The interval partitioning problem is described as follows: Given a set&#xA; {1, 2, …, n} of n requests, where ith request starts at time s(i) and&#xA; finishes at time f(i), find the minimum number of resources needed to&...
habedi/stack-exchange-dataset
97,950
How to define (logically) the complement language?
<p>I found it a little bit difficult and confusing to define the complement language in specific cases. For example, take the next language: </p>&#xA;&#xA;<p><span class="math-container">$$L = \left\{\langle M, w\rangle \;\middle|\; \begin{array}{l}M \text{ is a Non-Deterministic TM,}\\ \text{and it has an accepting ru...
turing machines computability reductions logic
1
How to define (logically) the complement language? -- (turing machines computability reductions logic) <p>I found it a little bit difficult and confusing to define the complement language in specific cases. For example, take the next language: </p>&#xA;&#xA;<p><span class="math-container">$$L = \left\{\langle M, w\rang...
habedi/stack-exchange-dataset
97,951
Why can't hash coding be reversed?
<p>Why is it impossible to reverse a hash code? There could be some way to crack this coding? </p>&#xA;
hash one way functions
1
Why can't hash coding be reversed? -- (hash one way functions) <p>Why is it impossible to reverse a hash code? There could be some way to crack this coding? </p>&#xA;
habedi/stack-exchange-dataset
97,955
Karp hardness of a vector system allocation
<p>Given an <strong>undirected</strong> graph <span class="math-container">$G(V,E)$</span>, a <strong>vector system</strong> is a set <span class="math-container">$S$</span> of ordered pair (intuitively called <strong>vector</strong>) <span class="math-container">$(u,v)$</span> (we shall call <span class="math-containe...
complexity theory graphs np complete np hard np
1
Karp hardness of a vector system allocation -- (complexity theory graphs np complete np hard np) <p>Given an <strong>undirected</strong> graph <span class="math-container">$G(V,E)$</span>, a <strong>vector system</strong> is a set <span class="math-container">$S$</span> of ordered pair (intuitively called <strong>vecto...
habedi/stack-exchange-dataset
97,963
What is an infinite language?
<p>I just started reading about formal language theory and what i have learnt so far that:</p>&#xA;&#xA;<p><strong>Alphabet</strong> is a finite set of symbols.</p>&#xA;&#xA;<p><strong>String/Word:</strong> is always finite.</p>&#xA;&#xA;<p>Because a language is set of strings of symbols and per definition alphabet and...
formal languages regular languages
1
What is an infinite language? -- (formal languages regular languages) <p>I just started reading about formal language theory and what i have learnt so far that:</p>&#xA;&#xA;<p><strong>Alphabet</strong> is a finite set of symbols.</p>&#xA;&#xA;<p><strong>String/Word:</strong> is always finite.</p>&#xA;&#xA;<p>Because a...
habedi/stack-exchange-dataset
97,968
What is the correct time complexity of the following code
<p>I was wondering what is the correct time complexity expressed in terms of big O on this type of loop:</p>&#xA;&#xA;<pre><code>for(i=1;i&lt;=n;i++)&#xA; for(int j=1;j*i&lt;=n;j++)&#xA; // O(1) code here&#xA;</code></pre>&#xA;&#xA;<p>The inner loops will make <span class="math-container">$n + \frac{n}{2} + \...
time complexity
1
What is the correct time complexity of the following code -- (time complexity) <p>I was wondering what is the correct time complexity expressed in terms of big O on this type of loop:</p>&#xA;&#xA;<pre><code>for(i=1;i&lt;=n;i++)&#xA; for(int j=1;j*i&lt;=n;j++)&#xA; // O(1) code here&#xA;</code></pre>&#xA;&#xA...
habedi/stack-exchange-dataset
97,972
Show that $T(2^n) = \Theta(3^n)$
<p>We have a function <span class="math-container">$T(n)$</span> defined by <span class="math-container">$T(1) =1$</span> and <span class="math-container">$T(n)=3T(\lfloor n/2\rfloor)+n$</span> for <span class="math-container">$n &gt; 1$</span>. We need to show that <span class="math-container">$T(2^n)=\Theta (3^n)$</...
asymptotics recurrence relation
1
Show that $T(2^n) = \Theta(3^n)$ -- (asymptotics recurrence relation) <p>We have a function <span class="math-container">$T(n)$</span> defined by <span class="math-container">$T(1) =1$</span> and <span class="math-container">$T(n)=3T(\lfloor n/2\rfloor)+n$</span> for <span class="math-container">$n &gt; 1$</span>. We n...
habedi/stack-exchange-dataset
97,974
A question about linked list
<p>I would like to check the answer of this exercise:</p>&#xA;&#xA;<p><em>A circular doubled linked list with N elements has pointers that cost <strong>k</strong> bytes each of space in memory. How many bytes do the pointers of this list cost in total?</em></p>&#xA;&#xA;<p>Researching about circular linked lists, i can...
algorithms data structures linked lists
1
A question about linked list -- (algorithms data structures linked lists) <p>I would like to check the answer of this exercise:</p>&#xA;&#xA;<p><em>A circular doubled linked list with N elements has pointers that cost <strong>k</strong> bytes each of space in memory. How many bytes do the pointers of this list cost in ...
habedi/stack-exchange-dataset
97,975
How many rotations after AVL insertion and deletion
<p>Is it true that inserting an element to an AVL tree requires <span class="math-container">$O(1)$</span> rotations?</p>&#xA;&#xA;<p>How many rotations, does deletion from AVL require?</p>&#xA;&#xA;<p>I've searched for these two questions with no luck so far.</p>&#xA;
algorithm analysis data structures runtime analysis search trees balanced search trees
1
How many rotations after AVL insertion and deletion -- (algorithm analysis data structures runtime analysis search trees balanced search trees) <p>Is it true that inserting an element to an AVL tree requires <span class="math-container">$O(1)$</span> rotations?</p>&#xA;&#xA;<p>How many rotations, does deletion from AVL...
habedi/stack-exchange-dataset
97,980
Steps to create a heuristic for solving a problem
<p>I am completely new to AI and doing self-learning to acquire this knowledge.&#xA;I went through the different available search algorithm like BFS, DFS and A* but something that I can't understand is a heuristic function that needs to be embedded in these algorithms. I am fine with algorithms but I don't know how we ...
algorithms artificial intelligence heuristics search
1
Steps to create a heuristic for solving a problem -- (algorithms artificial intelligence heuristics search) <p>I am completely new to AI and doing self-learning to acquire this knowledge.&#xA;I went through the different available search algorithm like BFS, DFS and A* but something that I can't understand is a heuristi...
habedi/stack-exchange-dataset
97,987
Complexity of Problems and Ease of Verification
<p>Comparison-based sorting algorithms have a minimum worst-case complexity of <span class="math-container">$O(n \log n)$</span>, while it is easy to check that an array is sorted in <span class="math-container">$O(n)$</span> time.</p>&#xA;&#xA;<p>Are there other problems with proven minimum complexity <span class="mat...
algorithms complexity theory
1
Complexity of Problems and Ease of Verification -- (algorithms complexity theory) <p>Comparison-based sorting algorithms have a minimum worst-case complexity of <span class="math-container">$O(n \log n)$</span>, while it is easy to check that an array is sorted in <span class="math-container">$O(n)$</span> time.</p>&#x...
habedi/stack-exchange-dataset
97,988
optimal testing strategy
<p>Here I have a problem in understanding the <code>optimal testing strategy</code>.</p>&#xA;&#xA;<p>In a scenario, You have been given two laptop batteries and a testing device. The testing device will make the battery connected to it (one battery can be connected at a time) deliver <code>x mA</code>, where <code>x</c...
software testing testing
1
optimal testing strategy -- (software testing testing) <p>Here I have a problem in understanding the <code>optimal testing strategy</code>.</p>&#xA;&#xA;<p>In a scenario, You have been given two laptop batteries and a testing device. The testing device will make the battery connected to it (one battery can be connected...
habedi/stack-exchange-dataset
97,992
Karp hardness of testing for homomorphisms to a fixed non-bipartite graph
<p><strong>Description</strong>: Suppose that we are given a <em>fixed</em> <strong>non-bipartite</strong> graph <span class="math-container">$H$</span>. A graph <span class="math-container">$G$</span> is <em>loopless surjectively homomorphic</em> to <span class="math-container">$H$</span> if there exists a <strong>loo...
np complete np hard np
1
Karp hardness of testing for homomorphisms to a fixed non-bipartite graph -- (np complete np hard np) <p><strong>Description</strong>: Suppose that we are given a <em>fixed</em> <strong>non-bipartite</strong> graph <span class="math-container">$H$</span>. A graph <span class="math-container">$G$</span> is <em>loopless ...
habedi/stack-exchange-dataset
97,998
Strassen's matrix multiplication algorithm when $n$ is not a power of 2
<p><a href="https://i.stack.imgur.com/USQmT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/USQmT.jpg" alt="Square-Matrix-Multiply-Recursive"></a></p>&#xA;&#xA;<p>The above image, describing Strassen's matrix multiplication algorithm, is from the book Introduction to Algorithms by Cormen, Leiserson, ...
matrix
1
Strassen's matrix multiplication algorithm when $n$ is not a power of 2 -- (matrix) <p><a href="https://i.stack.imgur.com/USQmT.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/USQmT.jpg" alt="Square-Matrix-Multiply-Recursive"></a></p>&#xA;&#xA;<p>The above image, describing Strassen's matrix multipli...
habedi/stack-exchange-dataset
98,014
Any finite Graph G with all V have at least degree of 2, is it true that every vertex is necessarily contained IN a cycle?
<p>As title, (note: this questions is asking weather or not all vertices are contained IN a cycle not asking if the G contains a cycle.</p>&#xA;<p>My attempt is that:&#xA;<a href="https://i.stack.imgur.com/WjL4u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/WjL4u.jpg" alt="enter image description h...
proof techniques correctness proof check my answer
1
Any finite Graph G with all V have at least degree of 2, is it true that every vertex is necessarily contained IN a cycle? -- (proof techniques correctness proof check my answer) <p>As title, (note: this questions is asking weather or not all vertices are contained IN a cycle not asking if the G contains a cycle.</p>&#...
habedi/stack-exchange-dataset
98,019
In Breadth-first search and depth-first search what is the purpose of visited flag
<p>In Breadth-first search and depth-first search, in this source code <a href="https://gist.github.com/gennad/791932" rel="nofollow noreferrer">https://gist.github.com/gennad/791932</a></p>&#xA;&#xA;<pre><code>public void bfs()&#xA; {&#xA; // BFS uses Queue data structure&#xA; Queue queue = new Linked...
data structures trees
1
In Breadth-first search and depth-first search what is the purpose of visited flag -- (data structures trees) <p>In Breadth-first search and depth-first search, in this source code <a href="https://gist.github.com/gennad/791932" rel="nofollow noreferrer">https://gist.github.com/gennad/791932</a></p>&#xA;&#xA;<pre><code...
habedi/stack-exchange-dataset
98,024
Time and space complexity of Radix sort
<p>I had previously asked a question on space complexity of radix sort <a href="https://stackoverflow.com/questions/44477979/why-does-radix-sort-have-a-space-complexity-of-ok-n">here</a>. I have also read <a href="https://cs.stackexchange.com/questions/5030/why-is-radix-sort-on/6077#6077">this</a> question. However, I ...
algorithms time complexity space complexity radix sort
1
Time and space complexity of Radix sort -- (algorithms time complexity space complexity radix sort) <p>I had previously asked a question on space complexity of radix sort <a href="https://stackoverflow.com/questions/44477979/why-does-radix-sort-have-a-space-complexity-of-ok-n">here</a>. I have also read <a href="https:...
habedi/stack-exchange-dataset
98,029
Time Complexity of the Kruskal Algorithm after sorting
<p>In case I have sorted edges already, What is the best time complexity of Kruskal Algorithm?</p>&#xA;
graphs time complexity trees minimum spanning tree
1
Time Complexity of the Kruskal Algorithm after sorting -- (graphs time complexity trees minimum spanning tree) <p>In case I have sorted edges already, What is the best time complexity of Kruskal Algorithm?</p>&#xA;
habedi/stack-exchange-dataset
98,037
Is it true that NEXP = EXP when the input binary strings have size O(n)?
<p>I have a question about this. Because if the input binary strings have size of O(n), it takes exponential time to list all possibilities of it. If an language is in NEXP, then we can list all input possible input strings and then use exponential time to check each one, which is still in exponential time in total. It...
complexity theory time complexity
1
Is it true that NEXP = EXP when the input binary strings have size O(n)? -- (complexity theory time complexity) <p>I have a question about this. Because if the input binary strings have size of O(n), it takes exponential time to list all possibilities of it. If an language is in NEXP, then we can list all input possibl...
habedi/stack-exchange-dataset
98,039
Existence of polynomial time reduction from P to R?
<p>Why the next idea doesn't work:</p>&#xA;&#xA;<pre><code>If L_2 in R and L_1 in P and the languages are not trivial, &#xA;then there is a polynomial-time reduction from L_1 to L_2&#xA;</code></pre>&#xA;&#xA;<p>I know that if such reduction exists, than L_1 is also in R --> But L_1 is in P and P is in R, so everything...
complexity theory computability time complexity reductions polynomial time
1
Existence of polynomial time reduction from P to R? -- (complexity theory computability time complexity reductions polynomial time) <p>Why the next idea doesn't work:</p>&#xA;&#xA;<pre><code>If L_2 in R and L_1 in P and the languages are not trivial, &#xA;then there is a polynomial-time reduction from L_1 to L_2&#xA;</...
habedi/stack-exchange-dataset
98,050
Does using micro-operations require a higher clock rate than listed
<p>Say we have a modern (Skylake, say) Intel CPU running at a fixed 5GHz clock rate. Since Intel CPUs run micro-operations internally and reaches > 1 instructions per cycle, it needs to be able to run more than one micro-operation per cycle. But from how registers work we know that new data can only be stored and compu...
computer architecture cpu
1
Does using micro-operations require a higher clock rate than listed -- (computer architecture cpu) <p>Say we have a modern (Skylake, say) Intel CPU running at a fixed 5GHz clock rate. Since Intel CPUs run micro-operations internally and reaches > 1 instructions per cycle, it needs to be able to run more than one micro-...
habedi/stack-exchange-dataset
98,052
On the proof of NP-Hardness of the Cardinality Constrained Quadratic Knapsack Problem
<p>in <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.105.9998&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Polyhedral Study of the Cardinality Constrained Knapsack Problem</a> the authors prove that the Cardinality Constrained Knapsack Problem is NP-Hard by reducing PARTITION to it.</p>&#xA;&...
complexity theory optimization np complete reductions np hard
1
On the proof of NP-Hardness of the Cardinality Constrained Quadratic Knapsack Problem -- (complexity theory optimization np complete reductions np hard) <p>in <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.105.9998&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Polyhedral Study of the Cardinali...
habedi/stack-exchange-dataset
98,053
Loop Invariant summation
<p>So I am stuck:</p>&#xA;&#xA;<p>I have this algorithm from which I need to find a loop invariant but I just can't get my head around it :</p>&#xA;&#xA;<pre><code>main_f = x&#xA;follow_up = x&#xA;while (follow_up &lt; y):&#xA; follow_up = follow_up + 1&#xA; main_f = main_f + follow_up&#xA;&#xA;return main_f&#xA;</...
algorithms loop invariants
1
Loop Invariant summation -- (algorithms loop invariants) <p>So I am stuck:</p>&#xA;&#xA;<p>I have this algorithm from which I need to find a loop invariant but I just can't get my head around it :</p>&#xA;&#xA;<pre><code>main_f = x&#xA;follow_up = x&#xA;while (follow_up &lt; y):&#xA; follow_up = follow_up + 1&#xA; ...
habedi/stack-exchange-dataset
98,055
How is this the expected number of of probes in open-address hashing?
<p>I am reading the "Introduction to Algorithms" by Thomas Cormen <em>et al</em>. Particularly the theorem which says that given an open-address hash table with load factor <span class="math-container">$\alpha = n/m &lt; 1$</span>, the expected number of probes in an unsuccessful search is at most <span class="math-con...
hash hashing
1
How is this the expected number of of probes in open-address hashing? -- (hash hashing) <p>I am reading the "Introduction to Algorithms" by Thomas Cormen <em>et al</em>. Particularly the theorem which says that given an open-address hash table with load factor <span class="math-container">$\alpha = n/m &lt; 1$</span>, ...
habedi/stack-exchange-dataset
98,069
Prove that every CFL has at least one infinite equivalence class
<p>If we define the Myhill-Nerode relation on a CFL how can i prove that there is at least one infinite equivalence class?</p>&#xA;
formal languages context free
1
Prove that every CFL has at least one infinite equivalence class -- (formal languages context free) <p>If we define the Myhill-Nerode relation on a CFL how can i prove that there is at least one infinite equivalence class?</p>&#xA;
habedi/stack-exchange-dataset
98,075
Aren’t most constraining variable and least constraining value the exact opposite?
<p>So aren’t MCV and LCV the exact opposite?MCV tries to choose the variable with the most constraints on&#xA;remaining variables but LCV is opposite: it tries to rule out as least values for other variables as possible</p>&#xA;
heuristics constraint satisfaction backtracking
1
Aren’t most constraining variable and least constraining value the exact opposite? -- (heuristics constraint satisfaction backtracking) <p>So aren’t MCV and LCV the exact opposite?MCV tries to choose the variable with the most constraints on&#xA;remaining variables but LCV is opposite: it tries to rule out as least val...
habedi/stack-exchange-dataset
98,088
Optimization Problem when calculating fitness is expensive
<p>I need to solve an optimization problem, maximizing fitness in a set of around 1 million solutions. Calculating the fitness of any solution is very time consuming, taking around 5 minutes. Therefore, I am only able to calculate the fitness of 100 solutions per run. Each solution is represented by vector in ten dimen...
optimization search algorithms heuristics
1
Optimization Problem when calculating fitness is expensive -- (optimization search algorithms heuristics) <p>I need to solve an optimization problem, maximizing fitness in a set of around 1 million solutions. Calculating the fitness of any solution is very time consuming, taking around 5 minutes. Therefore, I am only a...
habedi/stack-exchange-dataset
98,098
Image selection for Object detection
<p>I'm relatively new and am still learning the basics. I've used NVIDIA DIGITS in the past, and am now looking at Tensorflow. While I've been able to fumble my way around creating some models for a few projects I'm working on, I really want to start diving deeper into what I'm doing, how I'm doing it, and ultimately a...
computer vision
1
Image selection for Object detection -- (computer vision) <p>I'm relatively new and am still learning the basics. I've used NVIDIA DIGITS in the past, and am now looking at Tensorflow. While I've been able to fumble my way around creating some models for a few projects I'm working on, I really want to start diving deep...
habedi/stack-exchange-dataset
98,106
Are there problems that are DSPACE(O(1)) complete?
<p>I know there are problems that are NL-complete, NP-Complete, PSPACE-complete, etc. Are there problems that are DSPACE(O(1))-complete I.e. NSPACE(O(1))-Complete I.e. Reg-Complete?</p>&#xA;&#xA;<p>Thanks!</p>&#xA;
complexity theory finite automata p vs np
1
Are there problems that are DSPACE(O(1)) complete? -- (complexity theory finite automata p vs np) <p>I know there are problems that are NL-complete, NP-Complete, PSPACE-complete, etc. Are there problems that are DSPACE(O(1))-complete I.e. NSPACE(O(1))-Complete I.e. Reg-Complete?</p>&#xA;&#xA;<p>Thanks!</p>&#xA;
habedi/stack-exchange-dataset
98,107
Calculating a polynomial's coefficients from its roots
<p>Let <span class="math-container">$P$</span> be a monic polynomial polynomial given by its roots:&#xA;<span class="math-container">$$P(X) = (X-x_1)\times...\times(X-x_n)$$</span></p>&#xA;&#xA;<p>What is the minimum asymptotic complexity to compute its expansion of the form:&#xA;<span class="math-container">$$a_nX^n+....
algorithms complexity theory polynomials
1
Calculating a polynomial's coefficients from its roots -- (algorithms complexity theory polynomials) <p>Let <span class="math-container">$P$</span> be a monic polynomial polynomial given by its roots:&#xA;<span class="math-container">$$P(X) = (X-x_1)\times...\times(X-x_n)$$</span></p>&#xA;&#xA;<p>What is the minimum as...
habedi/stack-exchange-dataset
98,108
If $A,B$ are r.e. and $A\cup B,A \cap B$ are recursive, then so are $A,B$
<p>Let be <span class="math-container">$A, B \subset \mathbb{N}$</span> are recursively enumerable, <span class="math-container">$A\cup B$</span> and <span class="math-container">$A \cap B$</span> recursive. I want to show that <span class="math-container">$A$</span> and <span class="math-container">$B$</span> are recu...
computability
1
If $A,B$ are r.e. and $A\cup B,A \cap B$ are recursive, then so are $A,B$ -- (computability) <p>Let be <span class="math-container">$A, B \subset \mathbb{N}$</span> are recursively enumerable, <span class="math-container">$A\cup B$</span> and <span class="math-container">$A \cap B$</span> recursive. I want to show that...
habedi/stack-exchange-dataset
98,121
Minimum Number of Integers From a List that Add up to N (Dynamic Programming)
<p>A problem I'm working on requires me to find the minimum # of integers from a given list that add up to <span class="math-container">$N$</span>, or more specifically:</p>&#xA;&#xA;<blockquote>&#xA; <p>Given a list <span class="math-container">$L$</span> of <span class="math-container">$K$</span> integers, <span cla...
algorithms dynamic programming greedy algorithms
1
Minimum Number of Integers From a List that Add up to N (Dynamic Programming) -- (algorithms dynamic programming greedy algorithms) <p>A problem I'm working on requires me to find the minimum # of integers from a given list that add up to <span class="math-container">$N$</span>, or more specifically:</p>&#xA;&#xA;<bloc...
habedi/stack-exchange-dataset
98,134
Logarithmic run time for calculating prime numbers?
<p>Here's the function I'm currently analyzing. I know it's not the most optimal but I'm not understanding the <span class="math-container">$\theta()$</span> of this algorithm. I've been told that it's not actually <span class="math-container">$\theta(n)$</span> but instead a logarithmic run-time and it had something t...
runtime analysis primes
1
Logarithmic run time for calculating prime numbers? -- (runtime analysis primes) <p>Here's the function I'm currently analyzing. I know it's not the most optimal but I'm not understanding the <span class="math-container">$\theta()$</span> of this algorithm. I've been told that it's not actually <span class="math-contai...
habedi/stack-exchange-dataset
98,139
Are the definitions of recursively enumerate equivalent?
<p>There are a couple of definitions of <strong>recursively enumerable</strong>, for example in Judah: <em><span class="math-container">$A \subset \mathbb{N}$</span> is called r.e. if there exist a <span class="math-container">$\Sigma^0_1$</span> formula <span class="math-container">$\varphi(x)$</span> such that</em></...
computability terminology first order logic
1
Are the definitions of recursively enumerate equivalent? -- (computability terminology first order logic) <p>There are a couple of definitions of <strong>recursively enumerable</strong>, for example in Judah: <em><span class="math-container">$A \subset \mathbb{N}$</span> is called r.e. if there exist a <span class="mat...
habedi/stack-exchange-dataset
98,151
Prove that A** = A*, where A is a language over Ξ£*
<p>Let <span class="math-container">$\mathcal A$</span> be an arbitrary language over <span class="math-container">$\Sigma^*$</span></p>&#xA;&#xA;<p><strong>Proof.</strong></p>&#xA;&#xA;<p>To prove, <span class="math-container">$\mathcal A^{**} = \mathcal A^* $</span></p>&#xA;&#xA;<p><span class="math-container">$\math...
regular languages automata proof techniques
1
Prove that A** = A*, where A is a language over Ξ£* -- (regular languages automata proof techniques) <p>Let <span class="math-container">$\mathcal A$</span> be an arbitrary language over <span class="math-container">$\Sigma^*$</span></p>&#xA;&#xA;<p><strong>Proof.</strong></p>&#xA;&#xA;<p>To prove, <span class="math-con...
habedi/stack-exchange-dataset
98,152
Condition of square root algorithm (Newton's method)
<p>I am reading the book <em>Algorithm 4th</em> and see this square root algorithm using Newton's method (java sample code):</p>&#xA;&#xA;<pre><code>public static double sqrt(double c)&#xA;{&#xA; if (c &lt; 0) return Double.NaN;&#xA; double err = 1e-15;&#xA; double t = c;&#xA; while (Math.abs(t - c/t) &gt; ...
algorithms
1
Condition of square root algorithm (Newton's method) -- (algorithms) <p>I am reading the book <em>Algorithm 4th</em> and see this square root algorithm using Newton's method (java sample code):</p>&#xA;&#xA;<pre><code>public static double sqrt(double c)&#xA;{&#xA; if (c &lt; 0) return Double.NaN;&#xA; double err ...
habedi/stack-exchange-dataset
98,154
Measuring infinite loops
<p>Theoretically, is there a way to measure how many infinite loops are running at a given point in time? In other words, is there a way to freeze everything and get a number on how many infinite lines of code are running on every machine. </p>&#xA;
time complexity loops
1
Measuring infinite loops -- (time complexity loops) <p>Theoretically, is there a way to measure how many infinite loops are running at a given point in time? In other words, is there a way to freeze everything and get a number on how many infinite lines of code are running on every machine. </p>&#xA;
habedi/stack-exchange-dataset
98,156
Finding Euclidean Minimum Spanning Tree
<p>Given a set of point <span class="math-container">$P$</span>. Find the euclidean minimum spanning tree where each points is equally distributed on the plane using randomization.</p>&#xA;&#xA;<p>We can solve this problem with Prim's algorithm in <span class="math-container">$O(n^2)$</span> which is too slow. I've fou...
algorithms minimum spanning tree euclidean distance
1
Finding Euclidean Minimum Spanning Tree -- (algorithms minimum spanning tree euclidean distance) <p>Given a set of point <span class="math-container">$P$</span>. Find the euclidean minimum spanning tree where each points is equally distributed on the plane using randomization.</p>&#xA;&#xA;<p>We can solve this problem ...
habedi/stack-exchange-dataset
98,157
Manber's graph-partitioning implementation
<p>I'm having trouble understanding a part of Manber's graph-partitioning algorithm, presented in <em>A Text Compression Scheme that Allows Fast Searching Directly in the Compressed File</em>.</p>&#xA;&#xA;<p>Generally speaking he wants to divide vertices of a weighted, directed graph <span class="math-container">$G=(V...
graphs weighted graphs
1
Manber's graph-partitioning implementation -- (graphs weighted graphs) <p>I'm having trouble understanding a part of Manber's graph-partitioning algorithm, presented in <em>A Text Compression Scheme that Allows Fast Searching Directly in the Compressed File</em>.</p>&#xA;&#xA;<p>Generally speaking he wants to divide ve...
habedi/stack-exchange-dataset
98,169
Minimize sum of squares of rows in matrix when sum of columns have some constraint
<p>I'm looking for an algorithm that can find any matrix <span class="math-container">$a_{j,i}$</span> such that&#xA;<span class="math-container">$$&#xA; \sum_{i \in I} \left(\sum_{j\in J} a_{j,i}\right)^2&#xA;$$</span>&#xA;is minimal, while also for each <span class="math-container">$j\in J$</span> satisfying the con...
optimization linear algebra
1
Minimize sum of squares of rows in matrix when sum of columns have some constraint -- (optimization linear algebra) <p>I'm looking for an algorithm that can find any matrix <span class="math-container">$a_{j,i}$</span> such that&#xA;<span class="math-container">$$&#xA; \sum_{i \in I} \left(\sum_{j\in J} a_{j,i}\right)...
habedi/stack-exchange-dataset
98,170
On uniform randomness of the weight of the remaining edges of a graph after deleting some of them
<p>Suppose we have a graph <span class="math-container">$G(V,E,W)$</span>, where <span class="math-container">$V$</span> and <span class="math-container">$E$</span> are the set of vertices and edges and <span class="math-container">$W$</span> is non-negative weight on the edges. Let <span class="math-container">$w(e)$<...
algorithms graphs randomness
1
On uniform randomness of the weight of the remaining edges of a graph after deleting some of them -- (algorithms graphs randomness) <p>Suppose we have a graph <span class="math-container">$G(V,E,W)$</span>, where <span class="math-container">$V$</span> and <span class="math-container">$E$</span> are the set of vertices...
habedi/stack-exchange-dataset
98,177
How to Apply Elementary Axioms from Kleene Star to an Inequality
<h2>Axioms For *</h2>&#xA;&#xA;<p><span class="math-container">\begin{align}&#xA;1 + aa^* &amp;\leq a^* \\&#xA;1 + a^*a &amp;\leq a^* \\&#xA;b + ax &amp;\leq x \to a^*b \leq x \\&#xA;b + xa &amp;\leq x \to ba^* \leq x \\&#xA;\end{align}</span></p>&#xA;&#xA;<h2>Elementary Results</h2>&#xA;&#xA;<p><span class="math-conta...
proof techniques regular expressions check my answer kleene star algebra
1
How to Apply Elementary Axioms from Kleene Star to an Inequality -- (proof techniques regular expressions check my answer kleene star algebra) <h2>Axioms For *</h2>&#xA;&#xA;<p><span class="math-container">\begin{align}&#xA;1 + aa^* &amp;\leq a^* \\&#xA;1 + a^*a &amp;\leq a^* \\&#xA;b + ax &amp;\leq x \to a^*b \leq x \...
habedi/stack-exchange-dataset
98,179
Is the problem of determining whether a CFG generates a string in the form 0*1* decidable?
<p>Given a grammar <span class="math-container">$G$</span>, is it decidable whether <span class="math-container">$G$</span> generates any string in the form <span class="math-container">$0^*1^*$</span>? Why? </p>&#xA;&#xA;<p>I think it's undecidable but can't find any undecidable problem to reduce it to.</p>&#xA;
formal languages computability context free formal grammars
1
Is the problem of determining whether a CFG generates a string in the form 0*1* decidable? -- (formal languages computability context free formal grammars) <p>Given a grammar <span class="math-container">$G$</span>, is it decidable whether <span class="math-container">$G$</span> generates any string in the form <span c...
habedi/stack-exchange-dataset
98,201
The validity of the potential function for splay tree
<p>The paper <a href="https://www.cs.cmu.edu/~sleator/papers/self-adjusting.pdf" rel="nofollow noreferrer">"Self-Adjusting Binary Search Trees"</a> defines (Page 658) the potential function for analyzing the amortized cost of a sequence of <span class="math-container">$m$</span> splay operations as the sum of the ranks...
algorithms data structures amortized analysis binary search trees splay trees
1
The validity of the potential function for splay tree -- (algorithms data structures amortized analysis binary search trees splay trees) <p>The paper <a href="https://www.cs.cmu.edu/~sleator/papers/self-adjusting.pdf" rel="nofollow noreferrer">"Self-Adjusting Binary Search Trees"</a> defines (Page 658) the potential fu...
habedi/stack-exchange-dataset
98,204
Use the pumping lemma to prove that the following language is not context free
<p>Can anyone help with the following problem ?</p>&#xA;&#xA;<p>Let <span class="math-container">$B = \{ a^{n}b^{m}c^{m}d^{2n} | n,m β‰₯ 0 \}$</span>, use the pumping lemma to prove B is not context-free</p>&#xA;&#xA;<p>Thanks in advance.</p>&#xA;
context free pumping lemma
1
Use the pumping lemma to prove that the following language is not context free -- (context free pumping lemma) <p>Can anyone help with the following problem ?</p>&#xA;&#xA;<p>Let <span class="math-container">$B = \{ a^{n}b^{m}c^{m}d^{2n} | n,m β‰₯ 0 \}$</span>, use the pumping lemma to prove B is not context-free</p>&#xA...
habedi/stack-exchange-dataset
98,205
Why does the explanation of auxiliary carry flag differ from the article to article?
<p><a href="https://i.stack.imgur.com/sbnQE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sbnQE.png" alt="enter image description here"></a>&#xA;<a href="https://i.stack.imgur.com/BbAeJ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BbAeJ.jpg" alt="enter image description here">...
cpu
1
Why does the explanation of auxiliary carry flag differ from the article to article? -- (cpu) <p><a href="https://i.stack.imgur.com/sbnQE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sbnQE.png" alt="enter image description here"></a>&#xA;<a href="https://i.stack.imgur.com/BbAeJ.jpg" rel="nofollow ...
habedi/stack-exchange-dataset
98,209
Nyquist theorem, sample meaning
<p>Given that this wave was sampled at a sampling frequency <em>f</em>:</p>&#xA;&#xA;<p><img src="https://i.imgur.com/R7oFWcn.jpg" alt="1]"></p>&#xA;&#xA;<p>Why does the wave sampled at a sampling frequency <em>3f/2</em> look like this?</p>&#xA;&#xA;<p><img src="https://i.imgur.com/tElBRqu.png" alt="2]"></p>&#xA;&#xA;<...
sampling
1
Nyquist theorem, sample meaning -- (sampling) <p>Given that this wave was sampled at a sampling frequency <em>f</em>:</p>&#xA;&#xA;<p><img src="https://i.imgur.com/R7oFWcn.jpg" alt="1]"></p>&#xA;&#xA;<p>Why does the wave sampled at a sampling frequency <em>3f/2</em> look like this?</p>&#xA;&#xA;<p><img src="https://i.i...
habedi/stack-exchange-dataset
98,220
Random conditional association
<p>I have a really specific problem to solve and i'm looking for an existing algorithm to help me (i hope i'm in the right section of stackExchange).</p>&#xA;&#xA;<p>I would have to make "random" association between items but all association need to have to answer to specific conditions.</p>&#xA;&#xA;<p>Below, an simpl...
algorithms randomness
1
Random conditional association -- (algorithms randomness) <p>I have a really specific problem to solve and i'm looking for an existing algorithm to help me (i hope i'm in the right section of stackExchange).</p>&#xA;&#xA;<p>I would have to make "random" association between items but all association need to have to answ...
habedi/stack-exchange-dataset
98,222
Understanding CLIQUE structure
<p>I am working on the following problem:</p>&#xA;&#xA;<p>Recall the definition of a complete graph Kn is a graph with n vertices such that every vertex&#xA;is connected to every other vertex. Recall also that a clique is a complete subset of some graph.&#xA;The graph coloring problem consists of assigning a color to e...
algorithms graphs clique
1
Understanding CLIQUE structure -- (algorithms graphs clique) <p>I am working on the following problem:</p>&#xA;&#xA;<p>Recall the definition of a complete graph Kn is a graph with n vertices such that every vertex&#xA;is connected to every other vertex. Recall also that a clique is a complete subset of some graph.&#xA;...
habedi/stack-exchange-dataset
98,226
When retrieving values from a hash table with linear probing, how do we know if the wanted value had not been shifted?
<p>So, after a collision, a piece of information gets stored in the <em>next</em> bucket. When retrieving the value later with a key, how do we know it has not been shifted due to a collision and that we are in fact receiving the wrong value?</p>&#xA;
hash tables
1
When retrieving values from a hash table with linear probing, how do we know if the wanted value had not been shifted? -- (hash tables) <p>So, after a collision, a piece of information gets stored in the <em>next</em> bucket. When retrieving the value later with a key, how do we know it has not been shifted due to a co...
habedi/stack-exchange-dataset
98,232
Is Artificial General Intelligence possible with our current machine learning models?
<p>In other words, is artificial human level intelligence not possible yet just because of limitations in processing power and amount of data required to train the models? Or we don't have the knowledge of how to achieve it even in theory?&#xA;Suppose that processing power and amount of training data is not a problem, ...
machine learning artificial intelligence neural networks
1
Is Artificial General Intelligence possible with our current machine learning models? -- (machine learning artificial intelligence neural networks) <p>In other words, is artificial human level intelligence not possible yet just because of limitations in processing power and amount of data required to train the models? ...
habedi/stack-exchange-dataset
98,248
Karp hardness of a clique with given number of outer-incident edges
<p>A <em>clique</em> in an undirected graph <span class="math-container">$G(V,E)$</span> is a subset of vertices <span class="math-container">$\mathcal{C}\subseteq V$</span> every pair of which is adjacent <span class="math-container">$u,v\in \mathcal{C}\implies uv\in E(G)$</span>.</p>&#xA;&#xA;<p>Given a clique <span ...
np complete np hard np
1
Karp hardness of a clique with given number of outer-incident edges -- (np complete np hard np) <p>A <em>clique</em> in an undirected graph <span class="math-container">$G(V,E)$</span> is a subset of vertices <span class="math-container">$\mathcal{C}\subseteq V$</span> every pair of which is adjacent <span class="math-...
habedi/stack-exchange-dataset
98,250
How to minimize this DFA using given algorithm?
<p>I am trying to use Myhill-Nerode theorem to minimize the DFA appearing below.</p>&#xA;&#xA;<p>The algorithm repeatedly runs the following step:</p>&#xA;&#xA;<blockquote>&#xA; <p>If there is an unmarked pair <span class="math-container">$(Q_i, Q_j)$</span>, mark it if the pair <span class="math-container">$\{Ξ΄ (Q_i,...
finite automata
1
How to minimize this DFA using given algorithm? -- (finite automata) <p>I am trying to use Myhill-Nerode theorem to minimize the DFA appearing below.</p>&#xA;&#xA;<p>The algorithm repeatedly runs the following step:</p>&#xA;&#xA;<blockquote>&#xA; <p>If there is an unmarked pair <span class="math-container">$(Q_i, Q_j)...
habedi/stack-exchange-dataset
98,253
Prove that $SEQ_{DFA}$ = {⟨A,B⟩ | A,B are DFAs and L(A) βŠ† L(B)} is decidable
<p>Consider the following language <span class="math-container">$$EQ_{DFA} = \{ \langle A, B\rangle: A \ and \ B \ are \ DFAs \ and \ L(A) = L(B)\}$$</span> </p>&#xA;&#xA;<p>Given the fact that <span class="math-container">$EQ_{DFA}$</span> is decidable, how can I prove that the language <span class="math-container">$$...
computability finite automata
1
Prove that $SEQ_{DFA}$ = {⟨A,B⟩ | A,B are DFAs and L(A) βŠ† L(B)} is decidable -- (computability finite automata) <p>Consider the following language <span class="math-container">$$EQ_{DFA} = \{ \langle A, B\rangle: A \ and \ B \ are \ DFAs \ and \ L(A) = L(B)\}$$</span> </p>&#xA;&#xA;<p>Given the fact that <span class="m...
habedi/stack-exchange-dataset
98,255
Given an CFG determine if $\varepsilon \in L(G)$
<p>Given a context free grammar how am I able to determine if <span class="math-container">$\varepsilon \in L(G)$</span> ? </p>&#xA;&#xA;<p>The only way I thought of is to systematically check if I can derive the empty word from the given grammar. (Assuming it's not in CNF)</p>&#xA;&#xA;<p>Is my intuition right though?...
formal languages computability context free formal grammars
1
Given an CFG determine if $\varepsilon \in L(G)$ -- (formal languages computability context free formal grammars) <p>Given a context free grammar how am I able to determine if <span class="math-container">$\varepsilon \in L(G)$</span> ? </p>&#xA;&#xA;<p>The only way I thought of is to systematically check if I can deri...
habedi/stack-exchange-dataset
98,260
Find a regular grammar that generates words with even number of a's
<p>I have a language <span class="math-container">$L$</span> = {<span class="math-container">$vabu$</span> | <span class="math-container">$v$</span>,<span class="math-container">$u\in \{a,b\}^*$</span>, <span class="math-container">$|vu|_a = 0$</span> <span class="math-container">$($</span>mod <span class="math-contain...
formal languages regular languages formal grammars
1
Find a regular grammar that generates words with even number of a's -- (formal languages regular languages formal grammars) <p>I have a language <span class="math-container">$L$</span> = {<span class="math-container">$vabu$</span> | <span class="math-container">$v$</span>,<span class="math-container">$u\in \{a,b\}^*$</...
habedi/stack-exchange-dataset
98,262
For each given set choosing either it or its complement such that their union exactly has a given size
<p>Given an integer <span class="math-container">$k$</span> and <span class="math-container">$n$</span> sets <span class="math-container">$A_1,\ldots,A_n$</span>, denote <span class="math-container">$U=A_1\cup A_2\cup\cdots\cup A_n$</span>, <span class="math-container">$A_i^0=A_i$</span> and <span class="math-container...
complexity theory np complete np hard sets
1
For each given set choosing either it or its complement such that their union exactly has a given size -- (complexity theory np complete np hard sets) <p>Given an integer <span class="math-container">$k$</span> and <span class="math-container">$n$</span> sets <span class="math-container">$A_1,\ldots,A_n$</span>, denote...
habedi/stack-exchange-dataset
98,263
How can I check if $n >m$ in $a^n b a^m$?
<p>How can I design a Turing machine that takes string <span class="math-container">$a^n b a^m$</span> and check if <span class="math-container">$n&gt;m$</span> then convert the string to <span class="math-container">$a^{n-m}$</span>, otherwise reject it?</p>&#xA;
turing machines
1
How can I check if $n >m$ in $a^n b a^m$? -- (turing machines) <p>How can I design a Turing machine that takes string <span class="math-container">$a^n b a^m$</span> and check if <span class="math-container">$n&gt;m$</span> then convert the string to <span class="math-container">$a^{n-m}$</span>, otherwise reject it?</...
habedi/stack-exchange-dataset
98,267
What is the time complexity for division by repeated subtraction?
<p>Given the following algorithm :</p>&#xA;&#xA;<pre><code> input : a (integer), b (integer != 0)&#xA;&#xA; result = 0;&#xA; while(a &gt;= b) &#xA; {&#xA; a = a - b;&#xA; result = result + 1;&#xA; }&#xA;&#xA; return result;&#xA;</code></pre>&#xA;&#xA;<p>How to find the number of instructio...
algorithm analysis time complexity
1
What is the time complexity for division by repeated subtraction? -- (algorithm analysis time complexity) <p>Given the following algorithm :</p>&#xA;&#xA;<pre><code> input : a (integer), b (integer != 0)&#xA;&#xA; result = 0;&#xA; while(a &gt;= b) &#xA; {&#xA; a = a - b;&#xA; result = result + 1...
habedi/stack-exchange-dataset
98,273
I want a fast rank only shuffling algorithm for a full 52 card deck
<p>My goal is to do some large iteration Monte Carlo simulation of different card games that require on the order of 1 billion random decks to get a reliably accurate answer. The bulk of the computer time is actually shuffling/preparing the decks, not searching for the "hit" criteria I am looking for.</p>&#xA;&#xA;<p>...
algorithms
1
I want a fast rank only shuffling algorithm for a full 52 card deck -- (algorithms) <p>My goal is to do some large iteration Monte Carlo simulation of different card games that require on the order of 1 billion random decks to get a reliably accurate answer. The bulk of the computer time is actually shuffling/preparin...
habedi/stack-exchange-dataset
98,275
Help with Time Complexity
<p>Suppose we have the function below:</p>&#xA;&#xA;<pre><code>def func(n):&#xA; for i in range(n):&#xA; for j in range(n - i):&#xA; for k in range(n - j):&#xA; if i + j + k == 0:&#xA; break&#xA; if i + j == 0:&#xA; break&#xA; if i ...
time complexity python
1
Help with Time Complexity -- (time complexity python) <p>Suppose we have the function below:</p>&#xA;&#xA;<pre><code>def func(n):&#xA; for i in range(n):&#xA; for j in range(n - i):&#xA; for k in range(n - j):&#xA; if i + j + k == 0:&#xA; break&#xA; if i...
habedi/stack-exchange-dataset
98,277
If lower bound of a problem is exponential then is it NP?
<p>Assuming that we have a problem <span class="math-container">$p$</span> and we showed that the lower bound for solving <span class="math-container">$p$</span> is <span class="math-container">$\mathcal{\Omega}(2^n)$</span>.</p>&#xA;&#xA;<ul>&#xA;<li>can lower bound <span class="math-container">$\mathcal{\Omega}(2^n)...
time complexity np complete
1
If lower bound of a problem is exponential then is it NP? -- (time complexity np complete) <p>Assuming that we have a problem <span class="math-container">$p$</span> and we showed that the lower bound for solving <span class="math-container">$p$</span> is <span class="math-container">$\mathcal{\Omega}(2^n)$</span>.</p...
habedi/stack-exchange-dataset
98,278
A robot arm consisting of a sequence of rigid line segments L1, L2, . . . , Ln hinged together consecutively
<p>Hi I am a Computer Science student attempting to solve this problem for extra credit. Problem is I am unsure what this algorithm is asking for as the language is a bit hard for me to follow:</p>&#xA;&#xA;<blockquote>&#xA; <p>Imagine that you have a robot arm consisting of a sequence of rigid&#xA; line segments <sp...
algorithms
1
A robot arm consisting of a sequence of rigid line segments L1, L2, . . . , Ln hinged together consecutively -- (algorithms) <p>Hi I am a Computer Science student attempting to solve this problem for extra credit. Problem is I am unsure what this algorithm is asking for as the language is a bit hard for me to follow:</...
habedi/stack-exchange-dataset
98,291
Are space allocated to C/C++ variables in secondary storage also in Compiled file?
<p>Are data segments,heap,stack etc also present in secondary memory with compiled code then later mapped by OS to RAM when I open it?</p>&#xA;
computer architecture operating systems compilers
1
Are space allocated to C/C++ variables in secondary storage also in Compiled file? -- (computer architecture operating systems compilers) <p>Are data segments,heap,stack etc also present in secondary memory with compiled code then later mapped by OS to RAM when I open it?</p>&#xA;
habedi/stack-exchange-dataset
98,292
Remove duplicates from dictionary in a safe and clever way
<p>I have a dictionary that has keys and multiple values per key. Same value can be assigned to multiple keys.</p>&#xA;&#xA;<p>For the sake of simplicity, the keys are <code>int</code>s and the values are <code>string</code>s,&#xA;so that it would look like in C#:</p>&#xA;&#xA;<pre><code>Dictionary&lt;int,string[]&gt;&...
algorithms dictionaries
1
Remove duplicates from dictionary in a safe and clever way -- (algorithms dictionaries) <p>I have a dictionary that has keys and multiple values per key. Same value can be assigned to multiple keys.</p>&#xA;&#xA;<p>For the sake of simplicity, the keys are <code>int</code>s and the values are <code>string</code>s,&#xA;s...
habedi/stack-exchange-dataset
98,319
Discrete Mathematics Proofs for βˆƒ and βˆ€
<p>Premises or Givens:</p>&#xA;<ul>&#xA;<li><span class="math-container">$βˆƒx(A(x) β†’ B(x))$</span></li>&#xA;<li><span class="math-container">$βˆ€x (B(x) β†’ K(x))$</span></li>&#xA;</ul>&#xA;<p>To Prove:</p>&#xA;<ul>&#xA;<li><span class="math-container">$βˆƒx(A(x) β†’ K(x))$</span></li>&#xA;</ul>&#xA;<p>My Solution:</p>&#xA;<ol>...
discrete mathematics predicate logic
1
Discrete Mathematics Proofs for βˆƒ and βˆ€ -- (discrete mathematics predicate logic) <p>Premises or Givens:</p>&#xA;<ul>&#xA;<li><span class="math-container">$βˆƒx(A(x) β†’ B(x))$</span></li>&#xA;<li><span class="math-container">$βˆ€x (B(x) β†’ K(x))$</span></li>&#xA;</ul>&#xA;<p>To Prove:</p>&#xA;<ul>&#xA;<li><span class="math-c...
habedi/stack-exchange-dataset
98,321
Is there a $O(n\frac{\log{n}}{\log{k}})$ sorting algorithm?
<p>I am trying to figure out a sorting algorithm which can be used in <span class="math-container">$O(n\frac{\log{n}}{\log{k}})$</span> sorting time. I am allowed to use <span class="math-container">$k$</span> registers that can store key value pairs and these registers can insert a key value pair and return a key valu...
algorithms sorting
1
Is there a $O(n\frac{\log{n}}{\log{k}})$ sorting algorithm? -- (algorithms sorting) <p>I am trying to figure out a sorting algorithm which can be used in <span class="math-container">$O(n\frac{\log{n}}{\log{k}})$</span> sorting time. I am allowed to use <span class="math-container">$k$</span> registers that can store k...
habedi/stack-exchange-dataset
98,338
Raft algorithm: What's the data format of `term`?
<p><a href="https://i.stack.imgur.com/oaPTa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oaPTa.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<blockquote>&#xA; <p>Time is divided into terms, and each term begins with an election. After a successful election, a single leader manages the...
algorithms databases
1
Raft algorithm: What's the data format of `term`? -- (algorithms databases) <p><a href="https://i.stack.imgur.com/oaPTa.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oaPTa.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<blockquote>&#xA; <p>Time is divided into terms, and each term begin...
habedi/stack-exchange-dataset
98,339
What does it mean if we disable K-rule in Agda?
<p>TL;DR: Can I say, "K-rule in Agda enables people to match <span class="math-container">$ \forall a.a \equiv a $</span> with <span class="math-container">$ refl $</span>"?</p>&#xA;&#xA;<p>In <a href="https://agda.readthedocs.io/en/v2.5.4.1/language/without-k.html#without-k" rel="nofollow noreferrer">https://agda.read...
proof assistants agda
1
What does it mean if we disable K-rule in Agda? -- (proof assistants agda) <p>TL;DR: Can I say, "K-rule in Agda enables people to match <span class="math-container">$ \forall a.a \equiv a $</span> with <span class="math-container">$ refl $</span>"?</p>&#xA;&#xA;<p>In <a href="https://agda.readthedocs.io/en/v2.5.4.1/lan...
habedi/stack-exchange-dataset
98,351
Regex for at least three 1's and at most four 0's
<p>The alphabet is {0,1}, express all finite strings containing at least three 1's and at most four 0's.</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I've come up with a method that enumerate every possible number of 0's: </p>&#xA;&#xA;<p><span class="math-container">$$111^{+}+0111^{+}+1^{+}011^{+}+111^{+}01^{*}+00111^{+}+......$$</s...
regular expressions
1
Regex for at least three 1's and at most four 0's -- (regular expressions) <p>The alphabet is {0,1}, express all finite strings containing at least three 1's and at most four 0's.</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>I've come up with a method that enumerate every possible number of 0's: </p>&#xA;&#xA;<p><span class="math-con...
habedi/stack-exchange-dataset
98,355
Undecidable problem intersection of two DCFL languages is DCFL?
<p>We have two deterministic pushdown automatas A and B, which languages are deterministic context-free. The problem is to decide if there exists a deterministic pushdown automata, which language is an intersection of the languages of A and B. This problem is known to be undecidable. But I can't find a proof for it. </...
context free proof techniques pushdown automata pumping lemma
1
Undecidable problem intersection of two DCFL languages is DCFL? -- (context free proof techniques pushdown automata pumping lemma) <p>We have two deterministic pushdown automatas A and B, which languages are deterministic context-free. The problem is to decide if there exists a deterministic pushdown automata, which la...
habedi/stack-exchange-dataset
98,370
Why is it that a lambda function requiring multiple input also requires multiple functions?
<p>So I recently discovered lambda calculus and for the most part I understand it. However, one specific part of it that I cannot understand is this:</p>&#xA;&#xA;<p>Let's say we define a very simple function</p>&#xA;&#xA;<p><span class="math-container">$$ I := \lambda a.a$$</span></p>&#xA;&#xA;<p>This is simple to und...
lambda calculus
1
Why is it that a lambda function requiring multiple input also requires multiple functions? -- (lambda calculus) <p>So I recently discovered lambda calculus and for the most part I understand it. However, one specific part of it that I cannot understand is this:</p>&#xA;&#xA;<p>Let's say we define a very simple functio...
habedi/stack-exchange-dataset
98,378
Maximizing entropy under constraint
<p>How do I prove that entropy is maximal for <span class="math-container">$P(A_2) = \cdots = P(A_n) = (1-a) /(n-1)$</span> while <span class="math-container">$P(A_1) = a$</span> (a fixed number) and <span class="math-container">$A_1,…, A_n$</span> is a partition of the sample space?</p>&#xA;
probability theory discrete mathematics information theory entropy
1
Maximizing entropy under constraint -- (probability theory discrete mathematics information theory entropy) <p>How do I prove that entropy is maximal for <span class="math-container">$P(A_2) = \cdots = P(A_n) = (1-a) /(n-1)$</span> while <span class="math-container">$P(A_1) = a$</span> (a fixed number) and <span class=...
habedi/stack-exchange-dataset
98,402
Comparison between: Maximum Absolute Difference & Min Steps in Infinite Grid
<p>There are two questions that I am trying to draw a comparison between:</p>&#xA;&#xA;<pre><code>Q1: Maximum Absolute Difference&#xA;You are given an array of N integers, A1, A2 ,…, AN. Return maximum value of f(i, j) for all 1 ≀ i, j ≀ N.&#xA;f(i, j) is defined as |A[i] - A[j]| + |i - j|, where |x| denotes absolute v...
arrays euclidean distance
1
Comparison between: Maximum Absolute Difference & Min Steps in Infinite Grid -- (arrays euclidean distance) <p>There are two questions that I am trying to draw a comparison between:</p>&#xA;&#xA;<pre><code>Q1: Maximum Absolute Difference&#xA;You are given an array of N integers, A1, A2 ,…, AN. Return maximum value of f...
habedi/stack-exchange-dataset