instruction stringlengths 0 29.8k ⌀ |
|---|
How do we find all equivalence classes of $\mathsf{R_L}$ for a language?
Say I'm trying to look for all equivalent classes for the regular language $\mathsf{L}$ is $011(0+1)^*011$.
ps
Equivalent Relation
$xRy$ iff $(\forall w)[xw \in \mathsf{L} \Leftrightarrow yw \in \mathsf{L}]$ |
DFA Minimization: Finding all equivalence classes of $\mathsf{R_L}$ for language $011(0+1)^*011$ |
How do we find all equivalence classes of $\mathsf{R_L}$ for a language?
Say I'm trying to look for all equivalent classes for the regular language $\mathsf{L}$ is $011(0+1)^*011$.
ps
The relation $\mathsf{R_L}$ is an equivalent relation.
$\mathsf{R_L}$ on $\Sigma^* as:$
$xRy$ iff $(\forall w)[xw \in \m... |
How do we find all equivalence classes of $\mathsf{R_L}$ for a language?
Say I'm trying to look for all equivalent classes for the regular language $\mathsf{L}$ is $011(0+1)^*011$.
Here's an example they give us in the book
http://books.google.com/books?id=VEHYzv0GHt8C&pg=PA73&lpg=PA73&dq=ding+du+example+2.51&s... |
You may want to look at Sipser's "Theory of Computation" for a full explanation.
Technically, you must first define the problem. What do you mean by "find the equivalence classes"? You probably mean that you want to find a representative of each class, or to find an algorithm that given a word, classifies it to a clas... |
Let $T$ be a Turing machine whose accepted language is $L(M)$. Let $X$ be another language. How do you approach a proof like $L(M)\subseteq X?$ |
Proof-sketch on the language accepted by a Turing machine |
|formal-languages|turing-machines| |
|formal-languages|turing-machines|proof-techniques| |
Let $T$ be a Turing machine whose accepted language is $L(T)$. Let $X$ be another language. How do you approach a proof like $L(T)\subseteq X?$ |
In order to prove that any machine, automaton or grammar satisfies $L(T) \subseteq X$ you have to translate your intuition of how it was designed into hard facts. What is the intended meaning of a certain configuration, how where the states chosen? So you have to divide the operation of the machine into phases. Like, "... |
null |
The main approach is to start with arbitrary word $w$ in $L(T)$ and then show that $w$ is also in $X$. In order to do so, you will probably need see the "relation" between $L(T)$ and $X$.
The specifics highly depend on $T$ and $X$, but generally, there are two ways:
1. From the description of $T$ you figure out w... |
The following pseudo code is quoted from K&R:
while (next operator or operand is not EOF indicator)
if (number)
push it
else if (operator)
pop operands
do operation
push result
else if (newline)
pop and print top of stack
else
erro... |
Evaluation of reverse Polish notation |
|algorithms|formal-languages|software-verification| |
How do you define the semantics of RPN? Ignoring the print commands, I would imagine a recursive definition that, given a sequence of operations, tells you what the state of the stack is like. From this definition it is straightforward to prove the correctness of the algorithm. In order to add prints, the recursive def... |
We only consider the [reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation) as an arithmetic expression.
The following pseudo code is quoted from K&R:
while (next operator or operand isn't empty)
if (it's a number)
push it
else if (it's an operator, say +,-,*,/)... |
We only consider the [reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation) as an arithmetic expression.
Formally, RNP is a sequence consisted of numbers and arithmetic operators: $+,-,*,/$, and its syntax is:
$$\newcommand\RNF{\mathrm{RNF}}\newcommand\num{\mathrm{number}}\newcommand\op{\ma... |
How do you define the semantics of RPN? Ignoring the print commands, I would imagine a recursive definition that, given a sequence of operations, tells you what the state of the stack is like. From this definition it is straightforward to prove the correctness of the algorithm. In order to add prints, the recursive def... |
null |
{"OriginalQuestionIds":[1418],"Voters":[{"Id":472,"DisplayName":"Juho"},{"Id":6447,"DisplayName":"vonbrand"},{"Id":1636,"DisplayName":"Luke Mathieson"},{"Id":867,"DisplayName":"AJed"},{"Id":41,"DisplayName":"Kaveh"}]} |
null |
null |
null |
In order to prove that any machine, automaton or grammar satisfies $L(T) \subseteq X$ you have to translate your intuition of how it was designed into hard facts. What is the intended meaning of a certain configuration, how where the states chosen? So you have to divide the operation of the machine into phases. Like, "... |
null |
null |
I have this confusion related to the time complexity of FFT. I was reading this book related to Design and Analysis of Algorithms and I came across FFT.
It says that lets say I have a polynomial of degree n-1. I want to evaluate the polynomial at $2n^{th}$ roots of unity. For that I can use divide and conquer rule
... |
Confusion related to time complexity of fast fourier transform |
|algorithm-analysis| |
|algorithm-analysis|fourier-transform| |
If you compute by recursion each unit root at a time, it will indeed be costly. However, observe that when you compute $A_{even}(\omega_{n/2}^i)$ and $A_{odd}(\omega_{n/2}^i)$, you actually gain two values for $A$. For $i< n/2$ we have that:
$A(\omega^i_n)=A_{even}(\omega_{n/2}^i)+ \omega_{n}^i\cdot A_{odd}(\omega_{... |
null |
I asked a question on persistence data structure [here][1]. After that I came across an [article on code project][2]. I have got a question on the following figure from the same article:
![enter image description here][3]
The author says:
> Inserting a new item into a persistent singly linked list will not
... |
Sharing of nodes in Persistence data structure |
|data-structures| |
I think the Wikipedia articles [$\mathsf{P}$][1], [$\mathsf{NP}$][2], and [$\mathsf{P}$ vs. $\mathsf{NP}$][3] are quite good. Still here is what I would say:
----
###Decision Problems
There are various kinds of computational problems. However in an introduction to computational complexity theory course it is easie... |
I think the Wikipedia articles [$\mathsf{P}$][1], [$\mathsf{NP}$][2], and [$\mathsf{P}$ vs. $\mathsf{NP}$][3] are quite good. Still here is what I would say:
----
###Decision Problems
There are various kinds of computational problems. However in an introduction to computational complexity theory course it is easie... |
I think the Wikipedia articles [$\mathsf{P}$][1], [$\mathsf{NP}$][2], and [$\mathsf{P}$ vs. $\mathsf{NP}$][3] are quite good. Still here is what I would say:
----
###Decision Problems
There are various kinds of computational problems. However in an introduction to computational complexity theory course it is easie... |
I asked a question on persistence data structure [here][1]. After that I came across an [article on code project][2]. I have got a question on the following figure from the same article:
![enter image description here][3]
The author says:
> Inserting a new item into a persistent singly linked list will not
... |
I asked a question on persistence data structure [here][1]. After that I came across an [article on code project][2]. I have got a question on the following figure from the same article:
![enter image description here][3]
The author says:
> Inserting a new item into a persistent singly linked list will not
... |
CPU caches are used by exploiting temporal and spatial locality. My question is who is responsible for managing these caches? Is this Operating system that identifies a particular access pattern and then manages (i.e store the data in) cache, using low level OS function calls?
|
CPU Cache is managed by which software component? |
|cpu-cache| |
What data structure should I store my graph in to get the best performance from the Dijkstra algorithm?
Object-pointer? Adjacency list? Something else?
I want the lowest O(). Any other tips are appreciated too! |
What graph data structure works fastest with Dijkstra's algorithm? |
|algorithms|data-structures| |
The CPU caches are operational from the very moment on when the CPU is powered up. Neither the BIOS nor an OS are strictly speaking “necessary” to control the caches. The BIOS and the OS can change cache configuration settings in the CPU but they don’t control the normal operation, this is all built into the CPU itself... |
Implementing Dijkstra's algorithm with a Fibonacci-heap gives $O(|E|+|V|\log |V|)$ time, and is the fastest implementation known.
As for the representation of the graph - theoretically, Dijkstra may scan the entire graph, so an adjacency list should work best, since from every vertex the algorithm scans all its nei... |
null |
You can implement Dijkstra's algorithm as BFS with a priority queue (though it's not the only implementation).
Dijkstra's algorithm relies on the property that the shortest path from $s$ to $t$ is also the shortest path to any of the vertices along the path. This is exactly what BFS does.
Or in another perspectiv... |
According to [this page][1] it is. Is it really that simple? I think not...
[1]: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=graphsDataStrucs3 |
Is Dijkstra's algorithm just BFS with a priority queue? |
|untagged| |
null |
null |
According to the [Wikipedia page][1], search is "not an operation" on binary heaps (see complexity box at top-right).
Why not? Binary heaps may not be sorted, but they are ordered, and a full graph traversal can find any object in O(n) time, no?
Is the page wrong or am I?
[1]: http://en.wikipedia.org/wiki/... |
Is search a binary heap operation? |
|data-structures| |
I have some confusion related to a divide and conquer problem. Here is the problem
You’re consulting for a small computation-intensive investment company, and they have the following type of problem that they want to solve over and over. A typical instance of the problem is the following. They’re doing a simulation ... |
Confusion related to a divide and conquer problem |
|algorithms|algorithm-analysis| |
Such list is intended to be immutable - the shared nodes will never be written to. There is no problem with several threads reading from the same memory location. |
null |
For counting many types of combinatorial objects, like trees in this case, there are powerful mathematical tools (the symbolic method) that allow you to mechnically derive such counts from a description how the combinatorial objects are constructed. This involves generating functions.
An excellent reference is [Anal... |
Actually it depends on your point of view, or level of detail.
The **heap** as abstract data structure usually supports operations like *is-empty*, *add-element*, *delete-min*. And usually not *find-element*. This is the data structure seen as a specification, the set of operations and their behaviour. The implement... |
The [CPU cache][1] handles each and every access to memory, that is just too fast to be under software control. It is entirely built into the hardware, either on the CPU chip itself or on the motherboard.
[1]: http://en.wikipedia.org/wiki/CPU_cache |
What I'd have done is to scan the array of prices, keeping track of the best range seen so far and the best starting point for the range ending here. I.e., when standing at day $k$, know the best range before $k$ (say $i$ to $j$, and its value $b$; and keep track what $l$ is so that the range $l$ to $k$ is maximal). Th... |
What I'd have done is to scan the array of prices, keeping track of the best range seen so far and the best starting point for the range ending here. I.e., when standing at day $k$, know the best range before $k$ (say $i$ to $j$, and its value $b$; and keep track what $l$ is so that the range $l$ to $k$ is maximal, say... |
null |
Actually it depends on your point of view, or level of detail.
The **heap**, or better **priority queue**, as abstract data structure usually supports operations like *is-empty*, *add-element*, *delete-min*. And usually not *find-element*. This is the data structure seen as a specification, fixing the set of operati... |
The time complexity of merge (union) operation is said to be O(lg (n1 + n2)), where n1 and n2 is the number of elements in the merged heaps. I do not understand this - the algorithm has to go through all the elements of both rightmost paths of the original heaps - lengths of these paths are bound by O(lg n1) and O(lg n... |
Leftist heap - determining time complexity |
|time-complexity|heaps| |
I am building a system and I have a couple of architectures in mind. I want to have an idea of which architecture is likely to be most performant (quickest).
I can make different decisions like
1) Do everything in one thread
2) Separate this part into one thread, that part into another thread since it can run in ... |
|computer-architecture|efficiency| |
|computer-architecture|cpu-cache| |
|algorithms|optimization| |
|complexity-theory|reductions| |
According to [this page][1], Dijkstra's algorithm is just BFS with a priority queue. Is it really that simple? I think not.
[1]: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=graphsDataStrucs3 |
|algorithms|graphs|shortest-path| |
|data-structures|runtime-analysis|heaps| |
The time complexity of merge (union) operation is said to be $O(\lg (n_1 + n_2))$, where $n_1$ and $n_2$ are the numbers of elements in the merged heaps, respectively. I do not understand this - the algorithm has to go through all the elements of both rightmost paths of the original heaps - lengths of these paths are b... |
According to the [Wikipedia page][1], search is "not an operation" on binary heaps (see complexity box at top-right).
Why not? Binary heaps may not be sorted, but they are ordered, and a full graph traversal can find any object in $O(n)$ time, no?
Is the page wrong or am I?
[1]: http://en.wikipedia.org/wik... |
|data-structures|search-algorithms|heaps| |
null |
Adding to others' answers, and reinforcing a mathematical approach, functional programming also has a nice synergy with Relational Algebra, and Galois Connections.
This is extremely useful in the area of Formal Methods.<br/>
For instance:
- Formal proofs in program verification are simplified with Extended
... |
|data-structures|functional-programming|programming-paradigms| |
I have a quick question on the bubble sort algorithm.
Explain why the bubble sort algorithm does$\theta(n^2)$ comparisons on an n element list.
Can anyone tell me why this is I looked at Wikipedia page and it does not seem to tell me I know that because of its magnitude it takes a lot of work with large numbers. |
Question about bubble sort algorithm? |
|algorithms| |
Assuming I have shown part of the knowledge base in the clausal format:
[1] p1(banana).
[2] not p1(X) or p2(Y).
[3] p1(X) or not p3(F).
... and more rules.
Most of the books, would do something like this:
[1,2] {X=banana} p2(Y).
and more steps.
First question: is it equally cor... |
first order logic resolution unification |
|artificial-intelligence|first-order-logic|knowledge-representation| |
Assuming $X$ here is a variable, rather than an atomic proposition, then first you must specify what is the quantification for 2 and 3. I assume that it should be
$\forall X,Y \neg p1(X)\vee p2(Y)$, and similarly for 3.
In this case, what can be done is to replace $X$ and $Y$ with each atomic proposition available,... |
Consider the worst case analysis: when the array is completely sorted, but from largest to smallest. In this case, bubble sort will make $n-i$ swaps in iteration $i$ (and in particular, there will be a swap in every iteration), and repeat that for $n-1$ times. This gives a total runtime of $(n-1)^2=\theta(n^2)$.
Obs... |
Assuming $X$ here is a variable, rather than an atomic proposition, then first you must specify what is the quantification for 2 and 3. I assume that it should be
$\forall X,Y \neg p1(X)\vee p2(Y)$, and similarly for 3.
In this case, what can be done is to replace $X$ and $Y$ with each atomic proposition available,... |
Here's a possible reduction for $A_{tm} \le S_{tm}$.
Map input $\langle M,w\rangle$ to $\langle M', 0w1\rangle$ such that
> $M'$ on input $x$:
> 0. if $x$ can be written as $1x'0$ for some $x'$, accept. Otherwise,
> 1. if $x$ can be written as $0x'1$ for some $x'$, run $M$ on $x'$ and output the same.
>... |
I am having trouble understanding a mapping reduction and I would appreciate your help. Define
$$\begin{align}
A_{TM} &= \{ \langle M, w \rangle \mid \text{\(M\) is a TM that accepts \(w\)}\} \\
S_{TM} &= \{ \langle M,w \rangle \mid \text{\(M\) is a Turing machine that accepts \(w^R\) whenever it accepts \(w\)}\... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.