instruction
stringlengths
0
29.8k
⌀
So I think the above language is regular. I tried using pumping lemma but pumping up or down, changes the value of w1 but has no relation with w2 or w3. The resulting string after pumping will also be in the language. I think the language w1w2w3 is just similar to {0,1}* . I can create a NFA for {0,1}* , so that is why...
So I think the above language is regular. I tried using pumping lemma but pumping up or down, changes the value of w1 but has no relation with w2 or w3. The resulting string after pumping will also be in the language. I think the language w1w2w3 is just similar to {0,1}* . I can create a NFA for {0,1}* , so that is why...
So I think the above language is regular. I tried using pumping lemma but pumping up or down, changes the value of w1 but has no relation with *w2* or *w3*. The resulting string after pumping will also be in the language. I think the language *w1w2w3* is just similar to {0,1}* . I can create a NFA for {0,1}* , so that ...
Here is the proof of a∗ being star-free: $\Sigma* = \bar{\emptyset} $ $ A∗= \overline{Σ∗(Σ∖A)Σ∗} $ I'm kind of confused whether there could be a similar proof for $a * b$ or $(a * b) *$. Would this be a proof for $a * b$? : $ A∗B= \overline{Σ∗(Σ∖A)Σ∗(Σ∖B)} $ For $(A * B )*$ it seems more complic...
null
I have this proof for the optimality of the greedy algorithm for the interval scheduling problem in my algorithms class, but I'm struggling to understand it fully, especially starting from the second slide. Does anyone know how to simplify this proof explanation? Thanks! [![First Slide][1]][1] [![Second Slide]...
Proof of The Optimality Of Greedy Algorithm for The Interval Scheduling Problem
|algorithms|optimization|greedy-algorithms|correctness-proof|induction|
I have this proof for the optimality of the greedy algorithm for the interval scheduling problem in my algorithms class, but I'm struggling to understand it fully, especially starting from the second slide. Does anyone know how to simplify this proof explanation? Thanks! [![First Slide][1]][1] [![Second Slide]...
I have this proof for the optimality of the greedy algorithm for the interval scheduling problem in my algorithms class, but I'm struggling to understand it fully, especially starting from the second slide. Does anyone know how to simplify this proof explanation? Thanks! [![Third Slide][3]][3] [![Second Slide][2]]...
null
I'm currently having trouble coming with context free grammar to describe this language. My current intuition is to generate an arbitrary amount of a,b,c's on my string and then whenever the character d is added to my string, I add two instances of either a,b,c to my string. However, I'm struggling in defining the ins...
Write a CFG for a language of the form L_1 ={a^ib^jc^kd^m|i,j,k>=0, i +j +k> m}
|formal-languages|automata|context-free|
null
In the [Computer organization and design][1] book, there is an exercise in chapter 1 that stated: > Assume that, as the program is parallelized to run over multiple cores, the number of arithmetic and load/store instructions per processor is divided by 0.7 × p (where p is the number of processors) but t...
What is the relation of branch instruction in single core CPU v.s. multicore CPU?
|computer-architecture|parallel-computing|
I got this question in an exam and my approach was to use probability. Jarvis's march is better than Graham's scan if h < log(n) So I calculated the probability of a point being on the circle boundary instead of being inside of it and I showed that since probability of being on the circle < log(probability of bei...
On a set of points uniformly distributed in a circle, on average, what would be better? Graham's scan or Jarvis's march
|average-case|convex-hull|
This is very curious. There is hyperthreading, where one core basically handles two instruction streams, without any execution units being added. The total performance for two threads will be closer to the theoretical maximum of instructions that this core could achieve. If you have incredibly good code that gets 8...
null
It’s a good algorithm if you want a single pass through your data. If it is not precise enough you have two choices: 1. A more complicated algorithm. Calculate a rough estimate of the mean. Then get the precise mean: Add the differences between data points and the estimated mean, reducing your numbers. And add numb...
I got this question in an exam and my approach was to use probability. Jarvis's march is better than Graham's scan if h < log(n) So I calculated the probability of a point being on the circle boundary and showed that since probability of being on the circle < log(probability of being inside the circle), Jarvis's ...
null
Define that a srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. I'm trying to find an algorithm for checking equality of srlists, but unfortunately the naive...
Checking equality of self-referential lists
|data-structures|recursion|equality|
Define that a srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. So... I'm trying to find an algorithm for checking equality of srlists...
Oops. inequality the wrong way. Will edit later. We have a "reference question" https://cs.stackexchange.com/q/18524/4287 where one of the suggestions is to write the language according to its "nesting structure". Then the grammar follows that structure. $\{\; a^ib^jc^kd^m \mid i +j +k> m \;\} = \{\; a^ib^jc^k\, ...
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. So... I'm trying to find an algorithm for checking equality of srlist...
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. For example, $S = [S]$ is a perfectly good definition of an srlist. S...
{"Voters":[{"Id":4287,"DisplayName":"Hendrik Jan"}],"DeleteType":1}
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. For example, $S = [S]$ is a perfectly good definition of an srlist. S...
Note that the four requirements in the excellent [answer][1] by D.W. are in fact first-order definable. That is, they can be formulated quantifying over positions in the string and the relative order of these positions. By a result of McNaughton and Papert these are star-free. Every regular language, including the n...
I'm really stuck here and do not know what to do. So far, I've constructed a DFA and a regular expression that produces the aforementioned set of strings. Namely, the DFA looks like: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/HjBve.jpg After a lot of efforts I managed to find a con...
Construct a regular grammar that produces all possible strings of $\Sigma = \{a,b\}$ that do not contain substring 'abba'
|regular-languages|finite-automata|regular-expressions|
I'm really stuck here and do not know what to do. So far, I've constructed a DFA and a regular expression that produces the aforementioned set of strings. Namely, the DFA looks like: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/HjBve.jpg After a lot of efforts I managed to find a con...
null
As we know, the operating system maintains a data structure for every process called process control block. My question is where this data structure is stored inside the OS ?
Process Control Block
|operating-systems|
Here is the proof of a∗ being star-free: $\Sigma* = \bar{\emptyset} $ $ A∗= \overline{Σ∗(Σ∖A)Σ∗} $ Would this be a proof for $a * b$? : $ A∗B= \overline{Σ∗(Σ∖A)Σ∗(Σ∖B)} $ For $(A * B )*$ it seems more complicated if not impossible, but is that proofable? Edit: This proof doesn't work. It will ...
null
That already is a [regular grammar](https://en.wikipedia.org/wiki/Regular_grammar); in particular, it is right-regular.
null
**`n log(n)` by Harvey and van der Hoeven (2021)** This was mentioned in two comments previously ([1](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algorithm-for-multiplication-of-two-n-digit-numbers#comment323158_16226), [2](https://cs.stackexchange.com/questions/16226/what-is-the-fastest-algorit...
null
null
null
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. For example, $S = [S]$ is a perfectly good definition of an srlist. Also...
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. For example, $S = [S]$ is a perfectly good definition of an srlist. D...
Define that an srlist ("self-referential list") over $X$ consists of a list of elements of $X \sqcup \mathrm{srlist}(X).$ So basically, the items can be primitive values, or further self-referential lists, or a mixture of both. Cycles are allowed. For example, $S = [S]$ is a perfectly good definition of an srlist. D...
null
We define the signature of an srlist $S$ as the set of finite sequences $a_i$ of integers such that $S[a_1][a_2][a_3]...[a_n]$ exists. It's not hard to see that two srlists are equal iff the have the same signature. It's also not hard to see that the signature of an srlist is a regular language - the states are all ...
Your explanation appears to be correct. Here's the English translation of your explanation: If you define the unit time as WSTt + 2Tp, within this time frame, the sliding window can send the entire window twice (assuming a window size of 3, sending frames (0,1,2) and then (3,4,5)). Therefore, the result for utilizat...
If you define the unit time as WSTt + 2Tp, within this time frame, the sliding window can send the entire window twice (assuming a window size of 3, sending frames (0,1,2) and then (3,4,5)). Therefore, the result for utilization rate (LU) becomes LU = (2 * WS * Tt) / (WS * Tt + 2 * Tp). If you ask whether you can ig...
If you define the unit time as WSTt + 2Tp, within this time frame, the sliding window can send the entire window twice (assuming a window size of 3, sending frames (0,1,2) and then (3,4,5)). Therefore, the result for utilization rate (LU) becomes LU = (2 * WS * Tt) / (WS * Tt + 2 * Tp). If you ask whether you can ig...
>The name of a computer should never be bound into an operating system at compile time. Explain why. I don't see a reason why this should not be allowed? Say we have couple of computers all with the name "desertfx" hardcoded in the operating system. What's the downside of this. Not small downside like "unable t...
Would the computers be able to communicate if all of them had same name hardcoded in their OS? Why not?
|computer-networks|
null
Theorem: "If A is mapping reducible to B and B is recognizable, then A is recognizable." I know that the following statement is FALSE. "If A is mapping reducible to B and A is recognizable, then B is recognizable." But I can't come up with an example to prove that.
Is there any example of a Turning-recognizable language mapping reducible to a NOT Turning-recognizable language?
|complexity-theory|turing-recognizable|
null
Here an interesting graph problem I've recently saw: After a heist in New York City, a group must reach Miami within a set timeframe to catch an escape boat. Their vehicle's GPS shows U.S. routes with city-to-city distances (in term of number of days), but it has a limited fuel range. Refueling requires a full day's...
Probabilistic Pathfinding
|graphs|optimization|shortest-path|probabilistic-algorithms|
What is the minimum length of a string that is accepted by a DFA, shows that the language accepted by that DFA is infinite? I checked this post https://cs.stackexchange.com/questions/73993/how-to-determine-if-an-automata-dfa-accepts-an-infinite-or-finite-language and in the answer provided by Rick Decker, he states,...
What is the minimum length of a string that is accepted by a DFA that shows that the language accepted by that DFA is infinite?
|finite-automata|
What is the Minimum length of a string that is accepted by a DFA that shows that the language accepted by that DFA is infinite?
What is the minimum length of a string that is accepted by a DFA, shows that the language accepted by that DFA is infinite? I checked this post https://cs.stackexchange.com/questions/73993/how-to-determine-if-an-automata-dfa-accepts-an-infinite-or-finite-language and in the answer provided by Rick Decker, he states,...
Everything I can easily find on applying permutations in-place relies on treating swaps as elementary operations. But in reality, every swap requires at least two moves (to move the first item into the se ond place and the second item into the first place), and we should be able to do better than that when permuting mo...
Applying permutations with moves rather than swaps
|permutations|performance|
Consider the following: [Here is](https://github.com/dolio/turing/blob/trunk/src/UHalting.agda) a formalization of a proof that halting is undecidable based on universal Turing machines. It uses the following components: 1. Adding a new state that loops forever to a machine. Each rule where the machine would halt...
Consider the following: [Here is](https://github.com/dolio/turing/blob/trunk/src/UHalting.agda) a formalization of a proof that halting is undecidable based on universal Turing machines. It uses the following components: 1. Adding a new state that loops forever to a machine. Each rule where the machine would halt...
Consider the following: [Here is](https://github.com/dolio/turing/blob/trunk/src/UHalting.agda) a formalization of a proof that halting is undecidable based on universal Turing machines. It uses the following components: 1. Adding a new state that loops forever to a machine. Each rule where the machine would halt...
Possibly the off-by-one is due to the fact that sometimes we (slightly) abuse the definition of DFAs by using a transition function that is not total. Of course, such a DFA is equivalent to a DFA with a total transition function and one more state. To avoid confusion let's consider total transition functions only....
This is very curious. There is hyperthreading, where one core basically handles two instruction streams, without any execution units being added. The total performance for two threads will be closer to the theoretical maximum of instructions that this core could achieve. If you have incredibly good code that gets 8...
Possibly the off-by-one is due to the fact that sometimes we (slightly) abuse the definition of DFAs by using a transition function that is not total. Of course, such a DFA is equivalent to a DFA with a total transition function and one more state, so the distinction usually does not matter. However, since you are a...
The [FLP paper][1] provides proof in section "4. Initially Dead Processes" that consensus is possible if majority of processes live and no process dies during the consensus protocol. The proof has 3 main steps: 1. Build G graph in way that each process broadcast it's process number and waits for the message from L...
What is the proof in FLP that clique with majority of processes exist if no process dies during consensus?
|distributed-systems|consensus|
What is the proof in FLP for statement that "clique with majority of processes exist" if no process dies during consensus?
What is the proof in FLP for statement that "clique with majority of processes exist" if majority processes live and none of them dies?
What is the proof in FLP for statement that "clique with majority of processes exist" if majority of three processes live and none of them dies?
What is the proof in FLP for statement that "clique with majority of processes exist" if majority of the processes live and none of them dies?
What is the proof in FLP for statement that "clique with majority of processes exist" if majority of the processes live?
The [FLP paper][1] provides proof in section "4. Initially Dead Processes" that consensus is possible if majority of processes live and no process dies during the consensus protocol. The proof has 4 main steps: 1. Build G graph in way that each process broadcast it's process number and waits for the message from L...
The [FLP paper][1] provides proof in section "4. Initially Dead Processes" that consensus is possible if majority of processes live and no process dies during the consensus protocol. The proof has 4 main steps: 1. Build G graph in way that each process broadcast it's process number and waits for the message from L...
The [FLP paper][1] provides proof in section "4. Initially Dead Processes" that consensus is possible if majority of processes live and no process dies during the consensus protocol. The proof has 4 main steps: 1. Build G graph in way that each process broadcast it's process number and waits for the message from L...
null
null
This is my implementaion of a list structure. It is not dynamically allocated, and all allocations are done when it is constructed. - Itteration is at worst case O(n), n being the max size of the list - Insert is O(1) - Remove is O(1), except if using sort optimization(tradeoff: slows remove but potentially hel...
null