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
29,472
Finding all partitions of a set s.t. each block contains exactly one subset from a given set of subsets - how hopeless?
<p>Hello and apologies if my question will be too elementary. My background is from arithmetic geometry, but I have been recently faced with certain computational problems of combinatorial nature, where I feel way out of my league, so I will definitely appreciate some clarity on the matter :)</p>&#xA;&#xA;<p>Long story...
algorithms combinatorics efficiency partitions
1
Finding all partitions of a set s.t. each block contains exactly one subset from a given set of subsets - how hopeless? -- (algorithms combinatorics efficiency partitions) <p>Hello and apologies if my question will be too elementary. My background is from arithmetic geometry, but I have been recently faced with certain...
habedi/stack-exchange-dataset
29,475
How to fool the "try some test cases" heuristic: Algorithms that appear correct, but are actually incorrect
<p>To try to test whether an algorithm for some problem is correct, the usual starting point is to try running the algorithm by hand on a number of simple test cases -- try it on a few example problem instances, including a few simple "corner cases". This is a great heuristic: it's a great way to quickly weed out many...
algorithms algorithm analysis education correctness proof didactics
1
How to fool the "try some test cases" heuristic: Algorithms that appear correct, but are actually incorrect -- (algorithms algorithm analysis education correctness proof didactics) <p>To try to test whether an algorithm for some problem is correct, the usual starting point is to try running the algorithm by hand on a n...
habedi/stack-exchange-dataset
29,482
Is finding a solution of a satisfiability problem harder than deciding satisfiability?
<p>Is the problem of determining whether or not a given Boolean expression is satisfiable computationally distinct from actually finding a solution to the expression?</p>&#xA;&#xA;<p>In other words, is there another way of finding that a given expression is satisfiable without explicitly determining the 'right settings...
complexity theory satisfiability
1
Is finding a solution of a satisfiability problem harder than deciding satisfiability? -- (complexity theory satisfiability) <p>Is the problem of determining whether or not a given Boolean expression is satisfiable computationally distinct from actually finding a solution to the expression?</p>&#xA;&#xA;<p>In other wor...
habedi/stack-exchange-dataset
29,487
What does the processor do while waiting for a main memory fetch
<p>Assuming l1 and l2 cache requests result in a miss, does the processor stall until main memory has been accessed?</p>&#xA;&#xA;<p>I heard about the idea of switching to another thread, if so what is used to wake up the stalled thread?</p>&#xA;
computer architecture cpu cache cpu pipelines
1
What does the processor do while waiting for a main memory fetch -- (computer architecture cpu cache cpu pipelines) <p>Assuming l1 and l2 cache requests result in a miss, does the processor stall until main memory has been accessed?</p>&#xA;&#xA;<p>I heard about the idea of switching to another thread, if so what is us...
habedi/stack-exchange-dataset
29,503
Which article in front of O(.), Ω(.), ...?
<p>Writing a survey, I am confronted to a very difficult and -- I dare say -- deep issue: I have many sentences mentioning or stating results of the form <em>"a $\Omega(\sqrt{n})$ lower bound"</em>, or <em>"a $O(\sqrt{n}/\varepsilon^2)$ algorithm"</em>. And I am struggling to decide whether I should use "a" or "an" in ...
terminology asymptotics landau notation
1
Which article in front of O(.), Ω(.), ...? -- (terminology asymptotics landau notation) <p>Writing a survey, I am confronted to a very difficult and -- I dare say -- deep issue: I have many sentences mentioning or stating results of the form <em>"a $\Omega(\sqrt{n})$ lower bound"</em>, or <em>"a $O(\sqrt{n}/\varepsilon...
habedi/stack-exchange-dataset
29,508
Finding the max XOR of two numbers in an interval: can we do better than quadratic?
<p>Suppose we're given two numbers $l$ and $r$ and that we want to find $\max{(i\oplus j)}$ for $l\le i,\,j\le r$.</p>&#xA;&#xA;<p>The naïve algorithm simply checks all possible pairs; for instance in ruby we'd have:</p>&#xA;&#xA;<pre><code>def max_xor(l, r)&#xA; max = 0&#xA;&#xA; (l..r).each do |i|&#xA; (i..r).ea...
algorithms
1
Finding the max XOR of two numbers in an interval: can we do better than quadratic? -- (algorithms) <p>Suppose we're given two numbers $l$ and $r$ and that we want to find $\max{(i\oplus j)}$ for $l\le i,\,j\le r$.</p>&#xA;&#xA;<p>The naïve algorithm simply checks all possible pairs; for instance in ruby we'd have:</p>...
habedi/stack-exchange-dataset
29,513
Creating a binomial heap from an array in Θ(n) time
<p>I'm studying binomial heaps. A book tells me that insertion of a node to a binomial heap take $\Theta(\log n)$ time. So given an array of $n$ elements it would take $\Theta(n \log n)$ time to convert it to a binomial heap. </p>&#xA;&#xA;<p>Does anyone know a method that can convert an array of numbers to a binomial ...
algorithm analysis data structures runtime analysis heaps amortized analysis
1
Creating a binomial heap from an array in Θ(n) time -- (algorithm analysis data structures runtime analysis heaps amortized analysis) <p>I'm studying binomial heaps. A book tells me that insertion of a node to a binomial heap take $\Theta(\log n)$ time. So given an array of $n$ elements it would take $\Theta(n \log n)$...
habedi/stack-exchange-dataset
29,516
Convolution of Haar filter
<p>In "Conceptual Wavelets" (2009) by D. Lee Fugal, on pg 47 he writes</p>&#xA;&#xA;<pre><code>Conv ([-1, 1], [1, 1]) = [-1, 2,-1]&#xA;</code></pre>&#xA;&#xA;<p>When I do it I get</p>&#xA;&#xA;<pre><code>0 -1 1 0&#xA;1 1 &gt; -1&#xA; 1. 1. &gt; 0&#xA; ...
signal processing
1
Convolution of Haar filter -- (signal processing) <p>In "Conceptual Wavelets" (2009) by D. Lee Fugal, on pg 47 he writes</p>&#xA;&#xA;<pre><code>Conv ([-1, 1], [1, 1]) = [-1, 2,-1]&#xA;</code></pre>&#xA;&#xA;<p>When I do it I get</p>&#xA;&#xA;<pre><code>0 -1 1 0&#xA;1 1 &gt; -1&#x...
habedi/stack-exchange-dataset
29,519
Counting inversions in a list of integers using divide and conquer techniques
<p>This is a homework. It looks easy, but not really.</p>&#xA;&#xA;<p>A list of integers $a_n$, for every $i&lt;j$, if $a_i&gt;2a_j$, then it is an inversion. Count the inversions in the list, and return the count and the ordered list. Note, here the order is defined by the condition, not just sort the integers.</p>&#x...
algorithms counting divide and conquer
1
Counting inversions in a list of integers using divide and conquer techniques -- (algorithms counting divide and conquer) <p>This is a homework. It looks easy, but not really.</p>&#xA;&#xA;<p>A list of integers $a_n$, for every $i&lt;j$, if $a_i&gt;2a_j$, then it is an inversion. Count the inversions in the list, and r...
habedi/stack-exchange-dataset
29,526
Direct NP-Complete proofs
<p>I'm just starting to learn about NP-completeness. While I understand that reducibility plays a key role in this, I'm astonished how few problems I've been able to find who's proof that they are NP-Complete is <strong>not</strong> based on reduction to an existing NP-Complete problem.</p>&#xA;&#xA;<p>While I understa...
complexity theory reference request np complete proof techniques
1
Direct NP-Complete proofs -- (complexity theory reference request np complete proof techniques) <p>I'm just starting to learn about NP-completeness. While I understand that reducibility plays a key role in this, I'm astonished how few problems I've been able to find who's proof that they are NP-Complete is <strong>not<...
habedi/stack-exchange-dataset
29,533
What is the global function we are trying to Optimise with Clustering Algorithms?
<p>I am doing some reading (and implementation) of some Clustering Algorithms.</p>&#xA;&#xA;<p>First I started with the well known K-Mean algorithm and implemented it directly from a paper.&#xA;Got a kind of decent understanding of what I going on there.</p>&#xA;&#xA;<p>What I am actually interested in is Particle Swar...
optimization cluster
1
What is the global function we are trying to Optimise with Clustering Algorithms? -- (optimization cluster) <p>I am doing some reading (and implementation) of some Clustering Algorithms.</p>&#xA;&#xA;<p>First I started with the well known K-Mean algorithm and implemented it directly from a paper.&#xA;Got a kind of dece...
habedi/stack-exchange-dataset
29,539
match an array with a given set of arrays
<p>We have a set of 24 distinct arrays, each array has 36 elements and each element can have one of 13 possible values.</p>&#xA;&#xA;<p>Then we're given an array X (this array is certainly part of our set) and we have to find to which array of our set it corresponds to.</p>&#xA;&#xA;<p>Of course, we can check all 36 el...
algorithms arrays equality
1
match an array with a given set of arrays -- (algorithms arrays equality) <p>We have a set of 24 distinct arrays, each array has 36 elements and each element can have one of 13 possible values.</p>&#xA;&#xA;<p>Then we're given an array X (this array is certainly part of our set) and we have to find to which array of ou...
habedi/stack-exchange-dataset
29,542
RMQ with $O(\sqrt{n})$ space?
<p>I'm asked to design an <a href="http://en.wikipedia.org/wiki/Range_minimum_query" rel="nofollow noreferrer">RMQ</a> data structure (Range Minimum Query: return index of $min$ in a range $[i,j]$) for an array that has $&lt;=\log(n)$ local minimums (a local minimum is an index $i$ such that $A[i-1]&gt;A[i]&lt;A[i+1]$)...
algorithms data structures efficiency
1
RMQ with $O(\sqrt{n})$ space? -- (algorithms data structures efficiency) <p>I'm asked to design an <a href="http://en.wikipedia.org/wiki/Range_minimum_query" rel="nofollow noreferrer">RMQ</a> data structure (Range Minimum Query: return index of $min$ in a range $[i,j]$) for an array that has $&lt;=\log(n)$ local minimu...
habedi/stack-exchange-dataset
29,552
Enumerate all non-isomorphic graphs of a certain size
<p>I'd like to enumerate all undirected graphs of size $n$, but I only need one instance of <a href="https://en.wikipedia.org/wiki/Graph_isomorphism" rel="noreferrer">each isomorphism class</a>. In other words, I want to enumerate all non-isomorphic (undirected) graphs on $n$ vertices. How can I do this?</p>&#xA;&#xA...
algorithms graphs data compression graph isomorphism
1
Enumerate all non-isomorphic graphs of a certain size -- (algorithms graphs data compression graph isomorphism) <p>I'd like to enumerate all undirected graphs of size $n$, but I only need one instance of <a href="https://en.wikipedia.org/wiki/Graph_isomorphism" rel="noreferrer">each isomorphism class</a>. In other wor...
habedi/stack-exchange-dataset
29,558
Count of all simple paths between two vertices in a Complete graph
<p>A path is simple if no vertices are repeated. How many simple paths exist between two vertices in a complete graph?</p>&#xA;&#xA;<p>One way is listing all simple paths using depth-first search. but I think it should be more simple to find the number of all simple paths between 2 nodes in a complete graph.</p>&#xA;&#...
graphs combinatorics
1
Count of all simple paths between two vertices in a Complete graph -- (graphs combinatorics) <p>A path is simple if no vertices are repeated. How many simple paths exist between two vertices in a complete graph?</p>&#xA;&#xA;<p>One way is listing all simple paths using depth-first search. but I think it should be more ...
habedi/stack-exchange-dataset
29,561
Converting decision problems to grammars?
<p>I'm struggling to understand some concepts related to the relationship between language and computability theories.</p>&#xA;&#xA;<p>Can we convert decision problems to the corresponding grammars describing the languages? Can every decidable decision problem be converted to a context-free or context-sensitive grammar...
computability formal grammars
1
Converting decision problems to grammars? -- (computability formal grammars) <p>I'm struggling to understand some concepts related to the relationship between language and computability theories.</p>&#xA;&#xA;<p>Can we convert decision problems to the corresponding grammars describing the languages? Can every decidable...
habedi/stack-exchange-dataset
29,567
Are there established complexity classes with real numbers?
<p>A student recently asked me to check an NP-hardness proof for them. They performed a reduction along the lines of:</p>&#xA;&#xA;<blockquote>&#xA; <p>I reduce this problem $P'$ that is known to be NP-complete to my problem $P$ (with a poly-time many-one reduction), so $P$ is NP-hard.</p>&#xA;</blockquote>&#xA;&#xA;<...
complexity theory reference request complexity classes real numbers computable analysis
1
Are there established complexity classes with real numbers? -- (complexity theory reference request complexity classes real numbers computable analysis) <p>A student recently asked me to check an NP-hardness proof for them. They performed a reduction along the lines of:</p>&#xA;&#xA;<blockquote>&#xA; <p>I reduce this ...
habedi/stack-exchange-dataset
29,573
A recursively enumerable language and a recursively enumerable set
<p>I am confused between these two terminologies: recursively enumerable language, recursively enumerable set.</p>&#xA;&#xA;<p>Do they have the exactly same meaning?</p>&#xA;
terminology computability
1
A recursively enumerable language and a recursively enumerable set -- (terminology computability) <p>I am confused between these two terminologies: recursively enumerable language, recursively enumerable set.</p>&#xA;&#xA;<p>Do they have the exactly same meaning?</p>&#xA;
habedi/stack-exchange-dataset
29,584
Implementation of caches on CPUs with pipelines
<p>I've read that some current CPUs (e.g. Intel i7 and ARM A9) have (L1) cache latencies of multiple clock cycles while also being pipelined. Some devote multiple pipeline stages to instruction fetching.</p>&#xA;&#xA;<p>How is the L1 cache implemented to support pipelining? </p>&#xA;&#xA;<p>Is it, say, $k$ actual stage...
computer architecture cpu cache cpu pipelines
1
Implementation of caches on CPUs with pipelines -- (computer architecture cpu cache cpu pipelines) <p>I've read that some current CPUs (e.g. Intel i7 and ARM A9) have (L1) cache latencies of multiple clock cycles while also being pipelined. Some devote multiple pipeline stages to instruction fetching.</p>&#xA;&#xA;<p>H...
habedi/stack-exchange-dataset
29,586
Hoare Calculus Incorrect Assignment Axiom
<p>I'm currently preparing for an exam and recently came across the following exercise and would like to know whether my solution would be correct.</p>&#xA;&#xA;<p><strong>Exercise</strong>:&#xA;Prove that the following axiom is not correct in the Hoare Calculus:</p>&#xA;&#xA;<p>{true} u:= t {u=t}</p>&#xA;&#xA;<p><stro...
proof techniques correctness proof check my answer program correctness hoare logic
1
Hoare Calculus Incorrect Assignment Axiom -- (proof techniques correctness proof check my answer program correctness hoare logic) <p>I'm currently preparing for an exam and recently came across the following exercise and would like to know whether my solution would be correct.</p>&#xA;&#xA;<p><strong>Exercise</strong>:...
habedi/stack-exchange-dataset
29,589
What properties of a programming language make compilation impossible?
<p>Question:</p>&#xA;&#xA;<p>"Certain properties of a programming language may require that the only way to get the code written in it be executed is by interpretation. In other words, compilation to a native machine code of a traditional CPU is not possible. What are these properties?"</p>&#xA;&#xA;<p>Compilers: Princ...
programming languages compilers interpreters
1
What properties of a programming language make compilation impossible? -- (programming languages compilers interpreters) <p>Question:</p>&#xA;&#xA;<p>"Certain properties of a programming language may require that the only way to get the code written in it be executed is by interpretation. In other words, compilation to...
habedi/stack-exchange-dataset
29,598
Performing Transitive Reduction via neighbourhood and strongly connected components
<p>I am trying to learn(self-study, not homework) how to perform transitive reduction according to what what Prof. Leskovec explains in section 10.8.6 in <a href="http://infolab.stanford.edu/~ullman/mmds/book.pdf" rel="nofollow" title="free book">Mining Massive Datasets</a>. The book is free to access online.</p>&#xA;&...
graphs
1
Performing Transitive Reduction via neighbourhood and strongly connected components -- (graphs) <p>I am trying to learn(self-study, not homework) how to perform transitive reduction according to what what Prof. Leskovec explains in section 10.8.6 in <a href="http://infolab.stanford.edu/~ullman/mmds/book.pdf" rel="nofol...
habedi/stack-exchange-dataset
29,599
For each vertex of a tree count vertices closer than a specified value
<p>We have a weighted tree of $n\leq 10^5$ nodes, and for every node&nbsp;$v$, value $L(v)$. The goal is to calculate, for every vertex&nbsp;$v$, number of vertices&nbsp;$u$ such that $\mathrm{dist}(v,u)\leq L(v)$. This is a task from a programming contest. Judging by the limit on $n$, and also specifics of time limits...
algorithms trees
1
For each vertex of a tree count vertices closer than a specified value -- (algorithms trees) <p>We have a weighted tree of $n\leq 10^5$ nodes, and for every node&nbsp;$v$, value $L(v)$. The goal is to calculate, for every vertex&nbsp;$v$, number of vertices&nbsp;$u$ such that $\mathrm{dist}(v,u)\leq L(v)$. This is a ta...
habedi/stack-exchange-dataset
29,604
Communication complexity of comparing sets, for Bitcoin
<p>In Bitcoin, when one node wants to tell another node about a block, it sends the block header, then all the transactions it contains. This is inefficient, because the receiving node might already have some or all of those transactions. </p>&#xA;&#xA;<p>The sending node needs to tell the receiving node</p>&#xA;&#xA;<...
sets communication complexity
1
Communication complexity of comparing sets, for Bitcoin -- (sets communication complexity) <p>In Bitcoin, when one node wants to tell another node about a block, it sends the block header, then all the transactions it contains. This is inefficient, because the receiving node might already have some or all of those tran...
habedi/stack-exchange-dataset
29,626
Algorithm to merge two incomplete lists of symbols (strings) into a complete one
<p>I initially considered this problem trivial, but then looked with more attention, I could not find an easy solution.</p>&#xA;&#xA;<p>Let's say we have two ordered lists of symbols (strings):</p>&#xA;&#xA;<pre><code>A = "foobarquuz123"&#xA;B = "foobar456quuz"&#xA;</code></pre>&#xA;&#xA;<p>my goal is to have a way to ...
algorithms strings subsequences
1
Algorithm to merge two incomplete lists of symbols (strings) into a complete one -- (algorithms strings subsequences) <p>I initially considered this problem trivial, but then looked with more attention, I could not find an easy solution.</p>&#xA;&#xA;<p>Let's say we have two ordered lists of symbols (strings):</p>&#xA;...
habedi/stack-exchange-dataset
29,629
Describe in English the pattern in the following regular expressions
<p>Describe (in English phrases) the languages associated with the following regular expression. it says to be as simple as possible</p>&#xA;&#xA;<pre><code>#1 (x (yyy + x)*)*&#xA;#2 (c (cc)*d(dd)*)*&#xA;</code></pre>&#xA;&#xA;<p>for number 1 I got all words in which when y is in the word it can only appear in blocks t...
regular expressions
1
Describe in English the pattern in the following regular expressions -- (regular expressions) <p>Describe (in English phrases) the languages associated with the following regular expression. it says to be as simple as possible</p>&#xA;&#xA;<pre><code>#1 (x (yyy + x)*)*&#xA;#2 (c (cc)*d(dd)*)*&#xA;</code></pre>&#xA;&#xA...
habedi/stack-exchange-dataset
29,644
Decide if a specific Turing machine halts on a specific string
<p>Can you always decide if a specific Turing machine accepts a specific string?</p>&#xA;&#xA;<p>I started thinking about this after reading an answer to this question, <a href="https://cs.stackexchange.com/questions/27779/rices-theorem-vs-turing-completeness/27783">Rice&#39;s theorem vs Turing completeness</a>, which ...
computability undecidability halting problem
1
Decide if a specific Turing machine halts on a specific string -- (computability undecidability halting problem) <p>Can you always decide if a specific Turing machine accepts a specific string?</p>&#xA;&#xA;<p>I started thinking about this after reading an answer to this question, <a href="https://cs.stackexchange.com/...
habedi/stack-exchange-dataset
29,667
NP-hardness proof, what is wrong with it?
<p>My question is the following: If we have a problem divided into two versions, weighted and unweighted. Can we prove that the unweighted problem is NP-hard from the fact that the weighted problem is NP-hard ?</p>&#xA;&#xA;<p>For example let say I have the knapsack problem (the weighted version):</p>&#xA;&#xA;<p>$$\ma...
complexity theory optimization np hard
1
NP-hardness proof, what is wrong with it? -- (complexity theory optimization np hard) <p>My question is the following: If we have a problem divided into two versions, weighted and unweighted. Can we prove that the unweighted problem is NP-hard from the fact that the weighted problem is NP-hard ?</p>&#xA;&#xA;<p>For exa...
habedi/stack-exchange-dataset
29,673
How does a computer play a video while doing something else?
<p>How is video playback done on a computer? It's obviously not relying purely on the CPU, since video playback continues when a user performs another activity, such as typing into a YouTube comment field. This task seems further complicated in the case of streaming video, where data presumably needs to be transferre...
computer architecture video
1
How does a computer play a video while doing something else? -- (computer architecture video) <p>How is video playback done on a computer? It's obviously not relying purely on the CPU, since video playback continues when a user performs another activity, such as typing into a YouTube comment field. This task seems fu...
habedi/stack-exchange-dataset
29,675
Entropy sources: Weaver (1949) typo?
<p>In <em>Recent Contributions to The Mathematical Theory of Communication</em> (Weaver 1949), <a href="http://books.google.co.uk/books?id=cqF9zfmDjL8C&amp;lpg=PA39&amp;ots=OPGo43SEVs&amp;dq=%22The%20Mathematical%20Theory%20of%20Communication%22%20errata&amp;pg=PA39#v=onepage&amp;q=%22The%20Mathematical%20Theory%20of%2...
information theory
1
Entropy sources: Weaver (1949) typo? -- (information theory) <p>In <em>Recent Contributions to The Mathematical Theory of Communication</em> (Weaver 1949), <a href="http://books.google.co.uk/books?id=cqF9zfmDjL8C&amp;lpg=PA39&amp;ots=OPGo43SEVs&amp;dq=%22The%20Mathematical%20Theory%20of%20Communication%22%20errata&amp;...
habedi/stack-exchange-dataset
29,678
What Can We Say Complexity of Solving the Weighted Pool Ball Problem with a Variable Scale?
<p><strong>Background:</strong></p>&#xA;&#xA;<p>The pool ball weighing problem is a classic CS question thrown at students, typically to demonstrate a binary search (alternative to ripping phonebooks in half).</p>&#xA;&#xA;<p><strong>Pool Ball Problem:</strong> Given $n$ pool balls where exactly 1 weighs more than the ...
algorithm analysis time complexity
1
What Can We Say Complexity of Solving the Weighted Pool Ball Problem with a Variable Scale? -- (algorithm analysis time complexity) <p><strong>Background:</strong></p>&#xA;&#xA;<p>The pool ball weighing problem is a classic CS question thrown at students, typically to demonstrate a binary search (alternative to ripping...
habedi/stack-exchange-dataset
29,682
Combining multiple HMM models
<p>Is there any way to combine multiple Hidden Markov Models trained from different sets of data? For example, I want to detect the phases of a sequential activity. I collect two sets of data by using two types of sensors: accelerometer, and video stream. I create two HMM models from the accelerometer and video stream,...
machine learning hidden markov models
1
Combining multiple HMM models -- (machine learning hidden markov models) <p>Is there any way to combine multiple Hidden Markov Models trained from different sets of data? For example, I want to detect the phases of a sequential activity. I collect two sets of data by using two types of sensors: accelerometer, and video...
habedi/stack-exchange-dataset
29,693
Unambiguous CFG for $a^ib^j$ where $i \le j \le 2i$
<p>could you please help me for finding an unambiguous CFG for the following expression:&#xA;$a^ib^j$ where $i \le j \le 2i$</p>&#xA;
formal languages context free formal grammars ambiguity
1
Unambiguous CFG for $a^ib^j$ where $i \le j \le 2i$ -- (formal languages context free formal grammars ambiguity) <p>could you please help me for finding an unambiguous CFG for the following expression:&#xA;$a^ib^j$ where $i \le j \le 2i$</p>&#xA;
habedi/stack-exchange-dataset
29,694
Why can't we detect infinite loops in the busy beaver problem?
<p>I was reading about the <a href="http://en.wikipedia.org/wiki/Busy_beaver" rel="nofollow">busy beaver problem</a> the other day and I'm confused as to why we can't keep an array of Turing machine states that the machine has been through and simply iterate through it at each new machine state to see if it exactly mat...
algorithms busy beaver
1
Why can't we detect infinite loops in the busy beaver problem? -- (algorithms busy beaver) <p>I was reading about the <a href="http://en.wikipedia.org/wiki/Busy_beaver" rel="nofollow">busy beaver problem</a> the other day and I'm confused as to why we can't keep an array of Turing machine states that the machine has be...
habedi/stack-exchange-dataset
29,697
Understanding the time-complexity of Insertion Sort
<p>From my textbook, I am studying the time-complexity of the insertion sort algorithm (shown below).</p>&#xA;&#xA;<pre><code>INSERTION-SORT(A) cost times&#xA;1 for j &lt;- 2 to length[A] c1 n&#xA;2 DO key &lt;- A[j] c2 n - 1&#xA;3 ...
algorithm analysis runtime analysis sorting loops
1
Understanding the time-complexity of Insertion Sort -- (algorithm analysis runtime analysis sorting loops) <p>From my textbook, I am studying the time-complexity of the insertion sort algorithm (shown below).</p>&#xA;&#xA;<pre><code>INSERTION-SORT(A) cost times&#xA;1 for j &lt;- 2 to length...
habedi/stack-exchange-dataset
29,698
Homomorphism erasing information
<p>I would be grateful if anyone could help me with the tricky exerciese *7.52 from Sipser's Introduction to the Theory of Computation 3rd ed.</p>&#xA;&#xA;<p>I got stuck in proving that, if P is closed under nonerasing homomorphism (replacing all characters with nonempty string), then P = NP.&#xA;With nonerasing homom...
complexity theory np p vs np
1
Homomorphism erasing information -- (complexity theory np p vs np) <p>I would be grateful if anyone could help me with the tricky exerciese *7.52 from Sipser's Introduction to the Theory of Computation 3rd ed.</p>&#xA;&#xA;<p>I got stuck in proving that, if P is closed under nonerasing homomorphism (replacing all chara...
habedi/stack-exchange-dataset
29,700
How is Rice's theorem applicable to this decision problem?
<p>I recently had a test in introduction to computability and I got the following question wrong.</p>&#xA;&#xA;<p><br/></p>&#xA;&#xA;<h2>The question</h2>&#xA;&#xA;<p><strong>Input:</strong> A classical Turing machine $M$ with a 2-dimensional tape.</p>&#xA;&#xA;<p><strong>output:</strong> Does there exists a Turing mac...
computability turing machines
1
How is Rice's theorem applicable to this decision problem? -- (computability turing machines) <p>I recently had a test in introduction to computability and I got the following question wrong.</p>&#xA;&#xA;<p><br/></p>&#xA;&#xA;<h2>The question</h2>&#xA;&#xA;<p><strong>Input:</strong> A classical Turing machine $M$ with...
habedi/stack-exchange-dataset
29,703
Difference between end carry and overflow
<p>I am confused with end carry and overflow. When will an end carry be the overflow? How to identify whether the end carry is overflow or not? Are they both same?</p>&#xA;&#xA;<p>Sometimes end carries obtained are simply discarded and sometimes the end carries are considered as overflows. What is the exact method to f...
digital circuits
1
Difference between end carry and overflow -- (digital circuits) <p>I am confused with end carry and overflow. When will an end carry be the overflow? How to identify whether the end carry is overflow or not? Are they both same?</p>&#xA;&#xA;<p>Sometimes end carries obtained are simply discarded and sometimes the end ca...
habedi/stack-exchange-dataset
29,705
maze solving algorithms (pledge algorithm)
<p>I saw this maze, and tried to apply pledge algorithms to it. But I am not able to solve this maze using this algorithm. What am I missing/doing incorrectly?</p>&#xA;&#xA;<p>PLEDGE ALGORITHM: in both cases we don't get to exit. &#xA;<img src="https://i.stack.imgur.com/bHtNs.png" alt="enter image description here"></p...
algorithms robotics
1
maze solving algorithms (pledge algorithm) -- (algorithms robotics) <p>I saw this maze, and tried to apply pledge algorithms to it. But I am not able to solve this maze using this algorithm. What am I missing/doing incorrectly?</p>&#xA;&#xA;<p>PLEDGE ALGORITHM: in both cases we don't get to exit. &#xA;<img src="https:/...
habedi/stack-exchange-dataset
29,713
Extension of Rice's theorem
<p>How can one prove that every nontrivial property of pairs of&#xA;semi-decidable sets is undecidable? (This is an extension of Rice's theorem that "Every nontrivial property of the r.e. sets is undecidable")</p>&#xA;
computability turing machines undecidability semi decidability
1
Extension of Rice's theorem -- (computability turing machines undecidability semi decidability) <p>How can one prove that every nontrivial property of pairs of&#xA;semi-decidable sets is undecidable? (This is an extension of Rice's theorem that "Every nontrivial property of the r.e. sets is undecidable")</p>&#xA;
habedi/stack-exchange-dataset
29,714
What is my error in reasoning about the complexity class $n^{o(1)}$
<p>I'm almost sure I understand $o(1)$ (a class of functions that converge to zero in their limit), but the way I understand it, that would seem to imply that functions in $n^{o(1)}$ converge to 1 (after all, $n^0=1$ )</p>&#xA;&#xA;<p>Certainly the limit of $n^{1/n}$ is 1.</p>&#xA;&#xA;<p>But it can't mean that, becau...
asymptotics
1
What is my error in reasoning about the complexity class $n^{o(1)}$ -- (asymptotics) <p>I'm almost sure I understand $o(1)$ (a class of functions that converge to zero in their limit), but the way I understand it, that would seem to imply that functions in $n^{o(1)}$ converge to 1 (after all, $n^0=1$ )</p>&#xA;&#xA;<p>...
habedi/stack-exchange-dataset
29,724
Inequality to be disproved
<p>Suppose that a search for a key in a binary search tree ends up in a leaf. Consider three sets :&#xA;A,the keys to the left of the search path&#xA;B,the keys on the search path&#xA;C, the keys to the right of the search path. </p>&#xA;&#xA;<p>Any 3 keys a,b,c belonging to A,B,C respectively must satisfy a&lt;=b&lt;=...
trees binary trees
1
Inequality to be disproved -- (trees binary trees) <p>Suppose that a search for a key in a binary search tree ends up in a leaf. Consider three sets :&#xA;A,the keys to the left of the search path&#xA;B,the keys on the search path&#xA;C, the keys to the right of the search path. </p>&#xA;&#xA;<p>Any 3 keys a,b,c belong...
habedi/stack-exchange-dataset
29,730
Sort doubly linked list efficiently
<p>How efficiently can a doubly linked list be sorted? The minimum I could get is $O(n^2)$. Can anyone suggest something better?</p>&#xA;
algorithms time complexity sorting linked lists
1
Sort doubly linked list efficiently -- (algorithms time complexity sorting linked lists) <p>How efficiently can a doubly linked list be sorted? The minimum I could get is $O(n^2)$. Can anyone suggest something better?</p>&#xA;
habedi/stack-exchange-dataset
29,738
L1 and L2 cache
<p>I cannot find a to-the-point reference for my question. Am I correct in assuming that if you have an L1 and an L2 cache, typically the L2 cache linesize is larger? </p>&#xA;&#xA;<p>For the following, let's assume a word size of 1 byte, an array 'a'of one byte words, an L2 cache with blocksize of 8 bytes, and an L1 ...
computer architecture cpu cache
1
L1 and L2 cache -- (computer architecture cpu cache) <p>I cannot find a to-the-point reference for my question. Am I correct in assuming that if you have an L1 and an L2 cache, typically the L2 cache linesize is larger? </p>&#xA;&#xA;<p>For the following, let's assume a word size of 1 byte, an array 'a'of one byte wor...
habedi/stack-exchange-dataset
29,744
Are interrupts needed for a computer system to work?
<p>Are interrupts needed for a computer system to work? Could you have a computer system&#xA;(hardware and software, including the OS) that worked without an interrupt mechanism?</p>&#xA;
computer architecture operating systems
1
Are interrupts needed for a computer system to work? -- (computer architecture operating systems) <p>Are interrupts needed for a computer system to work? Could you have a computer system&#xA;(hardware and software, including the OS) that worked without an interrupt mechanism?</p>&#xA;
habedi/stack-exchange-dataset
29,755
Why is binary search faster than ternary search?
<p>Searching an array of $N$ elements using binary search takes, in the worst case $\log_2 N$ iterations because, at each step we trim half of our search space. &#xA;If, instead, we used 'ternary search', we'd cut away two-thirds of our search space at each iteration, so the worst case should take $\log_3 N &lt; \log_2...
algorithms algorithm analysis runtime analysis search algorithms binary search
1
Why is binary search faster than ternary search? -- (algorithms algorithm analysis runtime analysis search algorithms binary search) <p>Searching an array of $N$ elements using binary search takes, in the worst case $\log_2 N$ iterations because, at each step we trim half of our search space. &#xA;If, instead, we used ...
habedi/stack-exchange-dataset
29,758
Why is Ibarra Kim for 0/1 knapsack an fully polynomial time approximation scheme (FPTAS)?
<p>According to one of my CS lectures, there is an fully polynomial time approximation scheme for the <a href="http://en.wikipedia.org/wiki/Knapsack_problem#0.2F1_knapsack_problem" rel="nofollow">0/1 Knapsack problem</a>. A first version was developed by Ibarra and Kim, but there are several improved versions.</p>&#xA;...
algorithm analysis runtime analysis approximation polynomial time knapsack problems
1
Why is Ibarra Kim for 0/1 knapsack an fully polynomial time approximation scheme (FPTAS)? -- (algorithm analysis runtime analysis approximation polynomial time knapsack problems) <p>According to one of my CS lectures, there is an fully polynomial time approximation scheme for the <a href="http://en.wikipedia.org/wiki/K...
habedi/stack-exchange-dataset
29,765
In Ada95 how many bytes does integer occupied in memory?
<p>Also asking for float, character, ect.</p>&#xA;
memory allocation
1
In Ada95 how many bytes does integer occupied in memory? -- (memory allocation) <p>Also asking for float, character, ect.</p>&#xA;
habedi/stack-exchange-dataset
29,767
Proving Regularity of Languages that are 1/k of an already known regular language
<p>There is this question in Kozen, that states if a language is regular then the first half would also be regular. Also I found a material on the internet that extends the thinking saying a language that is two-thirds of already known regular language is regular. I'm tempted to think that it should also hold true for ...
formal languages regular languages closure properties
1
Proving Regularity of Languages that are 1/k of an already known regular language -- (formal languages regular languages closure properties) <p>There is this question in Kozen, that states if a language is regular then the first half would also be regular. Also I found a material on the internet that extends the thinki...
habedi/stack-exchange-dataset
29,775
Decremental reachability in a grid graph
<p>Consider an $n$ by $n$ grid graph. For example, the following.</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/MysuI.png" alt="Grid graph"> </p>&#xA;&#xA;<p>You can of course reach the top left corner from the bottom right. Now consider the graph dynamically with an arbitrary number of edges deleted at each st...
algorithms graphs data structures
1
Decremental reachability in a grid graph -- (algorithms graphs data structures) <p>Consider an $n$ by $n$ grid graph. For example, the following.</p>&#xA;&#xA;<p><img src="https://i.stack.imgur.com/MysuI.png" alt="Grid graph"> </p>&#xA;&#xA;<p>You can of course reach the top left corner from the bottom right. Now con...
habedi/stack-exchange-dataset
29,790
Algorithm for generation of Canonical represented integers
<p>Is there a way to get <code>canonical representation</code> of an integer by algorithm?&#xA;I can get primes, but I don't know how to represent, for example, 1000 as 2^3×5^3. How can I compute the power of each prime number?</p>&#xA;
algorithms number theory
1
Algorithm for generation of Canonical represented integers -- (algorithms number theory) <p>Is there a way to get <code>canonical representation</code> of an integer by algorithm?&#xA;I can get primes, but I don't know how to represent, for example, 1000 as 2^3×5^3. How can I compute the power of each prime number?</p>...
habedi/stack-exchange-dataset
29,806
What kind of order is binary tree ancestry?
<p>Let <code>isAncestor</code> be a relation on binary tree nodes such that <code>isAncestor x y</code> means <code>y</code> can be reached from <code>x</code> in <code>n</code> steps from parent to child, where <code>n</code> may be zero. It is clear from this definition that <code>isAncestor</code> is a partial order...
binary trees partial order
1
What kind of order is binary tree ancestry? -- (binary trees partial order) <p>Let <code>isAncestor</code> be a relation on binary tree nodes such that <code>isAncestor x y</code> means <code>y</code> can be reached from <code>x</code> in <code>n</code> steps from parent to child, where <code>n</code> may be zero. It i...
habedi/stack-exchange-dataset
29,809
Using base 80 for compressing files
<p>I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnt that Hexadecimal uses symbols like A, B, C, D, E, F to represent 10,11,12,13,14,15 -- and that's what i want to do to my own numbering system but in a bigger sc...
data compression number formats
1
Using base 80 for compressing files -- (data compression number formats) <p>I want to compress file size through making my own numbering system which is 80-based number, I do really want to know whether this even possible ? I learnt that Hexadecimal uses symbols like A, B, C, D, E, F to represent 10,11,12,13,14,15 -- a...
habedi/stack-exchange-dataset
29,814
Searching for an item over a non-uniform query distribution
<p>If I have a static set of $n$ items in a database that are all queried with uniform probability it makes sense to put them in a binary search tree. This way any given search will take, on average, $O(\ln n)$.</p>&#xA;&#xA;<p>What happens now, if the items are not queried uniformly? As a silly example, say that one i...
data structures search algorithms search trees
1
Searching for an item over a non-uniform query distribution -- (data structures search algorithms search trees) <p>If I have a static set of $n$ items in a database that are all queried with uniform probability it makes sense to put them in a binary search tree. This way any given search will take, on average, $O(\ln n...
habedi/stack-exchange-dataset
29,822
Lazily computing a random permutation of the positive integers
<p>Are there any existing efficient algorithms for lazily computing a random permutation of the positive integers in a given range (e.g. the range offered by an unsigned integer type in a CPU)?</p>&#xA;&#xA;<p>What I mean is this:</p>&#xA;&#xA;<p>An algorithm that, given a source of randomness and a positive integer ra...
online algorithms random number generator
1
Lazily computing a random permutation of the positive integers -- (online algorithms random number generator) <p>Are there any existing efficient algorithms for lazily computing a random permutation of the positive integers in a given range (e.g. the range offered by an unsigned integer type in a CPU)?</p>&#xA;&#xA;<p>...
habedi/stack-exchange-dataset
29,824
How to detect repeating random numbers?
<p>What is the best way to detect repeating sequences of random numbers?</p>&#xA;&#xA;<p>For example, say I got two random number generators (RNG). One of them has been tampered with and is repeating the sequence of random numbers after every N iterations.&#xA;The other RNG has not been tampered with and is producing r...
algorithms randomness random number generator
1
How to detect repeating random numbers? -- (algorithms randomness random number generator) <p>What is the best way to detect repeating sequences of random numbers?</p>&#xA;&#xA;<p>For example, say I got two random number generators (RNG). One of them has been tampered with and is repeating the sequence of random number...
habedi/stack-exchange-dataset
29,830
How can I teach computer science without using computers?
<p>In some places in the world, people don't usually have access to (and hence little knowledge of) computers, and even if they have, hard- and software are outdated and usage plagued by power outages and such. Access to (good) books also tends to be lacking. How can I teach computer science under such circumstances? <...
education
1
How can I teach computer science without using computers? -- (education) <p>In some places in the world, people don't usually have access to (and hence little knowledge of) computers, and even if they have, hard- and software are outdated and usage plagued by power outages and such. Access to (good) books also tends to...
habedi/stack-exchange-dataset
29,833
How do I solve interdependent recurrence relations?
<p>I have three functions with values given as </p>&#xA;&#xA;<p>$$\begin{align*}&#xA; P(0) &amp;= 0 \quad &amp;&#xA; P(i+1) &amp;= 5M(i)\\&#xA; M(0) &amp;= 1 \quad &amp;&#xA; M(i+1) &amp;= R(i) + 2P(i)\\&#xA; R(0) &amp;= 3 \quad &amp;&#xA; R(i+1) &amp;= R(i) + 3P(i)\,.&#xA;\end{align*}$$</p>&#xA;&#x...
proof techniques recurrence relation
1
How do I solve interdependent recurrence relations? -- (proof techniques recurrence relation) <p>I have three functions with values given as </p>&#xA;&#xA;<p>$$\begin{align*}&#xA; P(0) &amp;= 0 \quad &amp;&#xA; P(i+1) &amp;= 5M(i)\\&#xA; M(0) &amp;= 1 \quad &amp;&#xA; M(i+1) &amp;= R(i) + 2P(i)\\&#xA; R...
habedi/stack-exchange-dataset
29,837
How to explain the steps in the implementation of hashing functions like SHA1
<p>I was reading the article about the SHA1 hashing function (I know it is not secure anymore) and I've found a <a href="http://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode" rel="nofollow">pseudocode implementation on Wikipedia</a>.</p>&#xA;&#xA;<p>I can see that there are a lot of mathematical operations, and what I w...
algorithms cryptography hash
1
How to explain the steps in the implementation of hashing functions like SHA1 -- (algorithms cryptography hash) <p>I was reading the article about the SHA1 hashing function (I know it is not secure anymore) and I've found a <a href="http://en.wikipedia.org/wiki/SHA-1#SHA-1_pseudocode" rel="nofollow">pseudocode implemen...
habedi/stack-exchange-dataset
29,841
Enumerate All Possible Strings Over Alphabet
<p>I am given the following decision problem: </p>&#xA;&#xA;<p>A program $ \Pi $ takes as input a pair of strings and outputs either $true$ or $false$.&#xA;It is guaranteed that $\Pi$ terminates on any input. Does there exist a pair ($I_1,I_2$) of strings such that $\Pi$ terminates on ($I_1,I_2$) with output value $tru...
algorithms strings enumeration
1
Enumerate All Possible Strings Over Alphabet -- (algorithms strings enumeration) <p>I am given the following decision problem: </p>&#xA;&#xA;<p>A program $ \Pi $ takes as input a pair of strings and outputs either $true$ or $false$.&#xA;It is guaranteed that $\Pi$ terminates on any input. Does there exist a pair ($I_1,...
habedi/stack-exchange-dataset
29,845
Feasibility of linear inequalities with binary variables
<p>I have a system of linear inequalities of the form $A^t x \leq b$, where each of the $x_i$'s is a binary variable in $\{0, 1\}$. Are there any known fast and practical algorithms that can find a feasible solution or prove that the system has no solutions? </p>&#xA;&#xA;<p>I need this to generate an initial solution ...
algorithms reference request decision problem integer programming
1
Feasibility of linear inequalities with binary variables -- (algorithms reference request decision problem integer programming) <p>I have a system of linear inequalities of the form $A^t x \leq b$, where each of the $x_i$'s is a binary variable in $\{0, 1\}$. Are there any known fast and practical algorithms that can f...
habedi/stack-exchange-dataset
29,846
Can an interrupt handler be preempted?
<p>Can a running interrupt handler be pre-empted by another interrupt handler?&#xA;If this is possible, in which scenarios is this safe, and in which scenarios is it not?&#xA;If this is not possible, why?</p>&#xA;
operating systems os kernel
1
Can an interrupt handler be preempted? -- (operating systems os kernel) <p>Can a running interrupt handler be pre-empted by another interrupt handler?&#xA;If this is possible, in which scenarios is this safe, and in which scenarios is it not?&#xA;If this is not possible, why?</p>&#xA;
habedi/stack-exchange-dataset
29,848
How does the processor find kernel code after an interrupt?
<p>When an interrupt occurs, the processor preempts the current process and calls kernel code to handle the interrupt. How does the processor know where to enter the kernel?</p>&#xA;&#xA;<p>I understand that there are interrupt handlers which can be installed for each interrupt line. But since the processor only execut...
computer architecture operating systems os kernel
1
How does the processor find kernel code after an interrupt? -- (computer architecture operating systems os kernel) <p>When an interrupt occurs, the processor preempts the current process and calls kernel code to handle the interrupt. How does the processor know where to enter the kernel?</p>&#xA;&#xA;<p>I understand th...
habedi/stack-exchange-dataset
29,851
What are potential pitfalls with having a minimal kernel that runs managed code?
<p>Suppose I want to build an operating system based on a very small native lower kernel that acts as a managed code interpreter/runtime and a larger upper kernel compiled to a non-native machine language (Java bytecode, CIL, etc.). Examples of similar operating systems would be <a href="http://en.wikipedia.org/wiki/Si...
operating systems type checking interpreters os kernel
1
What are potential pitfalls with having a minimal kernel that runs managed code? -- (operating systems type checking interpreters os kernel) <p>Suppose I want to build an operating system based on a very small native lower kernel that acts as a managed code interpreter/runtime and a larger upper kernel compiled to a no...
habedi/stack-exchange-dataset
29,854
Performance of microkernel vs monolithic kernel
<p>A microkernel implements all drivers as user-space programs, and implements core features like IPC in the kernel itself. A monolithic kernel, however, implements the drivers as a part of the kernel (e.g. runs in kernel mode). </p>&#xA;&#xA;<p>I have read some claims that microkernels are slower than monolithic kerne...
operating systems performance os kernel
1
Performance of microkernel vs monolithic kernel -- (operating systems performance os kernel) <p>A microkernel implements all drivers as user-space programs, and implements core features like IPC in the kernel itself. A monolithic kernel, however, implements the drivers as a part of the kernel (e.g. runs in kernel mode)...
habedi/stack-exchange-dataset
29,856
Writing a multitasking operating system for a processor without MMU
<p>I've been thinking of writing a hobby operating system for some of the ARM processors. There are many popular single-board computers with ARM MPU, so I simply wanted to purchase one of those (choosing one with more open documentation). I was surprised when I found out, that even boards with really enough memory do n...
operating systems memory management memory hardware os kernel
1
Writing a multitasking operating system for a processor without MMU -- (operating systems memory management memory hardware os kernel) <p>I've been thinking of writing a hobby operating system for some of the ARM processors. There are many popular single-board computers with ARM MPU, so I simply wanted to purchase one ...
habedi/stack-exchange-dataset
29,858
Are Time-sharing and multi-tasking operating systems same or different
<p>My question is regarding time-sharing and multi-tasking systems.</p>&#xA;&#xA;<p>Time-sharing operating system assigns time slot to each task while multi-tasking OS runs various jobs in parallel.</p>&#xA;&#xA;<p>But as I get it, on a single processor system, time-sharing is the only way to achieve multi-tasking. (I...
operating systems os kernel
1
Are Time-sharing and multi-tasking operating systems same or different -- (operating systems os kernel) <p>My question is regarding time-sharing and multi-tasking systems.</p>&#xA;&#xA;<p>Time-sharing operating system assigns time slot to each task while multi-tasking OS runs various jobs in parallel.</p>&#xA;&#xA;<p>B...
habedi/stack-exchange-dataset
29,860
Why using Hyper-threading can lead to performance degradation
<p>I have read it at various places like <a href="http://www.zdnet.com/hyperthreading-hurts-server-performance-say-developers-3039237341/" rel="nofollow noreferrer">this</a>, that Hyper-threading leads to performance degradation.</p>&#xA;<p>I am unable to get why or how hyper-threading leads to degradation.</p>&#xA;<p>...
computer architecture performance threads
1
Why using Hyper-threading can lead to performance degradation -- (computer architecture performance threads) <p>I have read it at various places like <a href="http://www.zdnet.com/hyperthreading-hurts-server-performance-say-developers-3039237341/" rel="nofollow noreferrer">this</a>, that Hyper-threading leads to perfor...
habedi/stack-exchange-dataset
29,862
Relation between Signals and Events
<p>There are POSIX signals (<a href="http://man7.org/linux/man-pages/man7/signal.7.html" rel="nofollow">linux man</a>), and various event-based operating systems (such as <a href="http://www.tinyos.net/" rel="nofollow">TinyOS</a>, most seem to be targeted at embedded systems). But the mechanisms seem very similar.</p>&...
operating systems os kernel
1
Relation between Signals and Events -- (operating systems os kernel) <p>There are POSIX signals (<a href="http://man7.org/linux/man-pages/man7/signal.7.html" rel="nofollow">linux man</a>), and various event-based operating systems (such as <a href="http://www.tinyos.net/" rel="nofollow">TinyOS</a>, most seem to be targ...
habedi/stack-exchange-dataset
29,864
What guarantees do "soft" real-time operating systems actually provide
<p>I think I know what a "hard" real-time operating system is. It is an operating system with a scheduler that provides a contract with the application programmer. An application provides a deadline with each resource allocation request. <em>If</em> the deadline requests are <em>feasible</em>, the scheduler guarante...
terminology operating systems process scheduling real time
1
What guarantees do "soft" real-time operating systems actually provide -- (terminology operating systems process scheduling real time) <p>I think I know what a "hard" real-time operating system is. It is an operating system with a scheduler that provides a contract with the application programmer. An application prov...
habedi/stack-exchange-dataset
29,867
Handling TOCTTOU with system calls
<p>What are some of the best practices when implementing system call functionality for handling/avoiding "Time of check to time of use" (TOCTTOU) security issues?</p>&#xA;
operating systems security os kernel
1
Handling TOCTTOU with system calls -- (operating systems security os kernel) <p>What are some of the best practices when implementing system call functionality for handling/avoiding "Time of check to time of use" (TOCTTOU) security issues?</p>&#xA;
habedi/stack-exchange-dataset
29,870
Why is the OS design able to reduce power consumption?
<p>I have read that OSes like Android and iOS are somehow optimised to improve battery life.</p>&#xA;&#xA;<p>My understanding is that a CPU executes a certain number of operations in a certain time, so I would think that you can speed up applications by reducing number of operations required, but since the CPU will sti...
computer architecture operating systems performance program optimization
1
Why is the OS design able to reduce power consumption? -- (computer architecture operating systems performance program optimization) <p>I have read that OSes like Android and iOS are somehow optimised to improve battery life.</p>&#xA;&#xA;<p>My understanding is that a CPU executes a certain number of operations in a ce...
habedi/stack-exchange-dataset
29,880
How does an operating system create entropy for random seeds?
<p>On Linux, the files <a href="http://linux.die.net/man/4/random"><code>/dev/random</code> and <code>/dev/urandom</code></a> files are the blocking and non-blocking (respectively) sources of pseudo-random bytes. </p>&#xA;&#xA;<p>They can be read as normal files:</p>&#xA;&#xA;<pre><code>$ hexdump /dev/random&#xA;000000...
operating systems cryptography randomness security entropy
1
How does an operating system create entropy for random seeds? -- (operating systems cryptography randomness security entropy) <p>On Linux, the files <a href="http://linux.die.net/man/4/random"><code>/dev/random</code> and <code>/dev/urandom</code></a> files are the blocking and non-blocking (respectively) sources of ps...
habedi/stack-exchange-dataset
29,883
Can multiple tasks in an RTOS share one stack to save memory?
<p>Many small embedded systems have a limited amount of RAM, 10k or less. I know you can run an RTOS on such systems, however, a realistic number of tasks in such a system is very low, mainly because every task needs its own stack area.<br><br>&#xA;Is it possible to share the space needed for the stack of some of these...
operating systems memory management real time
1
Can multiple tasks in an RTOS share one stack to save memory? -- (operating systems memory management real time) <p>Many small embedded systems have a limited amount of RAM, 10k or less. I know you can run an RTOS on such systems, however, a realistic number of tasks in such a system is very low, mainly because every t...
habedi/stack-exchange-dataset
29,885
Where is the OS when a process is running?
<blockquote>&#xA; <p>We know that operating system is responsible for handling memory allocation, process management etc. CPU can perform only one task at a time(assuming it to be single core). Suppose an operating system has allocated a CPU cycle to some user initiated process and CPU is executing that. Now where is ...
operating systems multi tasking
1
Where is the OS when a process is running? -- (operating systems multi tasking) <blockquote>&#xA; <p>We know that operating system is responsible for handling memory allocation, process management etc. CPU can perform only one task at a time(assuming it to be single core). Suppose an operating system has allocated a C...
habedi/stack-exchange-dataset
29,890
How are userland programs executed?
<p>Say we have a simple OS with a filesystem, and some programs on that filesystem. How then does a program get executed by the OS?</p>&#xA;&#xA;<p>My understanding is that the executable file gets loaded into memory, but after that I'm a little fuzzy. I understand the OS creates a process, but I'm not sure exactly how...
operating systems multi tasking
1
How are userland programs executed? -- (operating systems multi tasking) <p>Say we have a simple OS with a filesystem, and some programs on that filesystem. How then does a program get executed by the OS?</p>&#xA;&#xA;<p>My understanding is that the executable file gets loaded into memory, but after that I'm a little f...
habedi/stack-exchange-dataset
29,898
Maximum sum subset of an array with an extra condition
<p>We are given numbers $n \leq 200$, $k \leq 10$ and an array of $3n$ positive integers not greater than $10^6$. Find the maximum possible sum of a subset of elements of this array, such that in every contiguous $n$ elements there are at most $k$ chosen.</p>&#xA;&#xA;<p>As this is an old high-school level contest prob...
algorithms optimization dynamic programming subsequences
1
Maximum sum subset of an array with an extra condition -- (algorithms optimization dynamic programming subsequences) <p>We are given numbers $n \leq 200$, $k \leq 10$ and an array of $3n$ positive integers not greater than $10^6$. Find the maximum possible sum of a subset of elements of this array, such that in every c...
habedi/stack-exchange-dataset
29,900
Showing that tournament sort requrires O(n log n) comparisons
<p>I wish I could think of a better way to word my question. Maybe some one here could offer s suggestion for that, as well.</p>&#xA;&#xA;<p>On to my question. Before I do, this is a class question that has been asked, answer, and considered to be over; however, I'm struggle accepting the answer. For this reason, I'm h...
algorithm analysis asymptotics sorting
1
Showing that tournament sort requrires O(n log n) comparisons -- (algorithm analysis asymptotics sorting) <p>I wish I could think of a better way to word my question. Maybe some one here could offer s suggestion for that, as well.</p>&#xA;&#xA;<p>On to my question. Before I do, this is a class question that has been as...
habedi/stack-exchange-dataset
29,910
Which hazards are solved by instruction reordering?
<p>I am not clear on whether it's data and control hazards, or control hazards only. Also, the "solved" word confuses me - technically, instruction reordering is used to solve dependences and thus prevent hazards from happening in the first place. Once they do happen, though, it's stalls and forwarding. Would that make...
compilers cpu pipelines
1
Which hazards are solved by instruction reordering? -- (compilers cpu pipelines) <p>I am not clear on whether it's data and control hazards, or control hazards only. Also, the "solved" word confuses me - technically, instruction reordering is used to solve dependences and thus prevent hazards from happening in the firs...
habedi/stack-exchange-dataset
29,923
Is it possible to ever define $L(M)$ of a given Turing Machine, $M$?
<p>In class, we were discussing creating a Turing Machine $M$ based on the set of input strings it should accept, i.e. define a Turing Machine that accepts only the input $\{ w\ \#\ w\ |\ w \in \{0,1\}^*\}$. However, we proceeded to discuss when a language is recursively enumerable vs machines that are deciders etc, an...
turing machines undecidability
1
Is it possible to ever define $L(M)$ of a given Turing Machine, $M$? -- (turing machines undecidability) <p>In class, we were discussing creating a Turing Machine $M$ based on the set of input strings it should accept, i.e. define a Turing Machine that accepts only the input $\{ w\ \#\ w\ |\ w \in \{0,1\}^*\}$. However...
habedi/stack-exchange-dataset
29,930
Can languages with infinite strings be recursively enumerable?
<p>I am not 100% sure about the definition of <strong>recursively enumarable</strong> languages. Yes I know how are they defined: There has to exist a Turing machine that accepts all wrods of the language and halts but it does not have to halt on different inputs.</p>&#xA;&#xA;<p>But suppose I have a language consistin...
formal languages computability turing machines semi decidability
1
Can languages with infinite strings be recursively enumerable? -- (formal languages computability turing machines semi decidability) <p>I am not 100% sure about the definition of <strong>recursively enumarable</strong> languages. Yes I know how are they defined: There has to exist a Turing machine that accepts all wrod...
habedi/stack-exchange-dataset
29,947
How are lamport clocks implemented in real world distributed systems?
<p>Can anyone explain, how lamport clocks implementations are used in modern distributed systems?&#xA;Can you name an open source package which implements this algorithm?</p>&#xA;
distributed systems synchronization
1
How are lamport clocks implemented in real world distributed systems? -- (distributed systems synchronization) <p>Can anyone explain, how lamport clocks implementations are used in modern distributed systems?&#xA;Can you name an open source package which implements this algorithm?</p>&#xA;
habedi/stack-exchange-dataset
29,965
Minimising two maximum edges in s-t path
<p>I've been trying to solve the following <a href="http://www.e-olimp.com.ua/en/problems/1727" rel="nofollow">problem</a>:</p>&#xA;&#xA;<p>Problem is the following: &#xA;Given a graph and a pair of nodes $s$, $t$ you have to find the path from $s$ to $t$ which minimises the sum of its two largest edges.</p>&#xA;&#...
graphs shortest path greedy algorithms
1
Minimising two maximum edges in s-t path -- (graphs shortest path greedy algorithms) <p>I've been trying to solve the following <a href="http://www.e-olimp.com.ua/en/problems/1727" rel="nofollow">problem</a>:</p>&#xA;&#xA;<p>Problem is the following: &#xA;Given a graph and a pair of nodes $s$, $t$ you have to find t...
habedi/stack-exchange-dataset
29,974
Origins of misconception about using equality signs with Landau notation
<p>From "Misconception 1" from <a href="http://ssp.impulsetrain.com/big-o.html" rel="nofollow">Søren S. Pedersen's blog</a>, and as many have seen before, a major misconception in Big-O (and others) notation is to say a function is "equal" to Big-O of some other function:</p>&#xA;&#xA;<p>$f(n) = O(g(n))$</p>&#xA;&#xA;<...
asymptotics landau notation notation
1
Origins of misconception about using equality signs with Landau notation -- (asymptotics landau notation notation) <p>From "Misconception 1" from <a href="http://ssp.impulsetrain.com/big-o.html" rel="nofollow">Søren S. Pedersen's blog</a>, and as many have seen before, a major misconception in Big-O (and others) notati...
habedi/stack-exchange-dataset
29,980
For two regular languages, why is the set of words from one that don't have a subsequence in the other also regular?
<p>In general, a string $x$ is a subsequence of $w = w_1\dots w_n$ if there are integers $i_1&lt;\dots&lt; i_k$ such that $x = w_{i_1}\dots w_{i_k}$. The subsequence is proper if $k &lt; n$ and $k &gt; 0$.</p>&#xA;&#xA;<p>With this definition given, a homework problem asks the following: Suppose $L$ and $L_1$ are lang...
formal languages regular languages closure properties
1
For two regular languages, why is the set of words from one that don't have a subsequence in the other also regular? -- (formal languages regular languages closure properties) <p>In general, a string $x$ is a subsequence of $w = w_1\dots w_n$ if there are integers $i_1&lt;\dots&lt; i_k$ such that $x = w_{i_1}\dots w_{i...
habedi/stack-exchange-dataset
29,985
Kleene closure of the empty set
<p>In the book introduction to automata theory and languages, $L^*$ is defined as</p>&#xA;&#xA;<p>$$L^* = \bigcup_{i=0}^\infty L^i $$</p>&#xA;&#xA;<p>The book also says that $\emptyset^* = \{ \epsilon \}$. But since $\emptyset$ is the empty set</p>&#xA;&#xA;<p>$$L^* = L^0 \cup L^1 \cup L^2 ... $$</p>&#xA;&#xA;<p>$...
formal languages
1
Kleene closure of the empty set -- (formal languages) <p>In the book introduction to automata theory and languages, $L^*$ is defined as</p>&#xA;&#xA;<p>$$L^* = \bigcup_{i=0}^\infty L^i $$</p>&#xA;&#xA;<p>The book also says that $\emptyset^* = \{ \epsilon \}$. But since $\emptyset$ is the empty set</p>&#xA;&#xA;<p>$...
habedi/stack-exchange-dataset
29,990
Understanding the Sipser-Gacs-Lautemann theorem
<p>The class $BPP$ contains all the languages decided by a probabilistic Turing machine in polynomial time with probability of success more that 2/3 for every input.</p>&#xA;&#xA;<p>The class $\Sigma^p_2$ contains all the languages for which there is a polinomial time Turing machine $M$ and a plynomial function $q : \m...
complexity theory complexity classes polynomial time probabilistic algorithms
1
Understanding the Sipser-Gacs-Lautemann theorem -- (complexity theory complexity classes polynomial time probabilistic algorithms) <p>The class $BPP$ contains all the languages decided by a probabilistic Turing machine in polynomial time with probability of success more that 2/3 for every input.</p>&#xA;&#xA;<p>The cla...
habedi/stack-exchange-dataset
29,997
A relationship in a UML class diagram
<p>I am investigating a small database in a paper:&#xA;<img src="https://i.stack.imgur.com/34ZZ9.png" alt="enter image description here"></p>&#xA;&#xA;<p>Each line is a selling record. For instance, Line 2 expresses that <code>Store 100 in Week 383 sold Product 653; for this selling, the move was 16 and the price was 2...
databases database theory
1
A relationship in a UML class diagram -- (databases database theory) <p>I am investigating a small database in a paper:&#xA;<img src="https://i.stack.imgur.com/34ZZ9.png" alt="enter image description here"></p>&#xA;&#xA;<p>Each line is a selling record. For instance, Line 2 expresses that <code>Store 100 in Week 383 so...
habedi/stack-exchange-dataset
30,008
Question Concerning Big-O Notation
<p>A couple of questions:</p>&#xA;&#xA;<ol>&#xA;<li>When choosing $C$ do I have to choose an integer? I see nothing in my definitions preventing fractions, but I haven't seen any in anything I've looked up, either</li>&#xA;<li>Given $f(x)=O(g(x))$, is there anything preventing me from choosing $f(x)=g(x)$ such as $f(x)...
asymptotics landau notation
1
Question Concerning Big-O Notation -- (asymptotics landau notation) <p>A couple of questions:</p>&#xA;&#xA;<ol>&#xA;<li>When choosing $C$ do I have to choose an integer? I see nothing in my definitions preventing fractions, but I haven't seen any in anything I've looked up, either</li>&#xA;<li>Given $f(x)=O(g(x))$, is ...
habedi/stack-exchange-dataset
30,009
Difficulty of Integer Linear Programming vs. Mixed Integer Linear Programming
<p>I have recently been working on an applied project where I have to solve optimization problems. </p>&#xA;&#xA;<p>I have found that it is much easier to solve an integer linear program (ILP) as opposed to a mixed-integer linear programs (MILP), in the sense it is faster for me to find feasible solutions as well as to...
reference request time complexity integer programming
1
Difficulty of Integer Linear Programming vs. Mixed Integer Linear Programming -- (reference request time complexity integer programming) <p>I have recently been working on an applied project where I have to solve optimization problems. </p>&#xA;&#xA;<p>I have found that it is much easier to solve an integer linear prog...
habedi/stack-exchange-dataset
30,017
Finding a subset in bipartite graph violating Hall's condition
<p>We are given a bipartite graph of $n \leq 200$ vertices in both the first and the second partite set. Let $U$ be some set of vertices in the first set, and $V$ those vertices from the second that are conected to some of the vertices from $U$. If for every choice of $U$ we have $|U| \leq |V|$ (Hall's condition) then ...
graphs network flow bipartite matching
1
Finding a subset in bipartite graph violating Hall's condition -- (graphs network flow bipartite matching) <p>We are given a bipartite graph of $n \leq 200$ vertices in both the first and the second partite set. Let $U$ be some set of vertices in the first set, and $V$ those vertices from the second that are conected t...
habedi/stack-exchange-dataset
30,026
Constructing all context-free languages from a set of base languages and closure properties?
<p>One way of looking at regular expressions is as a constructive proof of the following fact: it's possible to construct the regular languages by starting with a small set of languages and combining them via a small, fixed set of closure properties. Specifically, if we start with the empty language, the language conta...
formal languages context free closure properties regular expressions
1
Constructing all context-free languages from a set of base languages and closure properties? -- (formal languages context free closure properties regular expressions) <p>One way of looking at regular expressions is as a constructive proof of the following fact: it's possible to construct the regular languages by starti...
habedi/stack-exchange-dataset
30,036
Can a Big-Oh time complexity contain more than one variable?
<p>Let us say for instance I am doing string processing that requires some analysis of two strings. I have no given information about what their lengths might end up being, so they come from two distinct families. Would it be acceptable to call the complexity of an algorithm $O(n * m)$ or $O(n + m)$ (depending on if we...
time complexity asymptotics landau notation notation
1
Can a Big-Oh time complexity contain more than one variable? -- (time complexity asymptotics landau notation notation) <p>Let us say for instance I am doing string processing that requires some analysis of two strings. I have no given information about what their lengths might end up being, so they come from two distin...
habedi/stack-exchange-dataset
30,041
Weakening and Contraction
<p><a href="http://en.wikipedia.org/wiki/Structural_rule" rel="nofollow">Wikipedia</a> says that weakening is a structural rule where the hypotheses or conclusion of a sequent may be extended with additional members and that contraction is a rule where two equal (or unifiable) members on the same side of a sequent may ...
terminology programming languages type theory
1
Weakening and Contraction -- (terminology programming languages type theory) <p><a href="http://en.wikipedia.org/wiki/Structural_rule" rel="nofollow">Wikipedia</a> says that weakening is a structural rule where the hypotheses or conclusion of a sequent may be extended with additional members and that contraction is a r...
habedi/stack-exchange-dataset
30,046
How are Signed integers different from unsigned integers once compiled
<p>How are Signed integers different from unsigned integers once compiled?</p>&#xA;&#xA;<p>I already know about twos compliment and the like but my question is how can you tell the difference when looking at 8 bit integers when in binary eg <code>10000001</code> if this is a signed integer it would be equal to -127 but...
compilers integers arithmetic
1
How are Signed integers different from unsigned integers once compiled -- (compilers integers arithmetic) <p>How are Signed integers different from unsigned integers once compiled?</p>&#xA;&#xA;<p>I already know about twos compliment and the like but my question is how can you tell the difference when looking at 8 bit ...
habedi/stack-exchange-dataset
30,059
Emulations of atomic registers and read-modify-write (RMW) primitives in message-passing systems
<p>The ABD algorithm in <a href="http://dl.acm.org/citation.cfm?id=200869" rel="nofollow">paper: Sharing Memory Robustly in Message-Passing Systems</a> can emulate single-writer multi-reader atomic registers in message-passing systems, in the presence of processor or link failures. </p>&#xA;&#xA;<p>Looking into the det...
algorithms reference request distributed systems concurrency synchronization
1
Emulations of atomic registers and read-modify-write (RMW) primitives in message-passing systems -- (algorithms reference request distributed systems concurrency synchronization) <p>The ABD algorithm in <a href="http://dl.acm.org/citation.cfm?id=200869" rel="nofollow">paper: Sharing Memory Robustly in Message-Passing S...
habedi/stack-exchange-dataset
30,060
Implementing general vertex folding procedure in an undirected graph
<p>I'm implementing the algorithm presented in <em>"Improved Parameterized Upper Bounds for Vertex Cover"</em> paper (<a href="http://www.cs.lafayette.edu/~gexia/research/mfcs06.pdf" rel="nofollow noreferrer">PDF</a>).&#xA;I'm a bit stumped by the <code>General-Fold</code> procedure.&#xA;What it should do is reduce the...
algorithms graphs parameterized complexity
1
Implementing general vertex folding procedure in an undirected graph -- (algorithms graphs parameterized complexity) <p>I'm implementing the algorithm presented in <em>"Improved Parameterized Upper Bounds for Vertex Cover"</em> paper (<a href="http://www.cs.lafayette.edu/~gexia/research/mfcs06.pdf" rel="nofollow norefe...
habedi/stack-exchange-dataset
30,073
Cutting equal sticks from different sticks
<p>You have $n$ sticks of arbitrary lengths, not necessarily integral.</p>&#xA;&#xA;<p>By cutting some sticks (one cut cuts one stick, but we can cut as often as we want), you want to get $k&lt;n$ sticks such that:</p>&#xA;&#xA;<ul>&#xA;<li>All these $k$ sticks have the same length;</li>&#xA;<li>All $k$ sticks are at l...
algorithms optimization
1
Cutting equal sticks from different sticks -- (algorithms optimization) <p>You have $n$ sticks of arbitrary lengths, not necessarily integral.</p>&#xA;&#xA;<p>By cutting some sticks (one cut cuts one stick, but we can cut as often as we want), you want to get $k&lt;n$ sticks such that:</p>&#xA;&#xA;<ul>&#xA;<li>All the...
habedi/stack-exchange-dataset
30,077
Decidability of empty intersection of two languages accepted by Turing machines
<p>I am really struggling with determining the decidability of languages and cant figure out whether this problem is decidable or not.</p>&#xA;&#xA;<p>I have a language </p>&#xA;&#xA;<p>$\qquad\displaystyle&#xA; L = \{ (R(M_1), R(M_2)) \mid L(M_1) \cap L(M_2) = \emptyset \}$, </p>&#xA;&#xA;<p>where $R(M_1)$ and $R(M_2...
computability turing machines undecidability
1
Decidability of empty intersection of two languages accepted by Turing machines -- (computability turing machines undecidability) <p>I am really struggling with determining the decidability of languages and cant figure out whether this problem is decidable or not.</p>&#xA;&#xA;<p>I have a language </p>&#xA;&#xA;<p>$\qq...
habedi/stack-exchange-dataset
30,081
Why is the processor's pipeline delay calculated as N*max(Delay) ? why not N*(D1 + D2 + D3 ... )?
<p>Consider a four stage pipeline, and each stage has delays D1, D2, D3 and D4, so the total delay because of the various stages should be <code>N * (D1 + D2 + D3 + D4)</code> where N is the number of instructions, but I see that this is not the case, I see <a href="http://webdocs.cs.ualberta.ca/~amaral/courses/429/web...
computer architecture cpu pipelines
1
Why is the processor's pipeline delay calculated as N*max(Delay) ? why not N*(D1 + D2 + D3 ... )? -- (computer architecture cpu pipelines) <p>Consider a four stage pipeline, and each stage has delays D1, D2, D3 and D4, so the total delay because of the various stages should be <code>N * (D1 + D2 + D3 + D4)</code> where...
habedi/stack-exchange-dataset