instruction
stringlengths
0
29.8k
⌀
The error in your reasoning is where you say "one has to wait an infinite amount of time in order to decide whether or not it belongs in the set". You are hypothesizing one possible way to decide, and then demonstrating that this possible way doesn't work. That is all correct as far as it goes. But this doesn't me...
From each DFA or NFA, you can obtain a labelled transition system, by ignoring which states are the initial or final states. If you have a labelled transition system with a finite set of states and a finite alphabet, as well as an initial state and a set of final states, you can define a corresponding NFA. See ht...
Consider two finite languages, $L_A$ and $L_B$, potentially over different alphabets. Now since these languages are finite, there exist minimal acyclic deterministic finite-state automata to decide them: $M_A$ and $M_B$ respectively. So $x \in L_A$ iff $M_A$ accepts $x$, and $y \in L_B$ iff $M_B$ accepts $y$. We are al...
null
I’m not sure [how you define “superexponential”][1], could you make it precise for me? **If you define "exponential" as something described in the previous link like $2^{n^c}$**: In this context, $O(n!)$ (as you described) is something bounded by $O(n^n) = O(2^{n\log n}) \leq O(2^{n^2})$, not super-exponential; a...
I’m not sure [how you define “superexponential”][1], could you make it precise for me? **If you define "super-exponential" as something described in the previous link like $2^{n^c}$**: In this context, $O(n!)$ (as you described) is something bounded by $O(n^n) = O(2^{n\log n}) \leq O(2^{n^2})$, not super-exponenti...
null
Consider two finite languages, $L_A$ and $L_B$, potentially over different alphabets. Now since these languages are finite, there exist minimal acyclic deterministic finite-state automata to decide them: $M_A$ and $M_B$ respectively. So $x \in L_A$ iff $M_A$ accepts $x$, and $y \in L_B$ iff $M_B$ accepts $y$. We are al...
I have thought the same issue as yours for a long time(I mean from the view of information theory). Maybe there is some fundemental things behind the consensus in the paper, such as entropy (uncertainty) in the whole distributed system of all the nodes, and the purpose of a consensus is to eliminate the entropy or you ...
I have thought the same issue as yours for a long time(I mean from the view of information theory). Maybe there is some fundemental things behind the consensus in the paper, such as entropy (uncertainty) in the whole distributed system of all the nodes, and the purpose of a consensus is to eliminate the entropy or you ...
In Robert Lafore's book "Object Oriented Programming in C++, Fourth Edition", on page 450, he has a section on the bubble sort. The way he describes it is as follows: > Here's how it works, assuming we want to arrange the numbers in the > array in ascending order. First the first element of the array > (arr[0]) is...
A different algorithm called the 'bubble sort'?
|algorithms|sorting|
Ok, I think I found what Lafore is calling the "Bubble sort". It is commonly known as selection sort: https://www.geeksforgeeks.org/selection-sort/
null
null
First, note that if $|\Sigma| > 1$, you have more than eight different $w$. Second, I would assume that $M_w[\varepsilon]$ is the output of the Turing machine corresponding to encoding $w$ on input $\varepsilon$. I assume, that $M_w[v]\downarrow$ is short for $M_w$ halts on $v$. You correctly observed that the...
null
The complexity book by Arora and Barak mentions that "branching programs of constant width (reminiscent of a TM with O(1) bits of memory) seem inherently weak." I am not able to figure out how both are connected. Can anyone here shed a light on this?
How branching programs with small width are related to Turing machines of small space?
|complexity-theory|space-complexity|
How branching programs with small width are related to Turing machines with small space?
Consider a 2-dimensional version of generating points in the circumference of a unit radius circle, independently generate each coordinate uniformly at random from the interval [-1,1]. How to generate a random point in a higher dimension? High level idea is also welcomed. If we try to extend the above idea (2-di...
Algorithm to generate points uniformly at random from a ball
|algorithms|
null
Take the other answers first... What must not happen is for example an algorithm that always takes a long time if an array size goes from 100 to 101, 200 to 201 etc. if this also happens if I change the size from 100 to 101 to 100 to 101 to 100 to 101 and so on. In this situation the changes from 100 to 101 must _no...
null
Consider a 2-dimensional version of generating points in the circumference of a unit radius circle, independently generate each coordinate uniformly at random from the interval [-1,1]. How to generate a random point in a higher dimension? High level idea is also welcomed. If we try to extend the above idea (2-di...
Consider a 2-dimensional version of generating points in the circumference of a unit radius circle, independently generate each coordinate uniformly at random from the interval [-1,1]. How to generate a random point in a higher dimension? High level idea is also welcomed. If we try to extend the above idea (2-di...
Consider a 2-dimensional version of generating points in the circumference of a unit radius circle, independently generate each coordinate uniformly at random from the interval [-1,1]. How to generate a random point in a higher dimension? High level idea is also welcomed. If we try to extend the above idea (2-di...
Consider a 2-dimensional version of generating points in the circumference of a unit radius circle, independently generate each coordinate uniformly at random from the interval [-1,1]. How to generate a random point in a higher dimension? High level idea is also welcomed. If we try to extend the above idea (2-di...
If $2^{n-1} < b - a ≤ 2^n$ then pick a number x, $0 ≤ x < 2^n$, using n coin throws to determine the highest, second highest etc. bit of x. If x < b-a then return a + x otherwise try again. As an optimisation, try again as soon as the throws so far tell you that $x < b - a$ is not possible. For example if b - a = 33, a...
Think of a point in polar coordinates $(r, \theta)$. You can choose $r$ and $\theta$ independently. Picking the angle $\theta$ is easy as it is an uniform random number in $[0, 2\pi)$. Choosing the radius $r$ is more tricky. The length of the circumference of radius $r$ is $2\pi r$, therefore the probability that th...
{"Voters":[{"Id":6759,"DisplayName":"Steven"}]}
Think of a sphere centered in the origin and describe the points using spherical coordinates $(1, \theta, \phi)$ with $0 \le \theta \le \pi$ and $0 \le \phi < 2\pi$. Generate $\theta$ independently and $\phi$ uniformly at random in their respective intervals. The resulting distribution is essentially uniform in this...
{"Voters":[{"Id":6759,"DisplayName":"Steven"}]}
Think of a sphere centered in the origin and describe the points using spherical coordinates $(1, \theta, \phi)$ with $0 \le \theta \le \pi$ and $0 \le \phi < 2\pi$. Generate $\phi$ uniformly at random in its interval. Regarding $\theta$, pick it proportionally to the length of the circumference at angle $\theta$....
null
I have read this question on [compile time gc][1] and what I understand from it is that the compiler wouldn't know if a variable is referenced or not by some other object due to conditional statements (because they are computed at runtime), and that is why runtime GCs are used, as they can dynamically check if a variab...
Could a compiler automatically insert memory deallocations if it were to simulate every conditional statement?
|compilers|garbage-collection|
No, it's not possible for a compiler to do that. Doing so is an undecidable problem. To get some intuition for why it is hard, consider the combinations of loops and conditional statements. It's not clear how you would simulate all possibilities since you don't know at compile time how long the loop will iterate. ...
The textbook that you linked outlines a solution, in the part that begins "The solution is". 1. Generate $x_1, ..., x_d$ independently at random with a Gaussian distribution centered at the origin. The distribution of the vector $(x_1, ..., x_d)$ is then rotationally invariant. 2. Normalize the vector. This gets yo...
null
I have a pubsub channel where an event is fired every time a user logs in, and I want to be able to query the unique users in a date range. Solutions I thought: - Put the data in bigquery, and then use `APPROX_COUNT_DISTINCT`, but it's too expensive - Same as above, plus a cache. Past data doesn't change, so it'...
Efficiently count distinct in large range
|counting|bloom-filters|
The earliest usages of the term that I'm aware of are in regard to Algol 60, one of the first languages to be (or attempted to be) defined by a specification. When people started implementing it, they found that desirable optimizations (such as reordering expressions) could not be performed if the order of evaluation m...
The earliest usages of the term that I'm aware of are in regard to Algol 60, one of the first languages to be (or attempted to be) defined by a specification. When people started implementing it, they found that desirable optimizations (such as reordering expressions) could not be performed if the order of evaluation m...
null
The earliest usages of the term that I'm aware of are in regard to Algol 60, one of the first languages to be (or attempted to be) defined by a specification. When people started implementing it, they found that desirable optimizations (such as reordering expressions) could not be performed if the order of evaluation m...
null
null
null
I think the Google Scholar keywords you're looking for are "sliding window" and "hyperloglog". I found ["Cardinalities estimation under sliding time window by sharing HyperLogLog Counter"](https://arxiv.org/pdf/1810.13132.pdf) and ["Sliding HyperLogLog: Estimating cardinality in a data stream"](https://hal.archives-ouv...
>Prove that there does not exist a Turing machine M such that for every Turing machine K that halts on all inputs, $M$ accepts $\langle K\rangle$ if and only if $L(K)$ is infinite. >The above question came from a set of final practice problems for a computability course. Suppose such a Turing machine M exists. Ma...
prove that there does not exist a Turing machine with a particular property
|formal-languages|turing-machines|undecidability|halting-problem|
I think the Google Scholar keywords you're looking for are "sliding window" and "hyperloglog". I found ["Cardinalities estimation under sliding time window by sharing HyperLogLog Counter"](https://arxiv.org/pdf/1810.13132.pdf) and ["Sliding HyperLogLog: Estimating cardinality in a data stream"](https://hal.archives-ouv...
For a more practical example, imagine writing a program that reads in a graph, performs some operations on it, and prints it out. It's possible a command in the middle deletes a node, dropping half the graph. The only way the program could know to delete the associated memory, however, is to read the graph in, execute ...
What is important about the paragraph above are the few lines that proceed it in the proof. This is all under the context of *"First note that if q is nonfaulty"*. If we know that q is nonfaulty, then we know that q has sent the same value of its internal state, V<sub>q</sub>, to every processor. Therefore, if we ha...
The word "requirements" is the key to solve the question. the requirements mean: (1) some subset Q ofPofsize >(n + m)/2 (2) some value v,op(pwq) = v for each string w over Q of length _<m, p records v The second requirement is very important, which solves the your question.
The word "requirements" is the key to solve the question. the requirements mean: (1) some subset Q ofPofsize >(n + m)/2 (2) some value v,op(pwq) = v for each string w over Q of length _<m, p records v The second requirement is very important, which solves the your question.
The word "requirements" is the key to solve the question. the requirements mean: (1) some subset Q ofPofsize >(n + m)/2 (2) some value v,op(pwq) = v for each string w over Q of length _<m, p records v The second requirement is very important, which solves the your question.
The word "requirements" is the key to solve the question. the requirements mean: (1) some subset Q ofPofsize >(n + m)/2 (2) some value v,op(pwq) = v for each string w over Q of length _<m, p records v. The second requirement is very important, which solves the your question.
null
The word "requirements" is the key to solve the question. the requirements mean: (1) some subset Q ofPofsize >(n + m)/2 (2) some value v,op(pwq) = v for each string w over Q of length _<m, p records v. The second requirement is very important, which solves your question.
I know that whenever click on .exe, it will be moved into RAM so cpu can execute machine code line by line. But what if .exe is bigger than RAM? <br> for eg: I play games which take up more space than my RAM. My RAM is 8gb, but i can still play them. How's that possible
How do we run programs which are bigger than RAM itself
|computer-architecture|operating-systems|
null
Your computer's operating system uses [memory paging](https://en.wikipedia.org/wiki/Memory_paging), which addresses this problem by loading only part of the .exe in memory at any one time, based on what parts are currently needed. See also https://en.wikipedia.org/wiki/Virtual_memory. That said, in practice, .exe f...
In the chapter on space complexity in "Computational Complexity: A conceptual perspective" by Goldreich, it is stated (ch 5.1.2, p 146): > It is tempting to say that sub-logarithmic space machines are not more useful than constant space machines, because it seems impossible to allocate a sub-logarithmic amount of ...
Why do we need to "allocate" an amount of space in the context of space-complexity?
|complexity-theory|turing-machines|space-complexity|
Even without (appropriately) invoking the halting problem, there are situations where this is impossible: for instance when the allocation/deallocation scheme depends on the particular values of the input data, which are unknown at compile-time.
Ok, I think I found what Lafore is calling the "Bubble sort". It is commonly known as selection sort: https://www.geeksforgeeks.org/selection-sort/ **Edit**: As greybeard and Yves Daoust have pointed out, Lafore's algorithm actually performs a lot more swaps than selection sort. Someone has since pointed out to me...
null
> ... if a compiler would simulate every conditional statement in a program ... You forget about programs that have some input: Let's say we have two variables: `A` and `B`. Both are pointers (or references) to objects. If the user presses `X` on the keyboard, a new object is generated and the reference is wri...
null
What D.W. said is correct in one way: It is impossible for a compiler in general to decide that at point X in a program, object O is not referenced anymore and can be deallocated. However, you can (and lots of software does that) use reference counting instead of garbage collection. So you count at runtime how many...
I'm searching for the generic name of an algorithm/method that would allow me to solve this type of problem efficiently. I have a continuous line which I traverse, from one side to the other. Along that line are buckets, placed at various positions which have a given size. Along the line are also items that I have ...
Optimizing placing items in containers across a path
|algorithms|
Think of a sphere centered in the origin and describe the points using spherical coordinates $(1, \theta, \phi)$ with $0 \le \theta \le \pi$ and $0 \le \phi < 2\pi$. Generate $\phi$ uniformly at random in its interval. Regarding $\theta$, pick it proportionally to the length of the circumference at angle $\theta$....
In the chapter on space complexity in "Computational Complexity: A conceptual perspective" by Goldreich, it is stated (ch 5.1.2, p 146): > It is tempting to say that sub-logarithmic space machines are not more useful than constant space machines, because it seems impossible to allocate a sub-logarithmic amount of ...
I was reading about [about NP-intermediate problems on Wikipedia][1] and saw the IMSAT problem mentioned over there. There is no Wikipedia page for that problem and they only cite [this paper][2]. In the paper they define the MSAT problem as: > Recall that the satisfiability problem (SAT) is to decide whether ...
null
For the sake of clarification I'll answer this : > I play games which take up more space than my RAM. My RAM is 8gb, but i can still play them. How's that possible Games are typically made up of large amounts of data and less code. Quite a lot of the data will typically be textures and other data related to grap...
null
null
Is it true that if a given DFA $M = <Q, \Sigma, \delta, q_0, F>$ with $|Q| = n$ accepts all strings $w \in \Sigma^*$ such that $|w|\leq 2n$ then it accepts any $w \in \Sigma^*$ ?
Show that if a DFA accepts all words of length < 2n then it accepts any word
|finite-automata|
Is it true that if a given DFA $M = \langle Q, \Sigma, \delta, q_0, F\rangle$ with $|Q| = n$ accepts all strings $w \in \Sigma^*$ such that $|w|\leq 2n$ then it accepts any $w \in \Sigma^*$ ?
Suppose that a DFA with $n$ states accepts some word $w$ whose length is at least $n$. According to the pumping lemma, we can decompose $w$ as $xyz$, where $|xy| \leq n$, $y \ne \epsilon$, and the DFA accepts $xy^iz$ for all $i \geq 0$. See if you can use this to develop a criterion for your problem (determining whe...
I am reading a research paper in which following equation is given: $\underset{\small{X}\\\text{s.t}\sum_{(i,k)\in \mathcal{A}}x_{ik}=1, \forall i\in \mathcal{M}}{\operatorname{max}} u$ where $\small{X}$ is a binary variable that collects all $x_{i,k}$ $\mathcal{M}$ is a set of clients and say its elements are...
How to read and interpret these expressions?
|algorithms|constraint-satisfaction|summation|