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
74,040
Given snapshot and boolean circuit how to compute coNP formula?
<blockquote>&#xA; <p>Theorem 6.20: If $\mathsf{EXP\text{}} \subseteq \mathsf{P_{poly}\text{}}$ then $\mathsf{EXP\text{}} = \Sigma_2 ^{p}$.</p>&#xA;</blockquote>&#xA;&#xA;<p><strong>My attempt</strong> : Let $L \in \mathsf{EXP\text{}}$. Then $L$ is computable by an $2^{p(n)}$-time Turing machine $M$, where $p$ is some...
complexity theory circuits
1
Given snapshot and boolean circuit how to compute coNP formula? -- (complexity theory circuits) <blockquote>&#xA; <p>Theorem 6.20: If $\mathsf{EXP\text{}} \subseteq \mathsf{P_{poly}\text{}}$ then $\mathsf{EXP\text{}} = \Sigma_2 ^{p}$.</p>&#xA;</blockquote>&#xA;&#xA;<p><strong>My attempt</strong> : Let $L \in \mathsf{...
habedi/stack-exchange-dataset
74,048
Can someone help me understand this proof: there exists a complement of an RE language is not RE
<p>I'm trying to understand this proof in Peter Linz's <a href="https://books.google.com/books?id=hsxDiWvVdBcC&amp;pg=PA281&amp;lpg=PA281&amp;dq=%22there%20exists%20a%20recursively%20enumerable%20language%20whose%20complement%20is%20not%20recursively%20enumerable%22&amp;source=bl&amp;ots=rdMsPjVsaS&amp;sig=Ja23eh7yEIUw...
computability turing machines proof techniques
1
Can someone help me understand this proof: there exists a complement of an RE language is not RE -- (computability turing machines proof techniques) <p>I'm trying to understand this proof in Peter Linz's <a href="https://books.google.com/books?id=hsxDiWvVdBcC&amp;pg=PA281&amp;lpg=PA281&amp;dq=%22there%20exists%20a%20re...
habedi/stack-exchange-dataset
74,049
Does a context switch happen when a process has terminated?
<p>I know this might sound like a newbie question but let's say we have a priority based scheduling algorithm (non-preemptive) where all processes arrive at time 0 and based on priority the order is P1, P2, P3 ... </p>&#xA;&#xA;<p>The processes will run P1, P2, P3 without having to block one to let another one run, eac...
operating systems process scheduling
1
Does a context switch happen when a process has terminated? -- (operating systems process scheduling) <p>I know this might sound like a newbie question but let's say we have a priority based scheduling algorithm (non-preemptive) where all processes arrive at time 0 and based on priority the order is P1, P2, P3 ... </p>...
habedi/stack-exchange-dataset
74,056
Could be solved a NP-complete problem in constant time?
<p>Under the assumption that P would be equal to NP, it could exist a NP-complete problem that is solved in constant time? </p>&#xA;
complexity theory np complete p vs np
1
Could be solved a NP-complete problem in constant time? -- (complexity theory np complete p vs np) <p>Under the assumption that P would be equal to NP, it could exist a NP-complete problem that is solved in constant time? </p>&#xA;
habedi/stack-exchange-dataset
74,065
Prefix encoding of algebraic data types
<p>I'm new to coding theory and formal proofs, and am struggling to understand how to construct and reason about prefix-free encoding algorithms on algebraic data types. I hope it's clear if I use notation from <a href="https://wiki.haskell.org/Type#Data_declarations" rel="noreferrer">haskell</a> below.</p>&#xA;&#xA;<p...
coding theory encoding scheme inductive datatypes
1
Prefix encoding of algebraic data types -- (coding theory encoding scheme inductive datatypes) <p>I'm new to coding theory and formal proofs, and am struggling to understand how to construct and reason about prefix-free encoding algorithms on algebraic data types. I hope it's clear if I use notation from <a href="https...
habedi/stack-exchange-dataset
74,076
How can every regex be accepted by an infinite number of finite automata?
<p>In The (New) Turing Omnibus by A K Dewdney, chapter 2, it says:</p>&#xA;&#xA;<blockquote>&#xA; <p>Moreover, for every regular expression there is an automaton which accepts the language symbolized by that expression. Thus, in a sense, regular expressions capture precisely the behavior of automata in terms of the la...
automata finite automata regular expressions
1
How can every regex be accepted by an infinite number of finite automata? -- (automata finite automata regular expressions) <p>In The (New) Turing Omnibus by A K Dewdney, chapter 2, it says:</p>&#xA;&#xA;<blockquote>&#xA; <p>Moreover, for every regular expression there is an automaton which accepts the language symbol...
habedi/stack-exchange-dataset
74,080
Calculate joint entropy of a Hamming Code over a Binary Symmetric Channel?
<p>I have a normal (7,4,3) Hamming Code over GF(2) and a parity check matrix for it (not posted, because I don't think it's involved).</p>&#xA;&#xA;<p>I have a set X of 4 bit source vectors called x. They all have equal probability to be sent. So I would assume p(x) = 1/16. They are sent over a BSC with the bit error p...
probability theory information theory entropy
1
Calculate joint entropy of a Hamming Code over a Binary Symmetric Channel? -- (probability theory information theory entropy) <p>I have a normal (7,4,3) Hamming Code over GF(2) and a parity check matrix for it (not posted, because I don't think it's involved).</p>&#xA;&#xA;<p>I have a set X of 4 bit source vectors call...
habedi/stack-exchange-dataset
74,082
Finding a subarray of time series data in which all values are less than X for specified time Y?
<p>The idea is to find an anomalous value (i.e. it's less than <em>X</em>) in time series data (sorted by time), and check if this behavior continues during specified time (<em>Y=2 hours</em>).</p>&#xA;&#xA;<p>If all values in sub-array (which represents 2 hours period) are <strong>&le;</strong> X, the subarray is ret...
subsequences time series analysis
1
Finding a subarray of time series data in which all values are less than X for specified time Y? -- (subsequences time series analysis) <p>The idea is to find an anomalous value (i.e. it's less than <em>X</em>) in time series data (sorted by time), and check if this behavior continues during specified time (<em>Y=2 hou...
habedi/stack-exchange-dataset
74,085
Boolean circuit with two inputs and advice input is hard-wired
<blockquote>&#xA; <p>Claim : $\cup_{c,d} $ DTIME$(n^c)/n^d \subseteq$ <a href="https://en.wikipedia.org/wiki/P/poly" rel="nofollow noreferrer">$P_{poly}$</a></p>&#xA;</blockquote>&#xA;&#xA;<p>Proof : if $L$ is decidable by a polynomial-time Turing machine $M$ with access to advice family $\{\alpha_n\}_{n\in \mathbb{N}...
complexity theory circuits
1
Boolean circuit with two inputs and advice input is hard-wired -- (complexity theory circuits) <blockquote>&#xA; <p>Claim : $\cup_{c,d} $ DTIME$(n^c)/n^d \subseteq$ <a href="https://en.wikipedia.org/wiki/P/poly" rel="nofollow noreferrer">$P_{poly}$</a></p>&#xA;</blockquote>&#xA;&#xA;<p>Proof : if $L$ is decidable by a...
habedi/stack-exchange-dataset
74,090
MST: Are all safe edges, light edges?
<p>Following are some definitions from CLRS:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>DEFINITIONS</strong> :<br>&#xA; 1. <strong>Cut (S ,V-S)</strong> : of an undirected graph G = (V,E) is a partition of V(as defined in CLRS Book) .You can think it as a line that divides graph into two disjoint sets of vertices on i...
graphs terminology minimum spanning tree
1
MST: Are all safe edges, light edges? -- (graphs terminology minimum spanning tree) <p>Following are some definitions from CLRS:</p>&#xA;&#xA;<blockquote>&#xA; <p><strong>DEFINITIONS</strong> :<br>&#xA; 1. <strong>Cut (S ,V-S)</strong> : of an undirected graph G = (V,E) is a partition of V(as defined in CLRS Book) .Y...
habedi/stack-exchange-dataset
74,091
Is an NP-hard problem which is in NP is NP-complete?
<p>I'm reading Combinatorial Optimization book by Bernhard Korte and Jens Vygen. There's a part that they said:</p>&#xA;<blockquote>&#xA;<p>It is an open question whether each <span class="math-container">$NP$</span>-hard decision problem <span class="math-container">$A \in NP$</span> is <span class="math-container">$N...
complexity theory np complete np hard np
1
Is an NP-hard problem which is in NP is NP-complete? -- (complexity theory np complete np hard np) <p>I'm reading Combinatorial Optimization book by Bernhard Korte and Jens Vygen. There's a part that they said:</p>&#xA;<blockquote>&#xA;<p>It is an open question whether each <span class="math-container">$NP$</span>-hard...
habedi/stack-exchange-dataset
74,095
Why are Linearly Bounded Turing Machines more powerful than Finite State Automata?
<p>I was under the impression that our computers, being finite, are ultimately no more powerful than (extraordinarily large) Finite State Machines. However, Linearly Bounded Turing Machines are also finite, but it seems that Regular Languages are strictly an improper subset of Context-Sensitive Languages.</p>&#xA;&#xA...
finite automata computation models linear bounded automata
1
Why are Linearly Bounded Turing Machines more powerful than Finite State Automata? -- (finite automata computation models linear bounded automata) <p>I was under the impression that our computers, being finite, are ultimately no more powerful than (extraordinarily large) Finite State Machines. However, Linearly Bounde...
habedi/stack-exchange-dataset
74,103
Do modern operating systems use memory control blocks?
<p>I was taught in my operating systems class that sections of memory in the heap are marked as free/occupied through the use of memory control blocks (MCB). The generalized definition of an MCB that was given to us is that they hold two memory addresses (one for the next MCB and one for the previous MCB), the size of ...
operating systems memory management memory allocation
1
Do modern operating systems use memory control blocks? -- (operating systems memory management memory allocation) <p>I was taught in my operating systems class that sections of memory in the heap are marked as free/occupied through the use of memory control blocks (MCB). The generalized definition of an MCB that was gi...
habedi/stack-exchange-dataset
74,110
Is clrs really needed to be a computer scientist
<p>I want to dive in alghorithms and data structures and maybe AI this year. When I searched on internet everybody was recommending to read clrs. But I found it very complicated, because of the amount and the level of math in it. Is reading clrs really important to be a true computer scientist. If yes, how it can be ea...
algorithms books
1
Is clrs really needed to be a computer scientist -- (algorithms books) <p>I want to dive in alghorithms and data structures and maybe AI this year. When I searched on internet everybody was recommending to read clrs. But I found it very complicated, because of the amount and the level of math in it. Is reading clrs rea...
habedi/stack-exchange-dataset
74,116
Can String be a subtype of Character in a programming language?
<p>Could a programming language be designed so that there is an inheritance relationship between <code>string</code> and <code>character</code> (both of which are native types), such that the inheritance alone resolves the use of an arbitrary binary operator between the two types: <code>&lt;string&gt; @ &lt;character&g...
programming languages language design polymorphisms
1
Can String be a subtype of Character in a programming language? -- (programming languages language design polymorphisms) <p>Could a programming language be designed so that there is an inheritance relationship between <code>string</code> and <code>character</code> (both of which are native types), such that the inherit...
habedi/stack-exchange-dataset
74,118
Building a verifier for sentences involving addition over the natural numbers
<p>Consider the model $(\mathbb{N},+)$; that is, the natural numbers equipped with the addition relation, PLUS($x$,$y$,$z$), where PLUS($x$,$y$,$z$) is true iff $x + y = z$. Let Th$(\mathbb{N},+)$ be the theory of this model; that is, the set of true sentences in the language of the model. For example, the sentence $\f...
time complexity logic
1
Building a verifier for sentences involving addition over the natural numbers -- (time complexity logic) <p>Consider the model $(\mathbb{N},+)$; that is, the natural numbers equipped with the addition relation, PLUS($x$,$y$,$z$), where PLUS($x$,$y$,$z$) is true iff $x + y = z$. Let Th$(\mathbb{N},+)$ be the theory of t...
habedi/stack-exchange-dataset
74,122
Why does radix sort work?
<p>I understand how radix sort works and how to implement it, but I don't understand why it works. </p>&#xA;&#xA;<p>Are there any underlying mathematical or logical principles that it relies on? </p>&#xA;
data structures logic mathematical programming radix sort
1
Why does radix sort work? -- (data structures logic mathematical programming radix sort) <p>I understand how radix sort works and how to implement it, but I don't understand why it works. </p>&#xA;&#xA;<p>Are there any underlying mathematical or logical principles that it relies on? </p>&#xA;
habedi/stack-exchange-dataset
74,132
A < HPL < Complement(A) What can you say about A and Complement(A)?
<p>Suppose we have the language </p>&#xA;&#xA;<p>$ \overline L = \{x∈\{0,1\}*:xβˆ‰L\}$</p>&#xA;&#xA;<p>And we know that </p>&#xA;&#xA;<p>$A ≀ HPL ≀ \overline A$ </p>&#xA;&#xA;<p>where HPL is the Halting problem.</p>&#xA;&#xA;<p>We need to state whether A is finite, countably infinite and whether $A$ and $ \overline A$ i...
turing machines undecidability
1
A < HPL < Complement(A) What can you say about A and Complement(A)? -- (turing machines undecidability) <p>Suppose we have the language </p>&#xA;&#xA;<p>$ \overline L = \{x∈\{0,1\}*:xβˆ‰L\}$</p>&#xA;&#xA;<p>And we know that </p>&#xA;&#xA;<p>$A ≀ HPL ≀ \overline A$ </p>&#xA;&#xA;<p>where HPL is the Halting problem.</p>&#...
habedi/stack-exchange-dataset
74,140
Which of the following languages is accepted by this Pushdown Automaton?
<p>This is a question from a past paper. I am struggling to get my head around the concept of a PDA. I understand that it is a Finite Automaton with a stack but am stuck as far as answering questions like this one. Thanks. </p>&#xA;&#xA;<p><a href="https://i.stack.imgur.com/ONLzK.jpg" rel="nofollow noreferrer"><img src...
pushdown automata
1
Which of the following languages is accepted by this Pushdown Automaton? -- (pushdown automata) <p>This is a question from a past paper. I am struggling to get my head around the concept of a PDA. I understand that it is a Finite Automaton with a stack but am stuck as far as answering questions like this one. Thanks. <...
habedi/stack-exchange-dataset
74,142
Are these examples of unification problems?
<p>I have been studying unification, especially nominal unification (<a href="http://gabbay.org.uk/papers/nomu-jv.pdf" rel="nofollow noreferrer">paper</a>) gets my attention.&#xA;I read the theory and examples. But I am wondering that what kind of problems occur in unifications.&#xA;For examples, The following examples...
logic unification
1
Are these examples of unification problems? -- (logic unification) <p>I have been studying unification, especially nominal unification (<a href="http://gabbay.org.uk/papers/nomu-jv.pdf" rel="nofollow noreferrer">paper</a>) gets my attention.&#xA;I read the theory and examples. But I am wondering that what kind of probl...
habedi/stack-exchange-dataset
74,145
Is this a valid representation of a function in Lambda Calculus?
<p>Let's say I want to define a function:</p>&#xA;&#xA;<p>This function multiplies an input by two, adds one to this integer, then divides it by two in that order.</p>&#xA;&#xA;<p>f represents the multiplication, g represents the addition, and h represents the division.</p>&#xA;&#xA;<p>Could I represent this as <code>Ξ»...
lambda calculus
1
Is this a valid representation of a function in Lambda Calculus? -- (lambda calculus) <p>Let's say I want to define a function:</p>&#xA;&#xA;<p>This function multiplies an input by two, adds one to this integer, then divides it by two in that order.</p>&#xA;&#xA;<p>f represents the multiplication, g represents the addi...
habedi/stack-exchange-dataset
74,163
What is "rank" in a binary search tree and how can it be useful?
<p>I am having a bit of trouble wrapping my mind around what a ranked binary search tree is and why having a rank is important. I am hoping that someone can clarify a few things for me.</p>&#xA;&#xA;<p><strong>What I have looked into:</strong><br>&#xA;From what I have read, a ranked binary search tree is a tree where e...
algorithms data structures binary trees binary search trees
1
What is "rank" in a binary search tree and how can it be useful? -- (algorithms data structures binary trees binary search trees) <p>I am having a bit of trouble wrapping my mind around what a ranked binary search tree is and why having a rank is important. I am hoping that someone can clarify a few things for me.</p>&...
habedi/stack-exchange-dataset
74,174
Is #HORNSAT polynomial?
<p>A <em>Horn clause</em> is a disjunctive clause of literals containing at most one unnegated literal. Examples are&#xA;$$&#xA;\neg p \lor \neg r \lor \neg q,\\ \neg s \lor q,\\ \neg s \lor \neg q\lor r,\\ s,\\ \neg r \lor t,\\ \neg q \lor \neg t\lor p.&#xA;$$&#xA;Determining whether or not a set of Horn clauses is si...
complexity theory satisfiability
1
Is #HORNSAT polynomial? -- (complexity theory satisfiability) <p>A <em>Horn clause</em> is a disjunctive clause of literals containing at most one unnegated literal. Examples are&#xA;$$&#xA;\neg p \lor \neg r \lor \neg q,\\ \neg s \lor q,\\ \neg s \lor \neg q\lor r,\\ s,\\ \neg r \lor t,\\ \neg q \lor \neg t\lor p.&#xA...
habedi/stack-exchange-dataset
74,179
Maximizing the boolean combination of given real numbers with dependencies
<p>Let $x_i,x_{ij}\in\mathbb{R}$ and $b_i\in\{0,1\}$ for all $i,j\in\{1,2,\ldots,n\}$ and $j&gt;i$. I want to know which of all the possible boolean combinations make(s) the following expression maximal: $$\sum_i b_ix_i+\sum_{j&gt;i}b_ib_jx_{ij}$$</p>&#xA;&#xA;<p>I can think of greedy heuristics (for example, identify ...
algorithms optimization approximation integer programming
1
Maximizing the boolean combination of given real numbers with dependencies -- (algorithms optimization approximation integer programming) <p>Let $x_i,x_{ij}\in\mathbb{R}$ and $b_i\in\{0,1\}$ for all $i,j\in\{1,2,\ldots,n\}$ and $j&gt;i$. I want to know which of all the possible boolean combinations make(s) the followin...
habedi/stack-exchange-dataset
74,187
Prove that my NP-complete problem is strong
<p>I have two problems, one of which is solved using dynamic programming. I showed that it is NP-complete (a knapsack variant), therefore having this dynamic programming solution says that this one is weakly NP-complete. Right?</p>&#xA;&#xA;<p>Then, in the second problem I have added a new dimension to the problem whic...
complexity theory np complete knapsack problems
1
Prove that my NP-complete problem is strong -- (complexity theory np complete knapsack problems) <p>I have two problems, one of which is solved using dynamic programming. I showed that it is NP-complete (a knapsack variant), therefore having this dynamic programming solution says that this one is weakly NP-complete. Ri...
habedi/stack-exchange-dataset
74,192
How can we prove that $g = O(f) $ (Big-Oh notation)
<h1>Problem description</h1>&#xA;<p>I am trying to understand the first example of Big-Oh notation in <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.297.6224&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Computational Complexity:A Modern Approach</a> page 9.</p>&#xA;<p>If <span class="math-con...
asymptotics
1
How can we prove that $g = O(f) $ (Big-Oh notation) -- (asymptotics) <h1>Problem description</h1>&#xA;<p>I am trying to understand the first example of Big-Oh notation in <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.297.6224&amp;rep=rep1&amp;type=pdf" rel="nofollow noreferrer">Computational Complex...
habedi/stack-exchange-dataset
74,206
Set Basis Problem Variant reference for NP-Completeness?
<p><strong>Given:</strong> Collection $C$ of Subsets of a finite set $S$, positive integer $K &lt;=|C|$</p>&#xA;&#xA;<p><strong>Problem Statement:</strong> Is there a collection $B$ of subsets of $S$ with $|B| = K$ such that for each subset $c$ in $C$, there is a sub-collection in $B$ whose union is $c$ ?</p>&#xA;&#xA;...
np complete
1
Set Basis Problem Variant reference for NP-Completeness? -- (np complete) <p><strong>Given:</strong> Collection $C$ of Subsets of a finite set $S$, positive integer $K &lt;=|C|$</p>&#xA;&#xA;<p><strong>Problem Statement:</strong> Is there a collection $B$ of subsets of $S$ with $|B| = K$ such that for each subset $c$ i...
habedi/stack-exchange-dataset
74,210
Efficient Algorithm to compute radius of tree
<p>Given an acyclic undirected graph alike to this one :&#xA;<a href="https://i.stack.imgur.com/vevka.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vevka.png" alt="enter image description here"></a></p>&#xA;&#xA;<p><em>(Here the center is the node '2', and the radius is 5)</em></p>&#xA;&#xA;<p>What...
algorithms graphs optimization trees
1
Efficient Algorithm to compute radius of tree -- (algorithms graphs optimization trees) <p>Given an acyclic undirected graph alike to this one :&#xA;<a href="https://i.stack.imgur.com/vevka.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vevka.png" alt="enter image description here"></a></p>&#xA;&#xA...
habedi/stack-exchange-dataset
74,214
How to show that cross entropy is minimized?
<p>This Question is taken from the book Neural Networks and DeepLearning by Michael Nielsen</p>&#xA;&#xA;<p>The Question:&#xA;In a single-neuron ,It is argued that the cross-entropy is small if <strong>Οƒ(z)β‰ˆy</strong> for all training inputs. The argument relied on <strong>y</strong> being equal to either <strong>0</st...
machine learning neural networks gradient descent
1
How to show that cross entropy is minimized? -- (machine learning neural networks gradient descent) <p>This Question is taken from the book Neural Networks and DeepLearning by Michael Nielsen</p>&#xA;&#xA;<p>The Question:&#xA;In a single-neuron ,It is argued that the cross-entropy is small if <strong>Οƒ(z)β‰ˆy</strong> fo...
habedi/stack-exchange-dataset
74,220
Is P the set of all algorithms whose run-time is $O\left( n^{ O \left( 1 \right) }\right)$?
<p>I'm coming to Computer Science from Mathematics and am familiar with the idea of building classes of objects using Propositional Logic. Namely, start with some universe of objects, define some proposition $P \left( x \right)$, and then iterate over the universe of objects, applying $P \left( x \right)$ to each; keep...
complexity theory time complexity complexity classes
1
Is P the set of all algorithms whose run-time is $O\left( n^{ O \left( 1 \right) }\right)$? -- (complexity theory time complexity complexity classes) <p>I'm coming to Computer Science from Mathematics and am familiar with the idea of building classes of objects using Propositional Logic. Namely, start with some univers...
habedi/stack-exchange-dataset
74,237
Lambda Calculus in Rewriting systems
<p>How to do or implement <a href="https://en.wikipedia.org/wiki/Lambda_calculus" rel="noreferrer">Lambda Calculus</a> in a <a href="https://en.wikipedia.org/wiki/Rewriting" rel="noreferrer">Rewriting systems</a>?</p>&#xA;&#xA;<p>Rewriting systems are Turing complete.</p>&#xA;&#xA;<p>But I can't figure out how to do la...
turing machines lambda calculus turing completeness term rewriting
1
Lambda Calculus in Rewriting systems -- (turing machines lambda calculus turing completeness term rewriting) <p>How to do or implement <a href="https://en.wikipedia.org/wiki/Lambda_calculus" rel="noreferrer">Lambda Calculus</a> in a <a href="https://en.wikipedia.org/wiki/Rewriting" rel="noreferrer">Rewriting systems</a...
habedi/stack-exchange-dataset
74,239
Finding suitable NP-complete problem to reduce to my problem
<p>I've been given a set $S$ of natural numbers (non-negative integers) $s_1$, $s_2$,...,$s_n$ where $|S|=n$. My problem is to figure out if there is way to get a total sum of 0 when using all the numbers of $S$ <strong>but</strong> we get to "choose the sign" for each number: that is, for $s_i$ we get to choose if we'...
np complete reductions np hard np decision problem
1
Finding suitable NP-complete problem to reduce to my problem -- (np complete reductions np hard np decision problem) <p>I've been given a set $S$ of natural numbers (non-negative integers) $s_1$, $s_2$,...,$s_n$ where $|S|=n$. My problem is to figure out if there is way to get a total sum of 0 when using all the number...
habedi/stack-exchange-dataset
74,240
Time complexity of writing a number as power of 2's
<p>I'm wondering about the time complexity of writing a number as power of 2's. For example writing $n=218$ as $2 + 2^3 + 2^4 + 2^6 + 2^7$.&#xA;It seems to me that we do $\lceil \log_2n \rceil $ divisions. Each division costs $O(n^2)$ so an upper bound is $O(n^2 \cdot \log_2n)$. However, this seems like a very loose up...
time complexity asymptotics
1
Time complexity of writing a number as power of 2's -- (time complexity asymptotics) <p>I'm wondering about the time complexity of writing a number as power of 2's. For example writing $n=218$ as $2 + 2^3 + 2^4 + 2^6 + 2^7$.&#xA;It seems to me that we do $\lceil \log_2n \rceil $ divisions. Each division costs $O(n^2)$ ...
habedi/stack-exchange-dataset
74,257
Binary Tree Question
<p><a href="https://i.stack.imgur.com/qwlcy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qwlcy.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>Using the diagram of a binary tree and algorithm answer the following:</p>&#xA;&#xA;<p>If the following commands store(1,laurence), store(1, r...
binary trees
1
Binary Tree Question -- (binary trees) <p><a href="https://i.stack.imgur.com/qwlcy.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/qwlcy.jpg" alt="enter image description here"></a></p>&#xA;&#xA;<p>Using the diagram of a binary tree and algorithm answer the following:</p>&#xA;&#xA;<p>If the following...
habedi/stack-exchange-dataset
74,282
How can a operating system run on more than one CPU architecture?
<p>How can a operating system run on more than one CPU architecture?</p>&#xA;&#xA;<p>Does the OS detect what type of architecture it is currently running on?&#xA;If so, does it simply use a different set of code for that architecture?</p>&#xA;&#xA;<p>How does the CPU detect the type of architecture?</p>&#xA;
computer architecture operating systems cpu
1
How can a operating system run on more than one CPU architecture? -- (computer architecture operating systems cpu) <p>How can a operating system run on more than one CPU architecture?</p>&#xA;&#xA;<p>Does the OS detect what type of architecture it is currently running on?&#xA;If so, does it simply use a different set o...
habedi/stack-exchange-dataset
74,294
What is the difference between a "meta model" and "design patterns"?
<p>Where is the difference between a "meta model" and "design patterns"?</p>&#xA;&#xA;<p>If you take, for example, Fowlers "Identity Field" from his book "Patterns Of Enterprise Application Architecture": Why is this a pattern and not a meta model?</p>&#xA;&#xA;<p>Thanks!</p>&#xA;
design patterns
1
What is the difference between a "meta model" and "design patterns"? -- (design patterns) <p>Where is the difference between a "meta model" and "design patterns"?</p>&#xA;&#xA;<p>If you take, for example, Fowlers "Identity Field" from his book "Patterns Of Enterprise Application Architecture": Why is this a pattern and...
habedi/stack-exchange-dataset
74,300
Can BNF consist of zero rules?
<p>I am trying to use BNF to describe its own grammar to get used to it. What I can not find any information about is whether BNF must consist of <strong><em>zero or more rules</em></strong> or <strong><em>one or more rules</em></strong>. The difference would be:</p>&#xA;&#xA;<pre><code>&lt;grammar&gt; ::= &lt;grammar&...
context free formal grammars
1
Can BNF consist of zero rules? -- (context free formal grammars) <p>I am trying to use BNF to describe its own grammar to get used to it. What I can not find any information about is whether BNF must consist of <strong><em>zero or more rules</em></strong> or <strong><em>one or more rules</em></strong>. The difference w...
habedi/stack-exchange-dataset
74,301
Perform the following 8-bit two's complement arithmetic operation
<p>How am I supposed to perform this subtraction?</p>&#xA;&#xA;<p>For instance: $01110000_2βˆ’11101011_2$</p>&#xA;&#xA;<p>$01110000_2$ has a positive sign, so there is no need to perform two's complement. $11101011_2$ has a negative sign, so I need to perform two's complement.</p>&#xA;&#xA;<p>Two's complement for $111010...
computer architecture
1
Perform the following 8-bit two's complement arithmetic operation -- (computer architecture) <p>How am I supposed to perform this subtraction?</p>&#xA;&#xA;<p>For instance: $01110000_2βˆ’11101011_2$</p>&#xA;&#xA;<p>$01110000_2$ has a positive sign, so there is no need to perform two's complement. $11101011_2$ has a negat...
habedi/stack-exchange-dataset
74,304
Copy on write is an interesting idea used on server systems. Does it make any sense on a smartphone?
<p>The data pages that are actually modified need to be copied. This approach, called copy on write, improves performance by reducing copying.</p>&#xA;&#xA;<p>According to me it is unnecessary as every process has its own data. (not sure) A third process working with that data is really not possible.</p>&#xA;&#xA;<p>Pl...
operating systems
1
Copy on write is an interesting idea used on server systems. Does it make any sense on a smartphone? -- (operating systems) <p>The data pages that are actually modified need to be copied. This approach, called copy on write, improves performance by reducing copying.</p>&#xA;&#xA;<p>According to me it is unnecessary as ...
habedi/stack-exchange-dataset
74,305
Building automaton from regular expression
<p>Let $L=a(a+b)^*b$, a regular expression. I will try to build the automaton by the $a^{-1}L$, $b^{-1}L$ rule</p>&#xA;&#xA;<ol>&#xA;<li>$a^{-1}L = \{a,b\}^* b=M$.</li>&#xA;<li>$b^{-1}L=\emptyset$.</li>&#xA;<li>$a^{-1}M=b\cup\{a,b\}^*b=N$.</li>&#xA;<li>$b^{-1}M=\{\varepsilon\} \cup \{b\}\cup \{a,b\}^*b = P$</li>&#xA;</...
automata finite automata
1
Building automaton from regular expression -- (automata finite automata) <p>Let $L=a(a+b)^*b$, a regular expression. I will try to build the automaton by the $a^{-1}L$, $b^{-1}L$ rule</p>&#xA;&#xA;<ol>&#xA;<li>$a^{-1}L = \{a,b\}^* b=M$.</li>&#xA;<li>$b^{-1}L=\emptyset$.</li>&#xA;<li>$a^{-1}M=b\cup\{a,b\}^*b=N$.</li>&#x...
habedi/stack-exchange-dataset
74,315
How unallocated memory space is represented?
<p>I'm doing C programming stuff, and I'd like to know little bit about memory management - My problem is that I'm not understanding where the computer (or the OS or the programs) stores the information related to allocated space and how the unallocated space information is processed and how it is reported as a runtime...
operating systems memory management
1
How unallocated memory space is represented? -- (operating systems memory management) <p>I'm doing C programming stuff, and I'd like to know little bit about memory management - My problem is that I'm not understanding where the computer (or the OS or the programs) stores the information related to allocated space and ...
habedi/stack-exchange-dataset
74,318
Show that if A is regular so is $A^{R}$
<p>I'm stuck on "For any language $A$, let $A^R = {w^R | w \in A}$ Show that if A is regular, so is $A^R$."</p>&#xA;&#xA;<p>According to my research (see references), the steps required to prove this question, are:</p>&#xA;&#xA;<ol>&#xA;<li>Reverse all the links in the automaton </li>&#xA;<li>Add a new state (call it $...
automata finite automata regular expressions
1
Show that if A is regular so is $A^{R}$ -- (automata finite automata regular expressions) <p>I'm stuck on "For any language $A$, let $A^R = {w^R | w \in A}$ Show that if A is regular, so is $A^R$."</p>&#xA;&#xA;<p>According to my research (see references), the steps required to prove this question, are:</p>&#xA;&#xA;<o...
habedi/stack-exchange-dataset
74,329
When did "regular" start referring to Type 3 languages/grammars?
<p>In his 1959 paper, <a href="http://twiki.di.uniroma1.it/pub/LC/WebHome/chomsky1959.pdf" rel="nofollow noreferrer">On Certain Formal Properties of Grammars</a>, Chomsky defined a "regular" grammar as a specific form of a type 2 (context-free) grammar. (See Definition 8 of that paper.) He then goes on (in Section 6) t...
formal languages formal grammars history chomsky hierarchy
1
When did "regular" start referring to Type 3 languages/grammars? -- (formal languages formal grammars history chomsky hierarchy) <p>In his 1959 paper, <a href="http://twiki.di.uniroma1.it/pub/LC/WebHome/chomsky1959.pdf" rel="nofollow noreferrer">On Certain Formal Properties of Grammars</a>, Chomsky defined a "regular" ...
habedi/stack-exchange-dataset
74,331
Real-valued genetic algorithm offspring out-of-bounds
<p>I have a fairly simple real-valued genetic algorithm that seems to work fairly well, however it currently has some issues that I'm hoping to get some help with. If we consider a 1-dimensional problem, I use the following method to produce 3 children/offspring $(c_{1,2,3})$ from 2 parents $(p_{1,2})$:&#xA;$$c_{1} = 0...
optimization genetic algorithms numerical algorithms
1
Real-valued genetic algorithm offspring out-of-bounds -- (optimization genetic algorithms numerical algorithms) <p>I have a fairly simple real-valued genetic algorithm that seems to work fairly well, however it currently has some issues that I'm hoping to get some help with. If we consider a 1-dimensional problem, I us...
habedi/stack-exchange-dataset
74,338
Find the odd shortest path is NL
<p>OddPath be a set of all G, s, t, such that G is a directed graph with a path from node s to node t, and the shortest such path has odd number of edges.</p>&#xA;&#xA;<p>How can I show OddPath is NL?&#xA;I think about it for a long time, the main problem is that I don't know how to get length of the shortest path in n...
turing machines turing completeness
1
Find the odd shortest path is NL -- (turing machines turing completeness) <p>OddPath be a set of all G, s, t, such that G is a directed graph with a path from node s to node t, and the shortest such path has odd number of edges.</p>&#xA;&#xA;<p>How can I show OddPath is NL?&#xA;I think about it for a long time, the mai...
habedi/stack-exchange-dataset
74,339
Complexity of inserting an integer to an empty hashtable
<p>What's the complexity of inserting an integer $n$ to an empty hash table? My guess is that it's $O(\log n)$ as we require to scan every bit of $n$ to compute its hash. However, I often see it as $O(1)$. Am I mixing up things here ?</p>&#xA;
time complexity asymptotics hash tables
1
Complexity of inserting an integer to an empty hashtable -- (time complexity asymptotics hash tables) <p>What's the complexity of inserting an integer $n$ to an empty hash table? My guess is that it's $O(\log n)$ as we require to scan every bit of $n$ to compute its hash. However, I often see it as $O(1)$. Am I mixing...
habedi/stack-exchange-dataset
74,344
How can I prove that there is a decidable language which is not in P?
<p>Generally, I want to use the diagonal argument to prove it. I tried to define a language&nbsp;$A$ which is constructed by a Turing machine&nbsp;$D$:</p>&#xA;&#xA;<p>It will only take a input which has a form of a Turing machine&nbsp;$\langle M\rangle$ (the description of&nbsp;$M$) and simulate $M$ on&nbsp;$\langle M...
turing machines polynomial time semi decidability
1
How can I prove that there is a decidable language which is not in P? -- (turing machines polynomial time semi decidability) <p>Generally, I want to use the diagonal argument to prove it. I tried to define a language&nbsp;$A$ which is constructed by a Turing machine&nbsp;$D$:</p>&#xA;&#xA;<p>It will only take a input w...
habedi/stack-exchange-dataset
74,345
What does a solution to the Rectangle-Fit problem look like?
<p>I've been learning about NP-Complete problems, and came across the rectangle fit problem. Basically, the rectangle-fit problem is the problem of whether or not a set of 2d rectangles can fit in a larger 2d rectangle. What I have not been able to find, or solve myself, is what a possible solution looks like. </p>&#xA...
turing machines np complete np packing
1
What does a solution to the Rectangle-Fit problem look like? -- (turing machines np complete np packing) <p>I've been learning about NP-Complete problems, and came across the rectangle fit problem. Basically, the rectangle-fit problem is the problem of whether or not a set of 2d rectangles can fit in a larger 2d rectan...
habedi/stack-exchange-dataset
74,362
"not provable", what does this to do with unification?
<p>I found one interesting point in nominal unification. Just after proposition 2.16 of <a href="http://gabbay.org.uk/papers/nomu-jv.pdf" rel="nofollow noreferrer">Nominal Unification by Urban, Pitts, and Gabbay</a>, it said the following, which I found confusing:</p>&#xA;&#xA;<blockquote>&#xA; <p>For non-ground terms...
lambda calculus unification
1
"not provable", what does this to do with unification? -- (lambda calculus unification) <p>I found one interesting point in nominal unification. Just after proposition 2.16 of <a href="http://gabbay.org.uk/papers/nomu-jv.pdf" rel="nofollow noreferrer">Nominal Unification by Urban, Pitts, and Gabbay</a>, it said the fol...
habedi/stack-exchange-dataset
74,370
How did the Logic Theorist prove the Pons Asinorum?
<p>I was reading about the <a href="https://en.wikipedia.org/wiki/Logic_Theorist" rel="nofollow noreferrer">Logic Theorist</a> proving many of the Whitehead and Russell's <em>Principia</em>'s theorems. However, I cannot find any technical explanation on <em>how</em> the program proved those theorems and specifically wh...
artificial intelligence mathematical programming
1
How did the Logic Theorist prove the Pons Asinorum? -- (artificial intelligence mathematical programming) <p>I was reading about the <a href="https://en.wikipedia.org/wiki/Logic_Theorist" rel="nofollow noreferrer">Logic Theorist</a> proving many of the Whitehead and Russell's <em>Principia</em>'s theorems. However, I c...
habedi/stack-exchange-dataset
74,371
How to interpret plot of cost function in gradient descend algorithm?
<p>I have a data set to which I want to apply logistic regression. I set my cost function to be </p>&#xA;&#xA;<p>$J(\theta) = -\frac{1}{m} [\sum\limits_{i=1}^{m} y^{(i)} log{(h_\theta \cdot x^{(i)})} + (1-y^{(i)}) log(1-h_\theta(x^{(i)}))$</p>&#xA;&#xA;<p>and I am running gradient descend algorithm.</p>&#xA;&#xA;<p>Whe...
machine learning artificial intelligence
1
How to interpret plot of cost function in gradient descend algorithm? -- (machine learning artificial intelligence) <p>I have a data set to which I want to apply logistic regression. I set my cost function to be </p>&#xA;&#xA;<p>$J(\theta) = -\frac{1}{m} [\sum\limits_{i=1}^{m} y^{(i)} log{(h_\theta \cdot x^{(i)})} + (1...
habedi/stack-exchange-dataset
74,396
Does solving subproblems in logspace in different models implies solving original problem in logspace?
<p>Let's consider the following situation:</p>&#xA;&#xA;<p>We have a problem $\mathsf{L\text{}}$ . We would like to solve it in $LOGSPACE$. Let assume that our problem $\mathsf{L\text{}}$ can be divided to two parts: $A$ and $B$.</p>&#xA;&#xA;<p>We can solve $A$ using computatation model $M_1$ in $LOGSPACE$.</p>&#xA;&...
complexity theory
1
Does solving subproblems in logspace in different models implies solving original problem in logspace? -- (complexity theory) <p>Let's consider the following situation:</p>&#xA;&#xA;<p>We have a problem $\mathsf{L\text{}}$ . We would like to solve it in $LOGSPACE$. Let assume that our problem $\mathsf{L\text{}}$ can b...
habedi/stack-exchange-dataset
74,403
How does CFS prevent a long sleeping task from occupying the CPU?
<p>The Completely Fair Scheduler executes the task that has so far received the least share of CPU time and is thus the most 'disadvantaged'.&#xA;So if a task sleeps for a really long time, say 3hrs, how does CFS prevent this task from being executed for the next like 3hrs (to adapt its CPU share to the much larger val...
process scheduling
1
How does CFS prevent a long sleeping task from occupying the CPU? -- (process scheduling) <p>The Completely Fair Scheduler executes the task that has so far received the least share of CPU time and is thus the most 'disadvantaged'.&#xA;So if a task sleeps for a really long time, say 3hrs, how does CFS prevent this task...
habedi/stack-exchange-dataset
74,406
Dijkstra’s in a graph with negation of edges
<p>Let say I have a directed graph G with positive edges and I create a new graph, G', by replacing the weight of each edge by the negation of its weight in G. If for a given source vertex <em>s</em>, I compute all shortest path from <em>s</em> in G' using Dijkstra’s algorithm. Will the resulting paths in G’ be the lon...
algorithms graphs
1
Dijkstra’s in a graph with negation of edges -- (algorithms graphs) <p>Let say I have a directed graph G with positive edges and I create a new graph, G', by replacing the weight of each edge by the negation of its weight in G. If for a given source vertex <em>s</em>, I compute all shortest path from <em>s</em> in G' u...
habedi/stack-exchange-dataset
74,409
Time complexity of BFS with min heap
<p>Given a matrix of size m x n, I am trying to traverse it using BFS from top left corner to bottom right corner. Instead of using a normal queue for BFS, I am using a min heap. For each cell, I am inserting the adjacent values (top, left, right, bottom) in a min heap. &#xA;I am specifically trying to understand how b...
graphs algorithm analysis runtime analysis graph traversal heaps
1
Time complexity of BFS with min heap -- (graphs algorithm analysis runtime analysis graph traversal heaps) <p>Given a matrix of size m x n, I am trying to traverse it using BFS from top left corner to bottom right corner. Instead of using a normal queue for BFS, I am using a min heap. For each cell, I am inserting the ...
habedi/stack-exchange-dataset
74,421
adder in logisim using only 2-input-NAND gates
<p>I want to build an adder in logisim only with 2-input-NAND gates. The adder consists of 2 inputs (1 x constant 1 and 1 x arbitrary number) and an output.</p>&#xA;&#xA;<p>The first thing which came into my mind is a 8-bit full adder but maybe there is an easier solution for this (because of the constant 1). Has anyon...
computer architecture
1
adder in logisim using only 2-input-NAND gates -- (computer architecture) <p>I want to build an adder in logisim only with 2-input-NAND gates. The adder consists of 2 inputs (1 x constant 1 and 1 x arbitrary number) and an output.</p>&#xA;&#xA;<p>The first thing which came into my mind is a 8-bit full adder but maybe t...
habedi/stack-exchange-dataset
74,422
When using a hash and a collision occurs and linear probing is used how is that item found again
<p>How is the search for the item supposed to find the specific item if the data is all clumped together and all the search is given is the output of the hash function. I don't understand how it knows which of the pieces of data is the one that corresponds to the key if linear probing has been used so it could be any o...
hash tables
1
When using a hash and a collision occurs and linear probing is used how is that item found again -- (hash tables) <p>How is the search for the item supposed to find the specific item if the data is all clumped together and all the search is given is the output of the hash function. I don't understand how it knows which...
habedi/stack-exchange-dataset
74,432
Amdahl's law of processors (infinite processors to test limits of speedup)
<p>My processor noted that an <strong>infinite number of processors will allow me to test how much speedup I can achieve.</strong> </p>&#xA;&#xA;<p>I am not exactly sure how this applies. </p>&#xA;&#xA;<p>For instance, let's say I have a program that takes $1000$ seconds to execute and is broken into 4 phases(A, B, C, ...
parallel computing
1
Amdahl's law of processors (infinite processors to test limits of speedup) -- (parallel computing) <p>My processor noted that an <strong>infinite number of processors will allow me to test how much speedup I can achieve.</strong> </p>&#xA;&#xA;<p>I am not exactly sure how this applies. </p>&#xA;&#xA;<p>For instance, le...
habedi/stack-exchange-dataset
74,434
What is `wasted space` parameter and why is it O(n) for a linked list
<p>I'm reading a book on data structures and there is a comparison between linked list, array and dynamic array. The parameter name is <em>wasted space</em>. Here are the values:</p>&#xA;&#xA;<p>\begin{array}{cc}&#xA; \text{Linked list} &amp; O(n)\\&#xA; \text{array} &amp; 0 \\&#xA; \text{dynamic array}...
data structures arrays linked lists
1
What is `wasted space` parameter and why is it O(n) for a linked list -- (data structures arrays linked lists) <p>I'm reading a book on data structures and there is a comparison between linked list, array and dynamic array. The parameter name is <em>wasted space</em>. Here are the values:</p>&#xA;&#xA;<p>\begin{array}{...
habedi/stack-exchange-dataset
74,437
Insertion and deletion complexities for a linked list and array
<p>I have the following table that compares different operation complexities for a linked list and array:</p>&#xA;&#xA;<pre><code> Linked List | Array | Dynamic Array&#xA;Deletion at ending O(n) | O(1) | O(n)&#xA;Insertion in middle O(n) | O(n) | O(n)&#x...
data structures arrays linked lists
1
Insertion and deletion complexities for a linked list and array -- (data structures arrays linked lists) <p>I have the following table that compares different operation complexities for a linked list and array:</p>&#xA;&#xA;<pre><code> Linked List | Array | Dynamic Array&#xA;Deletion at end...
habedi/stack-exchange-dataset
74,449
Induction rules for reflexive, transitive closure
<p>I'm trying to solve an exercise on inductive definitions, the premiss is:</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>Let $\to$ be a relation on $A$ and $\to^*$ its reflexive, transitive closure, which is defined by following two rules:</p>&#xA;&#xA;<ol>&#xA;<li>$a \to^*a$ (reflexive)</li>&#xA;<li>${a \to^*b \quad b \to c \over a...
logic proof techniques first order logic induction
1
Induction rules for reflexive, transitive closure -- (logic proof techniques first order logic induction) <p>I'm trying to solve an exercise on inductive definitions, the premiss is:</p>&#xA;&#xA;<hr>&#xA;&#xA;<p>Let $\to$ be a relation on $A$ and $\to^*$ its reflexive, transitive closure, which is defined by following...
habedi/stack-exchange-dataset
74,466
Using amplification lemma to decrease error probability gives 0 as divisor
<p>I am attempting to work through an example of how to select an error bound, and then determine the number of simulations necessary by the amplification lemma to obtain the desired error bound. I have probabilistic Turing machine $M$ with an error probability of $.5$. I'd like an error bound of $.25$, so I will bound...
turing machines probability theory probabilistic algorithms
1
Using amplification lemma to decrease error probability gives 0 as divisor -- (turing machines probability theory probabilistic algorithms) <p>I am attempting to work through an example of how to select an error bound, and then determine the number of simulations necessary by the amplification lemma to obtain the desir...
habedi/stack-exchange-dataset
74,467
Finding a unambiguous grammar
<p>As an exercise we were supposed to find a grammar $G$ that generates language $L(G) = \{w \in \{a,b\}^* \mid |w|_a = |w|_b\}$.&#xA;That was not so hard, I found a grammar which I think is correct:</p>&#xA;&#xA;<p>$S \longrightarrow bA \mid aB$</p>&#xA;&#xA;<p>$A \longrightarrow a \mid aS \mid bAA$</p>&#xA;&#xA;<p>$...
context free formal grammars ambiguity
1
Finding a unambiguous grammar -- (context free formal grammars ambiguity) <p>As an exercise we were supposed to find a grammar $G$ that generates language $L(G) = \{w \in \{a,b\}^* \mid |w|_a = |w|_b\}$.&#xA;That was not so hard, I found a grammar which I think is correct:</p>&#xA;&#xA;<p>$S \longrightarrow bA \mid aB...
habedi/stack-exchange-dataset
74,468
Is $K(b|a) \geq 1$ if $a\neq b$?
<p>Since $K(a|a) = 0$, is $K(b|a) \geq 1$ when $a\neq b$, as we need at least one bit to distinguish between $K(a|a)$ and $K(b|a)$? If not true in general, is it true if $a$ and $b$ are elegant programs?</p>&#xA;
kolmogorov complexity
1
Is $K(b|a) \geq 1$ if $a\neq b$? -- (kolmogorov complexity) <p>Since $K(a|a) = 0$, is $K(b|a) \geq 1$ when $a\neq b$, as we need at least one bit to distinguish between $K(a|a)$ and $K(b|a)$? If not true in general, is it true if $a$ and $b$ are elegant programs?</p>&#xA;
habedi/stack-exchange-dataset
74,480
Isolation lemma
<p>Here is a link to the isolation lemma. Please refer to the statement and Spencer's proof at the given link.</p>&#xA;&#xA;<p><a href="https://en.wikipedia.org/wiki/Isolation_lemma" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Isolation_lemma</a> </p>&#xA;&#xA;<p>In its statement, shouldn't there be a condi...
complexity theory
1
Isolation lemma -- (complexity theory) <p>Here is a link to the isolation lemma. Please refer to the statement and Spencer's proof at the given link.</p>&#xA;&#xA;<p><a href="https://en.wikipedia.org/wiki/Isolation_lemma" rel="nofollow noreferrer">https://en.wikipedia.org/wiki/Isolation_lemma</a> </p>&#xA;&#xA;<p>In it...
habedi/stack-exchange-dataset
74,481
Sorting in sub-quadratic time and logspace simultaneously
<p>On a standard computing model that reflects reality for <em>sequential</em> processing, such as a RAM machine with penalized access time for growing memory, can a comparison sort algorithm work in both logspace yet sub-quadratic time?</p>&#xA;&#xA;<p>Standard algorithms for sorting are O(n*log(n)) time yet I've foun...
complexity theory sorting
1
Sorting in sub-quadratic time and logspace simultaneously -- (complexity theory sorting) <p>On a standard computing model that reflects reality for <em>sequential</em> processing, such as a RAM machine with penalized access time for growing memory, can a comparison sort algorithm work in both logspace yet sub-quadratic...
habedi/stack-exchange-dataset
74,488
Measuring difference between two sets of neural network weights?
<p>Suppose that we take a neural network of a given topology, and run it through two training processes, obtaining two different sets of converged weights at the end of the training.</p>&#xA;&#xA;<p>What is a good way to measure the difference between the two sets of weights?</p>&#xA;&#xA;<p>If this were a curve-fit wh...
neural networks
1
Measuring difference between two sets of neural network weights? -- (neural networks) <p>Suppose that we take a neural network of a given topology, and run it through two training processes, obtaining two different sets of converged weights at the end of the training.</p>&#xA;&#xA;<p>What is a good way to measure the d...
habedi/stack-exchange-dataset
74,505
What is the whole picture of the NP-hardness proof of Super Mario Bros?
<p>I am reading the NP-hardness proof of Super Mario Bros. in the paper <a href="https://arxiv.org/abs/1203.1895" rel="nofollow noreferrer">"Classic Nintendo Games are (Computationally) Hard" by Greg Aloupis, Erik D. Demaine, Alan Guo, and Giovanni Viglietta</a>. </p>&#xA;&#xA;<p>I can get the basic idea of the proof f...
complexity theory reductions np hard 3 sat
1
What is the whole picture of the NP-hardness proof of Super Mario Bros? -- (complexity theory reductions np hard 3 sat) <p>I am reading the NP-hardness proof of Super Mario Bros. in the paper <a href="https://arxiv.org/abs/1203.1895" rel="nofollow noreferrer">"Classic Nintendo Games are (Computationally) Hard" by Greg ...
habedi/stack-exchange-dataset
74,506
Regular Languages in $ \mathsf{\text{}NC^1}$
<p><strong>Theorem</strong> : To prove $ \mathsf{\text{} Regular} \subseteq \mathsf{\text{}NC^1}$. </p>&#xA;&#xA;<p>To prove the theorem stated above we need some theorems and definitions given below :</p>&#xA;&#xA;<p><strong>Barrington Theorem</strong> : A <a href="https://en.wikipedia.org/wiki/NC_(complexity)" rel="n...
complexity theory regular languages reference request circuits
1
Regular Languages in $ \mathsf{\text{}NC^1}$ -- (complexity theory regular languages reference request circuits) <p><strong>Theorem</strong> : To prove $ \mathsf{\text{} Regular} \subseteq \mathsf{\text{}NC^1}$. </p>&#xA;&#xA;<p>To prove the theorem stated above we need some theorems and definitions given below :</p>&#...
habedi/stack-exchange-dataset
74,513
How can languages that are E-complete have sub-exponential size circuits?
<p>The question whether there exist languages in $\mathsf{E}$ that require circuits of size $\Omega(2^{\delta n})$ for some $\delta &gt; 0$ is open, and this would imply some derandomization results. </p>&#xA;&#xA;<p>Suppose we have a language $L$ which is complete for $\mathsf{E}$. Then, how can $L$ have sub-exponenti...
complexity theory circuits
1
How can languages that are E-complete have sub-exponential size circuits? -- (complexity theory circuits) <p>The question whether there exist languages in $\mathsf{E}$ that require circuits of size $\Omega(2^{\delta n})$ for some $\delta &gt; 0$ is open, and this would imply some derandomization results. </p>&#xA;&#xA;...
habedi/stack-exchange-dataset
74,515
Can we count the number of inversions in time $\mathcal{O}(n)$?
<p>It is possible to find the total number of inversions by $\mathcal{O}(n\log{}n)$ running time (extension of merge-sort algorithm for example). </p>&#xA;&#xA;<p>Is there more asymptotically efficient way to do it? $\mathcal{O}(n)$? &#xA;Or is there any proof that’s not possible?</p>&#xA;
complexity theory asymptotics lower bounds permutations
1
Can we count the number of inversions in time $\mathcal{O}(n)$? -- (complexity theory asymptotics lower bounds permutations) <p>It is possible to find the total number of inversions by $\mathcal{O}(n\log{}n)$ running time (extension of merge-sort algorithm for example). </p>&#xA;&#xA;<p>Is there more asymptotically eff...
habedi/stack-exchange-dataset
74,516
A question about an input in a Halting Problem proof
<p>Here is my Halting Problem proof, that largely mirrors other (non-diagonalizing) proofs that I've seen.</p>&#xA;&#xA;<ol>&#xA;<li>$H(p,i)$ returns $1$ if program $p$ halts on input $i$.</li>&#xA;<li>$H(p,i)$ returns $0$ if program $p$ does not halt on input $i$.</li>&#xA;<li>Let $f(t,t)$ be an interface for any prog...
computability undecidability proof techniques halting problem
1
A question about an input in a Halting Problem proof -- (computability undecidability proof techniques halting problem) <p>Here is my Halting Problem proof, that largely mirrors other (non-diagonalizing) proofs that I've seen.</p>&#xA;&#xA;<ol>&#xA;<li>$H(p,i)$ returns $1$ if program $p$ halts on input $i$.</li>&#xA;<l...
habedi/stack-exchange-dataset
74,517
How to construct a sequence of polynomial-time Turing machines
<p>I know that similar questions have been asked before but I still wasn't able to find answers to all my questions.</p>&#xA;&#xA;<p>In many proofs in complexity theory we use an enumeration of some $T(n)$-time Turing machines. For simplicity, let's consider polynomial-time TM's. I want to know exactly how we construct...
complexity theory turing machines time complexity
1
How to construct a sequence of polynomial-time Turing machines -- (complexity theory turing machines time complexity) <p>I know that similar questions have been asked before but I still wasn't able to find answers to all my questions.</p>&#xA;&#xA;<p>In many proofs in complexity theory we use an enumeration of some $T(...
habedi/stack-exchange-dataset
74,520
Broadcasting on a dynamic grid
<p>We are given a $n \times n$ grid, where each node can maintain a single "active" edge with one of its 4 neighbors at each time step. The active edge of each node changes periodically clockwise or anticlockwise, in the sense that if, for example, at time $t$ node $v$ has an active edge with its upper neighbor, and it...
graphs discrete mathematics agent based computing
1
Broadcasting on a dynamic grid -- (graphs discrete mathematics agent based computing) <p>We are given a $n \times n$ grid, where each node can maintain a single "active" edge with one of its 4 neighbors at each time step. The active edge of each node changes periodically clockwise or anticlockwise, in the sense that if...
habedi/stack-exchange-dataset
74,523
Can a 1-tape turing machine simulate a stack?
<p>Is it possible to simulate a stack-based machine using a 1-tape turing machine? I cannot wrap my head around it as turing machines do not provide mechanisms such as pointers.</p>&#xA;&#xA;<p>I failed to find any examples or explanations. If it is possible, how?</p>&#xA;
turing machines computation models stacks
1
Can a 1-tape turing machine simulate a stack? -- (turing machines computation models stacks) <p>Is it possible to simulate a stack-based machine using a 1-tape turing machine? I cannot wrap my head around it as turing machines do not provide mechanisms such as pointers.</p>&#xA;&#xA;<p>I failed to find any examples or ...
habedi/stack-exchange-dataset
74,526
Finding best three numbers of an array
<blockquote>&#xA;<p>Given a sorted array of <span class="math-container">$n$</span> integers ,and some other integer <span class="math-container">$m$</span>, find the <span class="math-container">$3$</span> numbers in the array <span class="math-container">$x,y,z$</span> such that <span class="math-container">$x+y+z\ge...
algorithms optimization arrays
1
Finding best three numbers of an array -- (algorithms optimization arrays) <blockquote>&#xA;<p>Given a sorted array of <span class="math-container">$n$</span> integers ,and some other integer <span class="math-container">$m$</span>, find the <span class="math-container">$3$</span> numbers in the array <span class="math...
habedi/stack-exchange-dataset
74,555
Trouble understanding Grammar Rules
<p>I am totaly new to theoretical computer science, so I am sorry if I get the terminology wrong:</p>&#xA;&#xA;<p>I was reading the definition of a grammar, what I didn't get was the formal definition of the production rules:&#xA;Let V be the set of Variables and sigma the alphabet. Let P be the set of Rules or product...
formal grammars notation
1
Trouble understanding Grammar Rules -- (formal grammars notation) <p>I am totaly new to theoretical computer science, so I am sorry if I get the terminology wrong:</p>&#xA;&#xA;<p>I was reading the definition of a grammar, what I didn't get was the formal definition of the production rules:&#xA;Let V be the set of Vari...
habedi/stack-exchange-dataset
74,559
How to fill cell-network partition matrix of a function?
<p>I'm trying to understand a paper (Tandem Networks of Universal Cells, Butler, 1978 <a href="https://doi.org/10.1109/TC.1978.1675199" rel="nofollow noreferrer">1</a>), but I can't make it past the first paragraph: </p>&#xA;&#xA;<blockquote>&#xA;Consider the $x_l … x_{k - 1} | x_k$ partition matrix of a function $f(&...
boolean algebra
1
How to fill cell-network partition matrix of a function? -- (boolean algebra) <p>I'm trying to understand a paper (Tandem Networks of Universal Cells, Butler, 1978 <a href="https://doi.org/10.1109/TC.1978.1675199" rel="nofollow noreferrer">1</a>), but I can't make it past the first paragraph: </p>&#xA;&#xA;<blockquote...
habedi/stack-exchange-dataset
74,567
Avoiding overflows while computing $e^x$ by Taylor series
<p>I'm coding a program to calculate the value of $e^x$ by using the Taylor expansion, that is:</p>&#xA;&#xA;<p>$$ e^x =\sum_{k=0}^\infty \frac{x^k}{k!} $$</p>&#xA;&#xA;<pre><code>from math import factorial&#xA;def e_x(x, n):&#xA; return sum(pow(x, k)/factorial(k) for k in range(n))&#xA;</code></pre>&#xA;&#xA;<p>Edi...
algorithms numerical algorithms numerical analysis error estimation
1
Avoiding overflows while computing $e^x$ by Taylor series -- (algorithms numerical algorithms numerical analysis error estimation) <p>I'm coding a program to calculate the value of $e^x$ by using the Taylor expansion, that is:</p>&#xA;&#xA;<p>$$ e^x =\sum_{k=0}^\infty \frac{x^k}{k!} $$</p>&#xA;&#xA;<pre><code>from math...
habedi/stack-exchange-dataset
74,580
How to study for the Algorithm courses
<p>I'm taking a fairly challenging Algorithm course, in which we are learning about algorithms such as Dijkstra, Bellman-Ford etc. as well as the algorithm design patterns such as recursions, DP and various graph construction techniques such as layering. Now I really have some trouble to design correct and efficient al...
algorithms
1
How to study for the Algorithm courses -- (algorithms) <p>I'm taking a fairly challenging Algorithm course, in which we are learning about algorithms such as Dijkstra, Bellman-Ford etc. as well as the algorithm design patterns such as recursions, DP and various graph construction techniques such as layering. Now I real...
habedi/stack-exchange-dataset
74,583
How to prove that finding math proofs is $\text{NP}$-hard?
<p>This is Exercise 2.11 of the book &quot;Computational Complexity: A Modern Approach&quot; by Arora and Barak.</p>&#xA;<blockquote>&#xA;<p>Mathematics can be axiomatized using for example the <em>Zermelo-Frankel</em> system, which has a finite description. Argue at a high level that the following language is <span cl...
complexity theory np complete reductions np hard np
1
How to prove that finding math proofs is $\text{NP}$-hard? -- (complexity theory np complete reductions np hard np) <p>This is Exercise 2.11 of the book &quot;Computational Complexity: A Modern Approach&quot; by Arora and Barak.</p>&#xA;<blockquote>&#xA;<p>Mathematics can be axiomatized using for example the <em>Zermel...
habedi/stack-exchange-dataset
74,594
Equivalence between alternative definitions of NP
<p>I'm having some problems in understanding the two alternative definitions of NP. They're presented as equivalent, but to me they seem to define different class of problems. Intuitively, we can think of a non-deterministic TM as branching at every step to check all possible alternatives in parallel. Also, we can see ...
complexity theory computability turing machines np nondeterminism
1
Equivalence between alternative definitions of NP -- (complexity theory computability turing machines np nondeterminism) <p>I'm having some problems in understanding the two alternative definitions of NP. They're presented as equivalent, but to me they seem to define different class of problems. Intuitively, we can thi...
habedi/stack-exchange-dataset
74,600
For a regular language $L$, is $\{xy^Rz:xyz\in L\}$ regular?
<blockquote>&#xA; <p>For a regular language $L$, is $\{xy^Rz:xyz\in L\}$ regular?</p>&#xA;</blockquote>&#xA;&#xA;<p>[Where $w^R$ is the reverse of $w$]</p>&#xA;&#xA;<p>My intuition says it is, as for a regular $L$, the languages $L^*$, $\{y: xyz\in L\}$ and $L^R$ are all regular languages, but I wasn't able to build a...
formal languages regular languages closure properties
1
For a regular language $L$, is $\{xy^Rz:xyz\in L\}$ regular? -- (formal languages regular languages closure properties) <blockquote>&#xA; <p>For a regular language $L$, is $\{xy^Rz:xyz\in L\}$ regular?</p>&#xA;</blockquote>&#xA;&#xA;<p>[Where $w^R$ is the reverse of $w$]</p>&#xA;&#xA;<p>My intuition says it is, as for...
habedi/stack-exchange-dataset
74,601
Finding maximal independent sets in an independence system
<p>An <a href="https://en.wikipedia.org/wiki/Independence_system" rel="nofollow noreferrer">independence system</a> is a collection $I$ of subsets of $\Omega$ such that if $A\in I$, then any subset of $A$ is in $I$. These sets are called independent.</p>&#xA;&#xA;<p>Suppose I have an oracle for testing independence. In...
algorithms optimization sets
1
Finding maximal independent sets in an independence system -- (algorithms optimization sets) <p>An <a href="https://en.wikipedia.org/wiki/Independence_system" rel="nofollow noreferrer">independence system</a> is a collection $I$ of subsets of $\Omega$ such that if $A\in I$, then any subset of $A$ is in $I$. These sets ...
habedi/stack-exchange-dataset
74,608
Understanding the reduction of REGULARTM from ATM
<p>REGULARTM is defined as below:</p>&#xA;&#xA;<pre><code>REGULARTM ={γ€ˆM〉| M is a TM and L(M)is a regular language}.&#xA;</code></pre>&#xA;&#xA;<p>I am trying to understand the proof of REGULARTM being undecidable from Sipser's book "Introduction to the Theory of Computation". The book says:</p>&#xA;&#xA;<pre><code>We ...
turing machines reductions undecidability halting problem
1
Understanding the reduction of REGULARTM from ATM -- (turing machines reductions undecidability halting problem) <p>REGULARTM is defined as below:</p>&#xA;&#xA;<pre><code>REGULARTM ={γ€ˆM〉| M is a TM and L(M)is a regular language}.&#xA;</code></pre>&#xA;&#xA;<p>I am trying to understand the proof of REGULARTM being undec...
habedi/stack-exchange-dataset
74,611
What will be the time complexity for the following search algorithm in a graph?
<p>I have a graph which looks something like below&#xA;<a href="https://i.stack.imgur.com/sUD1w.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sUD1w.png" alt="Search"></a></p>&#xA;&#xA;<p>I am searching for a given string <code>s</code> going down such that at every node it makes a decision (either...
algorithm analysis data structures runtime analysis combinatorics graph traversal
1
What will be the time complexity for the following search algorithm in a graph? -- (algorithm analysis data structures runtime analysis combinatorics graph traversal) <p>I have a graph which looks something like below&#xA;<a href="https://i.stack.imgur.com/sUD1w.png" rel="nofollow noreferrer"><img src="https://i.stack....
habedi/stack-exchange-dataset
74,615
Can a Turing Machine run for infinitely many steps and halt?
<p>Is it possible for an ordinary Turing Machine, for some input x, to run for an infinite number of steps but also halt? Or do we say that Turing Machine does not halt on x?</p>&#xA;
turing machines
1
Can a Turing Machine run for infinitely many steps and halt? -- (turing machines) <p>Is it possible for an ordinary Turing Machine, for some input x, to run for an infinite number of steps but also halt? Or do we say that Turing Machine does not halt on x?</p>&#xA;
habedi/stack-exchange-dataset
74,616
What's the average number of clauses modern SAT solvers can handle?
<p>It's already known that size doesn't matter always (for SAT problems). </p>&#xA;&#xA;<p><strong>But is there evidence (from real data from: benchmarks or real cases) on how many clauses an average SAT solver can handle nowadays?</strong></p>&#xA;&#xA;<p>Another issue that derives is that once they find a solution, m...
satisfiability sat solvers
1
What's the average number of clauses modern SAT solvers can handle? -- (satisfiability sat solvers) <p>It's already known that size doesn't matter always (for SAT problems). </p>&#xA;&#xA;<p><strong>But is there evidence (from real data from: benchmarks or real cases) on how many clauses an average SAT solver can handl...
habedi/stack-exchange-dataset
74,618
Must reductions be injective?
<p>From Sipser,</p>&#xA;&#xA;<p>Language A is mapping reducible to language B, written $A \leq_m B$,&#xA;if there is a computable function $f : \Sigma^* \rightarrow \Sigma^*$, where for every $w$, $w ∈ A \Leftrightarrow f(w) \in B$. The function $f$ is called the reduction from A to B.</p>&#xA;&#xA;<p>A function is inj...
complexity theory reductions
1
Must reductions be injective? -- (complexity theory reductions) <p>From Sipser,</p>&#xA;&#xA;<p>Language A is mapping reducible to language B, written $A \leq_m B$,&#xA;if there is a computable function $f : \Sigma^* \rightarrow \Sigma^*$, where for every $w$, $w ∈ A \Leftrightarrow f(w) \in B$. The function $f$ is cal...
habedi/stack-exchange-dataset
74,641
Time complexity of art gallery-like problem
<p>Suppose that $G = (V,E)$ is a directed graph such that each vertex in $V$ is in at least one edge in $E$. We'd like to decide whether or not $w$ watchmen can be placed on $w$ distinct vertices in $G$ such that every vertex in $G$ is being "watched" by some watchman. More formally, we'd like to decide whether there e...
complexity theory graphs polynomial time
1
Time complexity of art gallery-like problem -- (complexity theory graphs polynomial time) <p>Suppose that $G = (V,E)$ is a directed graph such that each vertex in $V$ is in at least one edge in $E$. We'd like to decide whether or not $w$ watchmen can be placed on $w$ distinct vertices in $G$ such that every vertex in $...
habedi/stack-exchange-dataset
74,648
unambiguous grammar but it's not LR(1)
<p>I have following grammar:</p>&#xA;&#xA;<p>$$A \to a A a \mid \varepsilon$$</p>&#xA;&#xA;<p>This grammar is not ambiguous because it has no more than one parse tree from the any sentence generated by this grammar, but there is a shift-reduce conflict in LR(1) on this grammar.</p>&#xA;&#xA;<p>Why does there exist an c...
formal languages context free compilers
1
unambiguous grammar but it's not LR(1) -- (formal languages context free compilers) <p>I have following grammar:</p>&#xA;&#xA;<p>$$A \to a A a \mid \varepsilon$$</p>&#xA;&#xA;<p>This grammar is not ambiguous because it has no more than one parse tree from the any sentence generated by this grammar, but there is a shift...
habedi/stack-exchange-dataset
74,678
What if there is a polynomial-time algorithm to minimize NFA?
<p>Knowing that NFA-minimization has been proven to be P-SPACE complete, what if there is a polynomial-time algorithm to minimize NFA? Does that imply that P = PSPACE?</p>&#xA;
complexity theory automata space complexity
1
What if there is a polynomial-time algorithm to minimize NFA? -- (complexity theory automata space complexity) <p>Knowing that NFA-minimization has been proven to be P-SPACE complete, what if there is a polynomial-time algorithm to minimize NFA? Does that imply that P = PSPACE?</p>&#xA;
habedi/stack-exchange-dataset
74,687
Design a turing machine that accepts $L=\{ww^Rw\mid w\in\{0,1\}^*\}$
<blockquote>&#xA;<p>I need to design a turing machine that accepts <span class="math-container">$L=\{ww^Rw\mid w\in\{0,1\}^*\}$</span>.</p>&#xA;<p><span class="math-container">$w^R$</span> is the reverse of <span class="math-container">$w$</span>.</p>&#xA;</blockquote>&#xA;<p>I don't have a good idea yet how to do that...
turing machines
1
Design a turing machine that accepts $L=\{ww^Rw\mid w\in\{0,1\}^*\}$ -- (turing machines) <blockquote>&#xA;<p>I need to design a turing machine that accepts <span class="math-container">$L=\{ww^Rw\mid w\in\{0,1\}^*\}$</span>.</p>&#xA;<p><span class="math-container">$w^R$</span> is the reverse of <span class="math-conta...
habedi/stack-exchange-dataset
74,690
What is the abstract idea of a semaphore and how can we use it to implement mutual exclusion?
<p>So I've got this so far to try and wrap my head around the <strong>abstract idea</strong> of a semaphore:</p>&#xA;&#xA;<blockquote>&#xA; <p>A semaphore is a variable or abstract datatype (commonly an integer),&#xA; used to control access to a common resource by multiple processes in a&#xA; concurrent system.</p>&...
concurrency mutual exclusion
1
What is the abstract idea of a semaphore and how can we use it to implement mutual exclusion? -- (concurrency mutual exclusion) <p>So I've got this so far to try and wrap my head around the <strong>abstract idea</strong> of a semaphore:</p>&#xA;&#xA;<blockquote>&#xA; <p>A semaphore is a variable or abstract datatype (...
habedi/stack-exchange-dataset
74,692
How can CFGs have epsilon rules if CSG may not have them?
<p>I am new to theory of computer science and I am currently reading about CTF grammars. In our lecture we defined that a Type 1 grammar is context-free if for $w_1 \to w_2$, $\vert w_1 \vert \leq \vert w_2 \vert$.</p>&#xA;&#xA;<p>I looked on the internet for an example and found this context-free grammar for palindrom...
context free formal grammars chomsky hierarchy
1
How can CFGs have epsilon rules if CSG may not have them? -- (context free formal grammars chomsky hierarchy) <p>I am new to theory of computer science and I am currently reading about CTF grammars. In our lecture we defined that a Type 1 grammar is context-free if for $w_1 \to w_2$, $\vert w_1 \vert \leq \vert w_2 \ve...
habedi/stack-exchange-dataset
74,701
How can ws with |w| = |s| and w β‰  s be context-free while w#s is not?
<p>Why does (if so) the seperator <span class="math-container">$\#$</span> is making a difference between the two languages ?</p>&#xA;&#xA;<p>Let say:</p>&#xA;&#xA;<p><span class="math-container">$L=\{ws : |w|=|s|\, w,s\in \{0,1\}^{*}, w \neq s \}$</span></p>&#xA;&#xA;<p><span class="math-container">$L_{\#}=\{w\#s : |...
formal languages context free pumping lemma
1
How can ws with |w| = |s| and w β‰  s be context-free while w#s is not? -- (formal languages context free pumping lemma) <p>Why does (if so) the seperator <span class="math-container">$\#$</span> is making a difference between the two languages ?</p>&#xA;&#xA;<p>Let say:</p>&#xA;&#xA;<p><span class="math-container">$L=\...
habedi/stack-exchange-dataset
74,714
Why is Heapsort in O(n log n) if not all n operations take time log n?
<p>let's consider that we already have constructed heap array.</p>&#xA;&#xA;<p>so from this, when we do heap sort, the number of elements that have to be sorted decreased. I mean heap decrease.(which also means heap tree level decreases -> <strong>downheap</strong> operation level decreases</p>&#xA;&#xA;<p>but <code>nl...
algorithm analysis runtime analysis sorting heaps heap sort
1
Why is Heapsort in O(n log n) if not all n operations take time log n? -- (algorithm analysis runtime analysis sorting heaps heap sort) <p>let's consider that we already have constructed heap array.</p>&#xA;&#xA;<p>so from this, when we do heap sort, the number of elements that have to be sorted decreased. I mean heap ...
habedi/stack-exchange-dataset
74,725
Selection of pivot in quicksort partitioning of Hoare and Lomuto
<p>There are two commonly mentioned partition methods:</p>&#xA;&#xA;<pre><code>algorithm lomuto_partition(A, lo, hi) is&#xA;pivot := A[hi]&#xA;i := lo - 1 &#xA;for j := lo to hi - 1 do&#xA; if A[j] ≀ pivot then&#xA; i := i + 1&#xA; swap A[i] with A[j]&#xA;swap A[i+1] with A[hi]&#xA;return i + 1&#xA;...
algorithms sorting quicksort
1
Selection of pivot in quicksort partitioning of Hoare and Lomuto -- (algorithms sorting quicksort) <p>There are two commonly mentioned partition methods:</p>&#xA;&#xA;<pre><code>algorithm lomuto_partition(A, lo, hi) is&#xA;pivot := A[hi]&#xA;i := lo - 1 &#xA;for j := lo to hi - 1 do&#xA; if A[j] ≀ pivot then&#xA;...
habedi/stack-exchange-dataset
74,730
Misunderstanding of proof with transitivity of logspace reduction
<p>I read a commonly known proof of transitivity of logspace reduction:&#xA;<em>Lemma 6.</em>: <a href="http://www.cs.au.dk/~arnsfelt/CT10/scribenotes/lecture5.pdf" rel="nofollow noreferrer">http://www.cs.au.dk/~arnsfelt/CT10/scribenotes/lecture5.pdf</a>&#xA;. In this proof it is used following trick: Let some turing ...
complexity theory turing machines reductions
1
Misunderstanding of proof with transitivity of logspace reduction -- (complexity theory turing machines reductions) <p>I read a commonly known proof of transitivity of logspace reduction:&#xA;<em>Lemma 6.</em>: <a href="http://www.cs.au.dk/~arnsfelt/CT10/scribenotes/lecture5.pdf" rel="nofollow noreferrer">http://www.cs...
habedi/stack-exchange-dataset
74,741
Looking for an "intuitive" regular expression for $\{ w \in \Sigma^{\ast} \mid 2|w|_1 + |w|_0 \equiv 0 \pmod{3} \}$
<p>Let $L \subseteq \Sigma^{\ast}$ with $\Sigma = \{0,1\}$ be the language such that two times the number of $1$'s in a word in $L$ plus the number of $0$'s is divisible by $3$, i.e. if we denote by $|w|_1$ the number the symbol $1$ occurs in $w$ and by $|w|_0$ the number the symbols $0$ occurs, then&#xA;$$&#xA; L = \{...
formal languages automata regular languages regular expressions
1
Looking for an "intuitive" regular expression for $\{ w \in \Sigma^{\ast} \mid 2|w|_1 + |w|_0 \equiv 0 \pmod{3} \}$ -- (formal languages automata regular languages regular expressions) <p>Let $L \subseteq \Sigma^{\ast}$ with $\Sigma = \{0,1\}$ be the language such that two times the number of $1$'s in a word in $L$ plu...
habedi/stack-exchange-dataset