instruction
stringlengths
0
29.8k
⌀
Besides what has been said, I wonder: what kind of real physical device would such a thing (a deterministic infinite automata) modelize? I mean, a Turing machine has an infinity of possible states but at least you can start running it with a bounded memory (limiting it to $n$ reachable states), then after some run t...
**To show that $\text{DCONN}$ is in $\text{NL}$:** you can use the fact that $RCH\in \text{NL}$ and the fact that $\text{NL} = \text{coNL}$. So we have a nondeterministic TM $T$ that decides $\overline{RCH}$ using at most logarithmic space. Now note that a directed graph $G = \langle V, E\rangle$ is not connected iff...
A couple of years ago, I read a story about a professor of computer science, who showed his first semester students a few lines of code with a simple questions. I think it was something along the lines of this: a = 5 b = a a = b + 5 c = a + b What is c? And this professor argued, th...
Few lines of code to test whether a student will understand computer science
|algorithms|
null
**To show that $\text{DCONN}$ is in $\text{NL}$:** you can use the fact that $RCH\in \text{NL}$ and the fact that $\text{NL} = \text{coNL}$. So we have a nondeterministic TM $T$ that decides $\overline{RCH}$ using at most logarithmic space. Now note that a directed graph $G = \langle V, E\rangle$ is not connected iff...
Let $L1 = ${$ a^{n}b^{m} | n > m > 0 $}$ $. Describe a non-regular language $L2$ such that $L3 = L1 ∪ L2$ is regular and $L3 ≠ A^{*}$ (where $A = ${$ a,b $}$ $) From the trace, I cannot prove this with the simple language of $L= ${$ a^{n}b^{m} | n,m > 0 $}$ $ since it must be different from $A^{*}$. In a student...
Proof that the union between two non-regular languages is regular
|regular-languages|
I've a set $N$ of $n$ distinct numbers of $d$-bits each; call them **words** ($1\leq n\leq 2^d$, with $d\geq 1$). I want to store $N$ using as least space as possible, by partitioning $N$ and factoring out the common bits within each group. The problem is finding the optimal partition, taking into account group payload...
Proof that the union between two non-regular languages may be regular
Nowhere does the question state that the intersection of $L1$ and $L2$ must be empty. Also for L1 to contain the empty string it must be that $m = n =0$ in the description, however $m,n >0$, therefore $L1$ doesn't contain the empty string. The obvious solution is for $L3 = \{ a^*b^* \}$ (using kleene star) And t...
Here's how to do it for $false$ stable: Let $i = 0$, go through every element from left to right, and each time we see a $false$ element, swap it to index $i$, and increment $i$. The time complexity is $O(n)$ and the auxiliary space is $O(1)$. It is similar for $true$ stable, but impossible for both stable.
There is no solution for both stable, but I provide the solution for the original book problem. $false$ stable: let $i = 0$, go through every element from left to right, and each time we see a $false$ element, swap it to index $i$, and increment $i$. $true$ stable: let $i = n - 1$, go through every element from r...
For now, this proof only works for a fully populated heap of height **h**, which contains **n=2<sup>h</sup>-1** items. I'm open to suggestions on how to extend it for incomplete heaps. Throughout this answer, i will use two functions called **BuildCost** and **MergeCost**. The build cost is the cost for constructing a ...
The first two proofs only work for a fully populated heap of height **h**, which contains **n=2<sup>h</sup>-1** items. The third proof also works for partial heaps. Throughout this answer, i will use two functions called **BuildCost** and **MergeCost**. The build cost is the cost for constructing a heap of height **h**...
The first two proofs only work for a fully populated heap of height **h**, which contains **n=2<sup>h</sup>-1** items. The third proof also works for partial heaps. Throughout this answer, i will use two functions called **BuildCost** and **MergeCost**. The build cost is the cost for constructing a heap of height **h**...
Let $L1 = ${$ a^{n}b^{m} | n > m > 0 $}$ $. Describe a non-regular language $L2$ such that $L3 = L1 ∪ L2$ is regular and $L3 ≠ A^{*}$ (where $A = ${$ a,b $}$ $) From the trace, I cannot prove this with the simple language of $L= ${$ a^{n}b^{m} | n,m > 0 $}$ $ since it must be different from $A^{*}$. I had though...
null
Let $L_2 = A^* \setminus (L_1\cup \{\varepsilon\})$. Then $L_1 \cup L_2 = A^*\setminus \{\varepsilon\}$ which is regular and not equal to $A^*$.
In traditional processors one move operation can at most move one word between memory locations and optionally increment or decrement the registers which point to those memory locations. In x86 architecture it is realized with `movs` operation, in PDP-11 as `mov` with auto-increment or auto-decrement addressing. But...
Has there been a processor architecture that included commands that move massives of data in the memory with one opcode?
|computer-architecture|cpu|
Has there been a processor architecture that included commands that move arrays of data in the memory with one opcode?
In traditional processors one move operation can at most move one word between memory locations and optionally increment or decrement the registers which point to those memory locations. In x86 architecture it is realized with `movs` operation, in PDP-11 as `mov` with auto-increment or auto-decrement addressing. But...
Is it known whether the language $L_π = \{w\in\{0,1\}^* : w\text{ appears in the binary expansion of }π\}$ is decidable? - $L_π$ is easily recognizable (*a.k.a.* computably enumerable). - A trivially decidable very classical variant of the language is $\{n:0^n\text{ appears in the binary expansion of }π\}$. - Ther...
Decide whether a given string appears in the binary expansion of π
|computability|
In traditional processors one move operation can at most move one word between memory locations and optionally increment or decrement the registers which point to those memory locations. In x86 architecture it is realized with `movs` operation, in PDP-11 as `mov` with auto-increment or auto-decrement addressing. But...
If you don't want $L_2$ to be the complement of $L_1$ (as then $L_3$ would the set of all words), then you can simply choose $L_2$ to be $\overline{L_1}\setminus L$, where $L$ is a nonempty finite language that is contained in $\overline{L_1}$. Correctness follows from standard closure properties of regular languag...
{"Voters":[{"Id":77862,"DisplayName":"Bader Abu Radi"}],"DeleteType":1}
If you don't want $L_2$ to be the complement of $L_1$ (as then $L_3$ would the set of all words), then you can simply choose $L_2$ to be $\overline{L_1}\setminus L$, where $L$ is a nonempty finite language that is contained in $\overline{L_1}$. Correctness follows from standard closure properties of regular languag...
{"Voters":[{"Id":77862,"DisplayName":"Bader Abu Radi"}]}
X86 does the actual move with one op code. A highly complex instruction that sets the source and destination address and the number of bytes would be unnecessary. Specifying registers with these three items is complicated enough.
I'm looking at using something like Crockford Base-32 encoding in a situation where people have to manually write IDs in a very compact space. Crockford Base-32 describes a simple checksum algorithm using modulo 37 that will catch a single substitution or transposition, which helps a lot when dealing with poor handwrit...
Determining the benefit from increasing bits available in base 32 checksum
|encoding-scheme|error-correcting-codes|
This exercise is indeed wrong as written, I don't think there is any reasonable probability space on which variables $T(k)$ for all $k$ can be defined in such a way that it works. But the idea can be made to work. The Quicksort algorithm consists of 4 steps: - Random choice of a pivot - Partition - Sorting the...
Just to clarify the question, you are demanding that $f$ be *total*, i.e. that $f(M)$ terminate in all cases, even if $M$ does not terminate (otherwise we can simply run $M$ and return its output). **Relation to another question:** This being said, question turns out to be the same as the one [I asked here on MathO...
null
Let's start with the equation you wrote in part 2: $\begin{aligned} E[T(n)] & =E\left[\sum_{q=1}^{n} X_q(T(q-1)+T(n-q)+\Theta(n))\right] \\ & =\sum_{q=1}^{n} E\left[X_q(T(q-1)+T(n-q)+\Theta(n))\right] \end{aligned}$ by linearity of the expectation. Now, since $X_q$ is independent from other random choices in t...
null
null
There are simple algorithms to construct sorting networks from 2-sorters, e.g. Batcher's [bitonic](https://en.m.wikipedia.org/wiki/Bitonic_sorter) sorters and [Pairwise sorting networks](https://en.m.wikipedia.org/wiki/Pairwise_sorting_network). How can one construct general sorters with a low number of $k$-sorters,...
What simple constructions / algorithms for sorting and selection networks from k-sorters (k>2) are known?
|ordering|
You might be thinking of this paper: [Testing Programming Aptitude](https://www.ppig.org/files/2006-PPIG-18th-dehnadi.pdf). Saeed Dehnadi. PPIG, 2006. They used a quiz that contained questions like: > Read the following statements and tick the box next to the correct answer in the next column. > > ``` > ...
I've a set $N$ of $n$ distinct numbers of $d$-bits each; call them **words** ($1\leq n\leq 2^d$, with $d\geq 1$). I want to store $N$ using as least space as possible, by partitioning $N$ and factoring out the common bits within each group. The problem is finding the optimal partition, taking into account group payload...
Succint data structure for storing n numbers using a mask-based partition
The first two proofs only work for a fully populated heap of height **h**, which contains **n=2<sup>h</sup>-1** items. The third proof also works for partial heaps. Throughout this answer, i will use two functions called **BuildCost** and **MergeCost**. The build cost is the cost for constructing a heap of height **h**...
Here is one approach. Suppose $n$ is the max length of any route, in segments. Build $2n$ indices, of the following form: - An index of all routes, where we include all segments (exact match). - An index of all routes, where we ignore the $i$th segment, for $i=1,\dots,n$ (match on all but the $i$th segment). ...
So I have a bunch of strings that represent routes in a HTTP web framework. Each string has a leading `/`, some `/`-separated path segments which can either be a string, a single-segment wildcard `?`, or a trailing multi-segment wildcard `*`. (For this problem, we can assume that `*` can only be in a trailing position,...
I teach a fairly advanced algorithms class to high schoolers and I accidentally presented them with a bunk reduction from Hamiltonian path to the Tripartite graph decision problem. My attempt involved creating three vertices in the transformed input G’ for every one vertex in the original undirected graph G and conn...
Reduction from Hamiltonian path to Tripartite decision problem
|complexity-theory|graphs|reductions|polynomial-time-reductions|hamiltonian-path|
null
null
Have 5 states `S`, `Sa`, `Saa`, `Saab`, `Saabb`. Move to a state `Sxxx` after you parsed the first characters `xxx` of `aabb`, except you stay in the accepting state `Saabb` no matter what the input once you reached it. S: a->Sa, b->S. Sa: a->Saa, b->Sa. Saa: a->Saa, b->Saab. Saab:...
null
I have been struggling with the understanding of why this problem is in coNP. **Problem:** CNF-Equivalence, denoted as C, takes as input a pair of CNF formulas ($\phi, \sigma$) both are defined over the same set of $n$ variables $x = (x_{1}, x_{2}, ... x_{n})$. The goal is to decide whether these two formulas are...
Why is CNF-Equivalence coNP?
null
Physical address is the precise location of data in computer memory and logical address is a virtual address that a computer program uses to access memory. While newer processors seamlessly handle both physical and logical addresses, older ones like the Intel 8080/8085 directly generates physical addresses. It doesn't ...
null
null
Proof: If L1,L2∈NP then there exist a deterministic polynomial verifier for L1 and a deterministic polynomial verifier for L2. A polynomial verifier for L1⋅L2 will receive a split “index” (a natural number) of the input w to w1 and w2. The verifier for L1⋅L2 runs L1 verifier on w1 and L2 verifier on w2. Since the ve...
I read the [Amazon Aurora paper][1] and in the performance result section (i.e. 6.1.1), it says > The results are shown in Figure 7 and Figure 6, and measure the performance in terms of write and read statements per second respectively. Aurora’s performance doubles for each higher instance size and for the r3.8xl...
How can Amazon Aurora gain higher read-only throughput?
|distributed-systems|databases|
I teach a fairly advanced algorithms class to high schoolers and I accidentally presented them with a bunk reduction from Hamiltonian path to the Tripartite graph decision problem. My attempt involved creating three vertices in the transformed input G’ for every one vertex in the original undirected graph G and conn...
I teach a fairly advanced algorithms class to high schoolers and I accidentally presented them with a bunk reduction from Hamiltonian path to the Tripartite graph decision problem. My attempt involved creating three vertices in the transformed input $G'$ for every one vertex in the original undirected graph $G$ and ...
Let's start with the equation you wrote in part 2: $\begin{aligned} E[T(n)] & =E\left[\sum_{q=1}^{n} X_q(T(q-1)+T(n-q)+\Theta(n))\right] \\ & =\sum_{q=1}^{n} E\left[X_q(T(q-1)+T(n-q)+\Theta(n))\right] \end{aligned}$ by linearity of the expectation. Now, since $X_q$ is independent from other random choices in t...
I'm exploring the decidability characteristics of a particular language formed by the intersection of two languages, specifically in the context of the Halting Problem. The languages are defined as follows: 1. $\text{Special Halting Problem Language} K: K := \{ w \in \{0, 1\}^* \mid w\#w \in H \}$, where $H$...
Is the "intersection" of the special Halting Problem with a language always undecidable?
|turing-machines|undecidability|halting-problem|semi-decidability|decidability|
I'm trying to solve a problem from one of the older exams. Question: >There's an infinite, one-dimensional board, with fields numbered consecutively $\ldots, -2, -1, 0, 1, 2, \ldots$ A move in the game consists of selecting a field and placing a token on it. If after placing the token it turns out that on two neig...
Amortised cost - transferring tokens
|algorithm-analysis|proof-techniques|amortized-analysis|
I'm trying to solve a problem from one of the older exams. Question: >There's an infinite, one-dimensional board, with fields numbered consecutively $\ldots, -2, -1, 0, 1, 2, \ldots$ A move in the game consists of selecting a field and placing a token on it. If after placing the token it turns out that on two adja...
null
If the string generated by the grammar is long enough then somewhere in the derivation tree we will find a path with a repeated variable. Below that is $A$. This induces the devision $vwxyz$ of the generated string into substrings, following the subtrees in the derivation. Using the rules of the grammar we can play ...
There is no general answer. $B$ could be decidable or undecidable, and $A$ could too, independently of $B$. This table contains different values of $B$ for all cases. | | $B$ decidable | $B$ undecidable | | -------- | -------------- |-| | $A$ **decidable**| $B = \emptyset$ | $B = H_{\$}$ | | $A$ **undecidable...
There is no general answer. $B$ could be decidable or undecidable, and $A$ could too, independently of $B$. This table contains different values of $B$ for all cases. | | $B$ decidable | $B$ undecidable | | -------- | -------------- |-| | $A$ **decidable** ($A = \emptyset$) | $B = \emptyset$ | $B = H$ | | $A$...
As already stated in the comments, it is easy to see that $A^*(BA^*)^* \subseteq (A\cup B)^*$ as every word $x$ in $ A^*(BA^*)^*$ can be written as a concatenation of words that are either in $A$ or in $B$. We show that other direction. Consider a word $x \in(A\cup B)^*$. Then $x$ can be written as $w_1\cdot w_2 \cd...
{"Voters":[{"Id":77862,"DisplayName":"Bader Abu Radi"}],"DeleteType":1}
As already stated in the comments, it is easy to see that $A^*(BA^*)^* \subseteq (A\cup B)^*$ as every word $x$ in $ A^*(BA^*)^*$ can be written as a concatenation of words that are either in $A$ or in $B$. We show that the other containment holds. Consider a word $x \in(A\cup B)^*$. Then $x$ can be written as $w_1\...
{"Voters":[{"Id":77862,"DisplayName":"Bader Abu Radi"}]}
Adding some type of edge detection would likely help as well, otherwise all the edges would glom together as a mass. How you'd do that I do not know as pixels don't retain edge characteristics.
null
Given a multiset $S$ of positive integers and a fixed positive integer $k$, can $S$ be partitioned into $k$ parts with equal sum? For $k = 2$, this is the well-known Partition problem. For general $k$, this is described on [Wikipedia][1] as the "multiway number partitioning" problem, and it's claimed there that this...
NP-hardness of partitioning into k sets
|reference-request|partitions|
To prove a lower bound simply take a worst case example. We will prove the following: **Induction Hypothesis:** There exists a sequence of moves that results in $n$ tokens at position $\log n$ that requires at least $n \log n$ *place* and *remove* operations. For simplicity, assume that $n$ is some power of $2$, and...
The reduction is simple, so you might not require a reference. Given an instance for $k = 2$, simply add $p$ integers each of value $SUM/2$, where $SUM$ is the sum of all the elements in multiset $S$. The new instance has $k := p + 2$.
null
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}]}
The reduction is simple, so you might not require a reference. Given an instance for $k = 2$, simply add $p$ integers each of value $SUM/2$, where $SUM$ is the sum of all the elements in multiset $S$. The new instance has $k := p + 2$. For $k = 2$, the $\mathsf{NP}$-hardness proof is already given on [wiki][1]. ...
{"Voters":[{"Id":107966,"DisplayName":"Inuyasha Yagami"}],"DeleteType":1}