instruction stringlengths 0 29.8k ⌀ |
|---|
Assume we have alphabet $\{0,1\}$.
Map string $w$ to $0{\cdot} w$. Then a copy of $A$ is found in $B$ as all strings starting with $0$. The strings in $B$ that start with $1$ can have any property you like. |
null |
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... |
There are two situations. One, you want a list organised so that the most requested items are at the front of the list and found quickest. In that situation you will more likely use a hash which gives you fast access to all items (and finds equally fast that an item is not present, which a linked list cannot do).
T... |
Let’s say you want to access data at a certain logical address. Your program might use a “load” instruction. That instruction is implemented in the CPU; it will determine if the data is in a cache and return it quickly, or if it is in RAM and at what physical address and return it slowly, or the hardware determines tha... |
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... |
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.
Let us start with the related language
$\{\; a^ib^jc^kd^m \mid i +j +k \ge m \;\} = \{\; a^i a^{i'} b^j b^{j'}... |
{"Voters":[{"Id":4287,"DisplayName":"Hendrik Jan"}]} |
null |
The lemma at wikipedia is very much restricted to languages as sets of (finite length) strings. I believe that formal language theory is nowadays considered more broadly. Its "languages" may consist of [infinite length strings][1], [trees][2], [partial orders][3], [two-dimensional grids][4] and [graphs][5].
One stud... |
null |
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?
|
This is very curious, and I would think someone is really misunderstanding something quite badly.
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 instruction... |
**Outline:** <br>
For generality, we will be looking at $K_{n,n}$ with $n\ge3$ and all edge weights equal to 1.
One can prove that any (s,t)-mincut in $K_{n,n}$ cuts off exactly one vertex.
From that, it follows that the longest path in the GHT has length <=2. The only connected graph with this property is an (2n-1)... |
null |
null |
It's done by the software, usually OS. Paging out is the process of writing data to the external memory, a CPU can't do that on its own.
So, the user program is interrupted, OS reads this page from the disk, maybe writes another page to the disk, updates virtual memory tables and returns control back to the user pro... |
We define Fibonacci words as: $F_0 = a, F_1 = b, F_{n+2} = F_n F_{n+1}$, $a, b$ can be any symbols.
How can we find the longest Fibonacci sub-word in a given string in linear time?
This question is similar to: https://cs.stackexchange.com/q/28865/163786
But I'm in particular interested if there is an $O(n)$ so... |
Longest Fibonacci word |
|algorithms|strings|substrings|subsequences| |
In NLP, it's common to study the semantic similarity between pieces of text, which can be calculated in a number of ways. Are there any tools, methods, algorithms or processes that can be used to compare the semantic similarity of programs? That is, compare if two programs produce a similar output given similar inputs.... |
Semantically Compare Programs by Similarity? |
|algorithm-analysis| |
I'm studying the garbage collection code of Alex Aiken's [COOL](https://theory.stanford.edu/~aiken/software/cool/cool-manual.pdf) programming language's [runtime system](https://theory.stanford.edu/~aiken/software/cooldist/lib/trap.handler).
(This is the language used in a relatively famous [Stanford Online Compiler... |
A formula of the major garbage collection threshold |
|programming-languages|compilers|garbage-collection| |
null |
I'm studying the garbage collection code of Alex Aiken's [COOL](https://theory.stanford.edu/~aiken/software/cool/cool-manual.pdf) programming language's [runtime system](https://theory.stanford.edu/~aiken/software/cooldist/lib/trap.handler).
(This is the language used in a relatively famous [Stanford Online Compiler... |
null |
null |
We have this recurrence: $$T(n)=10T(\frac{n}{3})+n\sqrt{n}$$
We can solve it using Master Theorem and say it is $\Theta(n^{\lg^{10}_3})$. I want to prove it using induction but I don't know the correct and perfect precedure for proving these kinds if problems using induction. I know: $$\mathcal{O}(g(n))=\{f(n):\text{... |
Prove $T(n)=10T(\frac{n}{3})+n\sqrt{n}=\Theta(n^{\lg^{10}_3})$ using induction |
|time-complexity|recurrence-relation|master-theorem|induction| |
We have this recurrence: $$T(n)=10T(\frac{n}{3})+n\sqrt{n}$$
We can solve it using Master Theorem and say it is $\Theta(n^{\lg^{10}_3})$. I want to prove it using induction but I don't know the correct and perfect procedure for proving these kinds if problems using induction. I know: $$\mathcal{O}(g(n))=\{f(n):\text{... |
|time-complexity|algorithm-analysis|recurrence-relation|master-theorem|induction| |
Let $A_{n} = (aa|aaa|aaaa|\dots |a^{n-2})(a^{n})^* $ where $n \geq 4$ is some natural,and $A_2 = (a^2)^*, A_3 = (a^3)^*$. Clearly every transition is thus labeled by an $a$. From now on let $A_n$ denote the DFA that accepts the given $n$th regex.
Clearly we can model $A_n$ with a DFA that is one big loop with eve... |
What is the minimum length word accepted by the product of these simple loop automata? |
|algorithms|regular-languages|automata|finite-automata|regular-expressions| |
Given A memory chip that has 4-addresses and each address location holds 8-bits is denoted as (4×8) RAM chip.
I want to draw a block-diagram showing the memory address that the first 3 chips will hold if using low and high order interleaving.
Does anyone have any similar examples? I am completely lost.
|
Memory Address Block diagram |
|memory-hardware| |
null |
null |
null |
null |
We have this recurrence: $$T(n)=10T(\frac{n}{3})+n\sqrt{n}$$
We can solve it using Master Theorem and say it is $\Theta(n^{\lg_3{10}})$. I want to prove it using induction but I don't know the correct and perfect procedure for proving these kinds if problems using induction. I know: $$\mathcal{O}(g(n))=\{f(n):\text{t... |
We have this recurrence: $$T(n)=10T(\frac{n}{3})+n\sqrt{n}$$
We can solve it using Master Theorem and say it is $\Theta(n^{\lg_3{10}})$. I want to prove it using induction but I don't know the correct and perfect procedure for proving these kinds if problems using induction. I know: $$\mathcal{O}(g(n))=\{f(n):\text{t... |
Prove $T(n)=10T(\frac{n}{3})+n\sqrt{n}=\Theta(n^{\lg_3{10}})$ using induction |
null |
Recently, I am studying grammar in automata. And, I have few information about this subject.
I have a grammar with rules $\{S\to ASA, A\to aA, A\to \epsilon\}$.
Is it true if I say that $S\to aASA$ by rules $S\to ASA, A\to aA$? |
An elementary question about grammar |
|regular-languages|formal-grammars| |
null |
I'll solve a simpler recurrence, $$T(n) = 4T(n/2) + n,$$
but the point is the same, namely that your _induction hypothesis is too weak_.
We show something stronger: $T(n) \leq c \cdot n^2 - dn$ for some $d$. (!!)
So, by induction, we want to show that $T(n) \leq cn^2 - dn$, and we'll set $d$ at the end.
**Ind... |
I'll solve a simpler recurrence, $$T(n) = 4T(n/2) + n,$$
but the point is the same, namely that your _induction hypothesis is too weak_.
We show something stronger: $T(n) \leq c \cdot n^2 - dn$ for some $d$. (!!)
So, by induction, we want to show that $T(n) \leq cn^2 - dn$, and we'll set $d$ at the end.
**Ind... |
You are close, but not precise.
Usually one distinguishes between the arrow notation for the rules $A \to aA$ and the notation for derivation in the grammar, that is the application of the rules in strings $ASA\Rightarrow aASA$.
In your example two consecutive rules are applied, and we write $S\Rightarrow ASA \R... |
|context-free|formal-grammars|notation| |
We have this recurrence: $$T(n)=10T(\frac{n}{3})+n\sqrt{n}.$$
We can solve it using Master Theorem and say it is
$\Theta(n^{\log_3{10}})$. I want to prove it using induction but I don't
know the correct and perfect procedure for proving these kinds of
problems using induction.
I know that
* $f(n) = \mathcal... |
Swift has a syntax that allows you to write something that _looks_ like user defined control structures.
Swift has "closures". Closures are roughly bits of code that can be assigned to a variable or used as a function parameter. That means you can write a function that takes a closure as a parameter, and calls it w... |
I have been reading a paper on private learning [1].
In the proof of lemma 3.3. they claim that
$$
2\left(\frac{2e n_\text{pub}}{d}\right)^{2d}e^{-\alpha n_\text{pub}/4}
$$
is upper bounded by $\beta$ via standard manipulation when $n_\text{pub}=O\left(\frac{d\log(1/\alpha)+\log(1/\beta)}{\alpha}\right)$, $\alpha,... |
On one level, all computer hardware has primitives capable of expressing various control structures.
The process of "user-defining" a particular control structure is then the process of writing a compiled high-level language.
That process of devising a language and compiler is usually quite difficult, because it... |
null |
Given a closed polygon defined in the 2D Euclidean plane. My objective is to determine the point within this polygon that is furthest away from its boundary. In other words, I want to find the point where the distance to the polygon's boundary is maximized.
More formally, given a polygon $P \in \mathbb{R}^2$, for an... |
Finding the Point with Maximum Distance from the Boundary of a Closed Polygon in 2D Euclidean Space |
|algorithms|computational-geometry|polygons|euclidean-distance| |
Is there any example of a Turing-recognizable language mapping reducible to a NOT Turing-recognizable language? |
null |
null |
The [medial axis][1] is the set of points in the interior of the shape that has two closest points on the boundary.
[![The medial axis of a polygon][2]][2]
Intuitively, the largest "incircle" in a polygon must touch the boundary at at least three points. It follows that you can just consider the set of points tha... |
This might be a sledgehammer to crack a nut, but here is my solution.
First let me consider the Fibonacci strings I am used to: $f_{n+2} = f_{n+1} f_n$. Observe that each $f_{n+2}$ is a prefix of the previous $f_{n+1}$. This makes it simple to construct the next Fibonacci string from the previous one. For instance k... |
**Definitions**: Let $n \in \mathbb{N}$. If $\alpha$
and $\beta$ are propositional formulas,
then we'll call $\alpha$ and $\beta$ *independent* if neither implies the other,
or more formally, if $\lnot (\alpha \rightarrow \beta)$
and $\lnot(\beta \rightarrow \alpha)$.
The notation $|\phi|$ refers to the length o... |
How big is a wff over $n$ variables with $2^n$ subformulas? |
|complexity-theory|logic|propositional-logic| |
**Definitions**: Let $n \in \mathbb{N}$. If $\alpha$
and $\beta$ are propositional formulas,
then we'll call $\alpha$ and $\beta$ *independent* if neither implies the other,
or more formally, if $\lnot (\alpha \rightarrow \beta)$
and $\lnot(\beta \rightarrow \alpha)$.
The notation $|\phi|$ refers to the length o... |
null |
How big is a formula equivalent to a wff over $n$ variables with $2^n$ subformulas? |
No. Consider the formula
$$\phi = \alpha_1 \lor \alpha_2 \lor \dots \lor \alpha_{2^n} \lor \text{True},$$
where the $\alpha_i$ are pairwise independent according to your definition.
$\phi$ meets the requirements of your question ($\phi$ contains $2^n$ pairwise independent formulas $\alpha_i$, all $\alpha_i$'s... |
**Definitions**: Let $n \in \mathbb{N}$. If $\alpha$
and $\beta$ are propositional formulas,
then we'll call $\alpha$ and $\beta$ *independent* if neither implies the other,
or more formally, if $\lnot (\alpha \rightarrow \beta)$
and $\lnot(\beta \rightarrow \alpha)$.
The notation $|\phi|$ refers to the length o... |
Let $n = 3^m$ and rewrite the recursion in terms of m and it’s easy. |
Local Binary Pattern is a way to determine a pixel, with a single number by comparing the center pixel with its neigbours. The result will be a binary number. Dos this number have a **gaussian** **distribution**?
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/1gEFs.png |
Is Local Binary Pattern gaussian distributed? |
|computer-vision|classification|pattern-recognition| |
About the cost of mispredictions: I have a newish superscalar processor, and timing can be “interesting”. It can issue three floating-point instructions per cycle, but they usually have four cycles latency. So you might have a loop with 20 instructions that take 80 cycles to finish using only one 12th of the available ... |
Something else happens in compilers that try to do static prediction. On many processors branches taken take longer than branches not taken. Now take a statement “if (x == 0) ++z;”. Typically you will have a conditional branch around the ++z. Now assume the compiler thinks that x is almost never zero. So the branch is ... |
So my understanding of updating the PIC is as follows:
1. Put memory address indicated by PC into memory address register
2. Load the contents of the address pointed to by memory address register into memory data register
3. Place this instruction in the current instruction register.
4. Update PC
5. Decode instruc... |
How does the program counter "know" when the fetch cycle is complete? |
|cpu| |
So my understanding of updating the PC is as follows:
1. Put memory address indicated by PC into memory address register
2. Load the contents of the address pointed to by memory address register into memory data register
3. Place this instruction in the current instruction register.
4. Update PC
5. Decode instruct... |
Given an $m\times n$ matrix $M_{ij}$ where $M_{ij}\in\{0,1\}$, find the minimal range $[a,b]$ for $1<=a<=b<=n$ such that each column has at least one value set to $1$ within that window, i.e. $\sum_{i=a}^bM_{ij} >= 1$ $\forall j \in 1\dots n$
I have been struggling to find an efficient solution or even approximation... |
Finding the minimum window where each input array has at least one active element |
|algorithms|optimization| |
Given an $m\times n$ matrix $M_{ij}$ where $M_{ij}\in\{0,1\}$, find the minimal range $[a,b]$ for $1<=a<=b<=n$ such that each column has at least one value set to $1$ within that window, i.e. $\sum_{i=a}^bM_{ij} >= 1$ $\forall j \in 1\dots n$
I have come across this real-world problem that I have been struggling to ... |
Let $n = 3^m$ and Q(m) = T($3^m$), and rewrite the recursion in terms of m and it’s easy. |
In the Morris Mano's book on Digital Circuits Edition 3, it is defined that r's complement for N=0 is 0 and r-1 complement is not even defined.
But lets say r = base = 2
Then 2'd complement of 0, based on his formula is $r^n - N$ where $n$ is number of digits is $2^1 - 0 = 2$. This also makes sense because $(0)''... |
1's and 2's complement of 0 |
|binary| |
In the Morris Mano's book on Digital Circuits Edition 3, it is defined that r's complement for N=0 is 0 and r-1 complement is not even defined.
But lets say r = base = 2
Then 2'd complement of 0, based on his formula is $r^n - N$ where $n$ is number of digits is $2^1 - 0 = 2$. This also makes sense because $(0)''... |
null |
I'm referencing this Leetcode question: https://leetcode.com/problems/cheapest-flights-within-k-stops/solution/, which asks you to find the length of the shortest path from source to dest using less than or equal to K intermediate nodes.
The worst case time complexity of the first solution in the Leetcode article (... |
Time complexity of using BFS to find shortest path within k stops |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.