instruction stringlengths 0 29.8k ⌀ |
|---|
|algorithms|graphs|reductions| |
I'm looking for a proof for the following problem:
> For languages $L$ and $R$, if $L$ is [deterministic context free][1]
> and $R$ is a regular, then $LR$ is a deterministic context free
> language.
**Note:** $RL$ may not satisfy this condition, i.e if $L=\{wcw^R\mid w\in (a|b)^*\}$, and $R=\{a\}^*$.
[1... |
deterministic context free languages are closed under regular right product |
|formal-languages|regular-languages|pushdown-automata| |
null |
I amm looking for a proof for the following problem:
> For languages $L$ and $R$, if $L$ is [deterministic context-free][1]
> and $R$ is a regular, then $LR$ is a deterministic context-free
> language.
**Note:** $RL$ may not satisfy this condition, i.e if $L=\{wcw^R\mid w\in (a|b)^*\}$, and $R=\{a\}^*$.
... |
Deterministic context-free languages are closed under regular right-product |
|formal-languages|context-free|closure-properties|pushdown-automata| |
|complexity-theory|np-hard|satisfiability|circuits| |
Grammatical characterization of deterministic context-free languages |
Wikipedia actually [gives you the model](https://en.wikipedia.org/wiki/Deterministic_context-free_language) and points to [1] for reference: [LR grammars](https://en.wikipedia.org/wiki/LR_grammar) are equivalent to DPDA.
---
1. [On the Translation of Languages from Left to Right](http://dx.doi.org/10.1016/S0019-... |
Wikipedia page of Josephus Problem offers a recursive formula for killing every kth person in the circle consisted of n people.
--------------------> http://en.wikipedia.org/wiki/Josephus_problem
![enter image description here][1]
[1]: https://i.stack.imgur.com/MKkXe.png
But not enough explaination so I do... |
A Recursive Formula For Generalized Josephus problem |
|recursion| |
null |
Most generally, an automata is a model of computation that describes the process how to convert an input to a solution. *Converting* means that there is a certain set of finite, elementary, local transformation rules, that is applied to the input. The idea behind the automata might be motivated by mechanical designs,... |
The [Josephus Problem](http://en.wikipedia.org/wiki/Josephus_problem) asks where to start taking out every kth person in the circle consisted of n people, such that you are the last "survivor".
The following recursive formula is given:
$$\begin{align}
f(1,k)&=1, \\
f(n,k)&=((f(n-1,k)+k-1) \bmod n )+1.
\end{align... |
I am basically an Electronics and Communication Engineering student. My relevant coursework include Probability Theory and Stochastic Processes, Engineering Mathematics, Signals and Systems, Digital Signal Processing (this semester).
Now, this area Computer Vision - Image Processing - Object recognition - etc caught... |
Should I study Computer Vision or Image Processing |
|image-processing|computer-vision| |
I am basically an Electronics and Communication Engineering student. My relevant coursework include Probability Theory and Stochastic Processes, Engineering Mathematics, Signals and Systems, Digital Signal Processing (this semester).
Now, this area Computer Vision - Image Processing - Object recognition - etc caught... |
I'm trying to understand a proof regarding radix-sort but to no avail.
I'll first write down a brief of the proof and then assign some questions which I hope will be clarified enough.
"
Suppose you have an array of integer numbers in the range {0,1,2,... $nlogn$}.
Show and explain an effective algorithm in the ... |
Radix sort exercise |
|algorithms|algorithm-analysis|sorting| |
I am interested in self-reducibility of Graph 3-Coloralibity problem.
**Definition of Graph 3-Coloralibity problem.**
Given an undirected graph $G$ does there exists a way to color the nodes red, green, and blue so that no adjacent nodes have the same color?
**Definition of self-reducibility.**
A language $... |
null |
Rather than determining each $B(k)$ one at a time, we can be forward looking and only go through each number in $A$ *once*! But we'll use $n$ space:
$$\begin{vmatrix}
A & & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & & B \\
8 & & 0 & 0 & 0 & 0 & 0 & 0 & 0 & \color{red}{0} & 1 & & 0\\
4 & & 0 & 0 & 0 & \color{red}{0... |
How can you perform the clique decision algorithm fewer than $ O(n) $ times to solve clique optimization?
I'm not sure if my approach is right but this is my thought process: you would pick vertices in a graph and see if they form a clique, then keep picking more vertices until you have the max possible clique.
I... |
Using Clique decision to solve Clique optimization |
|decision-problem|np| |
I am looking for a proof for the following problem:
> For languages $L$ and $R$, if $L$ is [deterministic context-free][1]
> and $R$ is regular, then $LR$ is a deterministic context-free
> language.
Note: $RL$ may not satisfy this condition, e.g. if $L=\{wcw^R\mid w\in (a|b)^*\}$, and $R=\{a\}^*$.
[1]: h... |
|np| |
You would use binary search. Start with the lower bound being 3 and the upper bound $n$, where $n$ is the number of vertices. Call your clique decision oracle with a $k$ value halfway between the two bounds. If it answers "yes", move your lower bound to $k + 1$. If it answers "no", move your upper bound down to $k ... |
i am doing a research on control flow analysis on aspect oriented program and i find on some papers an interprocedural approche for doing control flow analysis on others call graph or control flow graph. is there a real difference between cflow graph and iterprocedural cflow graph ?
|
What is the difference between control flow graph & interprocedural control flow graph? |
|terminology|programming-languages| |
null |
I have found an efficient algorithm for verifying if a string $\omega$ is of the form $0^n1^n$, where $n \in \mathbb{N}$.
1. Scan across $\omega$. If a 1 appears before a 0, then reject.
2. Repeat so long as some 0s and some 1s remain on the tape.
3. Scan across $\omega$. If the total number of 0s and 1s re... |
How does this algorithm work for verifying if a string is $0^n1^n$ work? |
|algorithms| |
Apparently, for every k-tape Turing machine that runs in time $O(t(n))$, there exists a 1-tape Turing machine that runs in $O(t^2(n))$.
I can see how any multi-tape machine $M$ can be simulated by a 1-tape machine $S$. Just have the tape of $S$ contain all of $M$'s tapes separated by some symbol such as #.
Howeve... |
Why is it that every k-tape Turing machine has a 1-tape TM that runs in $O(t^2(n))$? |
|turing-machines| |
This is a very informal answer, other users will give you a more formal and concise answer :-)
Suppose you have two numbers written in binary notation (the smaller padded with zeros); for example:
14 = 1110
6 = 0110
A simple algorithm to check if they are equal is comparing the two binary represent... |
This is a very informal answer, other users will give you a more formal and concise answer :-)
Suppose you have two numbers written in binary notation (the smaller padded with zeros); for example:
14 = 1110
6 = 0110
A simple algorithm to check if they are equal is comparing the two binary represent... |
This is a very informal answer (other users will give you a more formal and concise answer :-)
Suppose you have two numbers written in binary notation (the smaller left-padded with zeros); for example:
14 = 1110
6 = 0110
A simple algorithm to check if they are equal is comparing the two binary repr... |
This is a very informal answer (other users will give you a more formal and concise answer :-)
Suppose you have two numbers written in binary notation (the smaller one left-padded with zeros); for example:
14 = 1110
6 = 0110
A simple algorithm to check if they are equal is comparing the two binary ... |
You should be able to modify your dynamic program to return a 3-vector $\langle m, i, d \rangle$ that contains the number of mismatches, insertions, and deletions. It is straightforward to see that edit distance is simply the $\ell_1$ (i.e. sum) of this vector.
If any of these individual values are greater than the ... |
I know that Euclid's algorithm is the best algorithm for get the GCD (great common divisor) for a list the positive integer numbers.
But, in the practice, you can write two codes por evaluate the gcd (for my case, i decided use java, but c/c++ may be another option).
I need to get the most efficient code of two... |
In your suggestion you write the tapes next to one another. That has another disadvantage, if one of the tapes runs out of space one has to move the information to extend that space.
The solution is to write different tapes on "tracks", above each another, technically this is done by extending the alphabet to a cart... |
This is a good question.
It appears that the term **server** was commonly used already in 1960s. For example, [RFC 5](http://tools.ietf.org/html/rfc5), which was published in **1969**, already uses the term, and it seems that it was in a common use already back then.
However, the term **client** in this context s... |
In your suggestion you write the tapes next to one another. That has another disadvantage, if one of the tapes runs out of space one has to move the information to extend that space.
The solution is to write different tapes on "tracks", above each another, technically this is done by extending the alphabet to a cart... |
I have devised the following TM for the language EQUAL.
EQUAL is a TM that accepts all strings with the same number of a's and b's. It is context free but non regular.
How can I show that EQUAL is recursive?
![enter image description here][1]
[1]: https://i.stack.imgur.com/81uEa.png |
Show the Language is Recursive |
|turing-machines| |
According to a book I am reading, the unary representation of a number exponentially larger than a base k representation of it. I, however, feel that the unary representation should scale linearly with the input.
After all, 1 is 1, 2 is 11, 3 is 111, and so on, right? Wouldn't that be linear? |
Why is the unary representation of a number exponentially larger than a base k representation of it? |
|algorithm-analysis| |
The base $k$ representation of the number $n$ takes $\log_{k}n$ bits, whereas the unary representation takes $n$, and of course $n = k^{\log_{k}n}$
The gap is more apparent with larger numbers, if we take our normal base 10 system, then writing 1000 takes 4 decimal digits, but writing it in unary takes 1000 ones. |
How can you show that **coloring search** can be solved by making a polynomial number of calls to the solution for **coloring optimization** or **coloring decision**? (**Coloring search** is the algorithm to color the vertices of the graph such that adjacent vertices have a different color.)
I wasn't sure how to sol... |
Using coloring optimization or coloring decision to solve coloring search |
|graphs|np| |
How can you show that **coloring search** can be solved by making a polynomial number of calls to the solution for **coloring optimization** or **coloring decision**? (**Coloring search** is the algorithm to color the vertices of the graph such that adjacent vertices have a different color.)
I wasn't sure how to sol... |
How can you show that **coloring search** can be solved by making a polynomial number of calls to the solution for **coloring optimization** or **coloring decision**? (**Coloring search** is the algorithm to color the vertices of a graph such that adjacent vertices have a different color.)
I wasn't sure how to solve... |
null |
I have read of an algorithm that a [non-deterministic Turing machine][1] $N$ can run to determine whether a given graph $G$ has a [Hamiltonian path][2] from the start node $s$ to a certain node $n$:
1. Write a list of $x$ numbers $p_1, p_2, p_3 ... p_x$, where $x$ is the number of nodes in $G$. Each number in this ... |
How does this non-deterministic algorithm to find if a Hamiltonian path exists work? |
|turing-machines|nondeterminism| |
I am basically an Electronics and Communication Engineering student. My relevant coursework include Probability Theory and Stochastic Processes, Engineering Mathematics, Signals and Systems, Digital Signal Processing (this semester).
Now, this area Computer Vision - Image Processing - Object recognition - etc caught... |
Given a graph $G$, we want to do two things:
1. Find the smallest $k$ such that $G$ is $k$-colourable,
2. Given such a $k$, find a colouring of $G$ with $k$ colours.
If we have an oracle for the decision version of the colouring problem, we can do both.
For the first part we can perform a search to find the... |
There's a couple of bits of information that are key to making this make sense:
1. Each $p_{i}$ should be a label for a vertex in $G$. Typically $p_{i} \in [1,x]$, but it's not compulsory that you have to label the vertices from 1 to $x$. So the first step is effectively producing a putative list of vertices that co... |
null |
|algorithms|dynamic-programming|strings|substrings| |
To show that a NP problem is NPC, we also have to show that L<=p.L' , where L is proven NPC and you have to prove L'. The thing I am confused is how in all NPC problems in CLRS they just state the reduction algorithm for L to convert to L' is polynomial. How can one proof it's polynomial time, provided an example such... |
How to determine the polynomial time of a NP problem that you are proving to be NPC |
|np-complete| |
I am not sure what Proof for Lemma 34.6 in CLRS book 3rd edition pg 1074 means. They provided a diagram regarding the configuration. Can anyone explain me the proof in simple words?
Lemma 34.6
The circuit-satisfiability problem is NP-hard.
Proof Let L be any language in NP. We shall describe a polynomial-time alg... |
To show that a NP problem is NP-complete, we also have to show that $L \leq_{p} L'$ , where $L$ is proven NP-complete and you have to prove $L'$ also is. The thing I am confused is how in all NP-complete problems in CLRS they just state the reduction algorithm for $L$ to convert to $L'$ is polynomial. How can one prov... |
The problem here is a misunderstanding of the point of the reduction. NP-complete problems are not known to have polynomial time algorithms. If they do, then P $=$ NP, if they don't then P $\neq$ NP - this is the **BIG** question of theoretical computer science.
The point of the reductions you're looking at is to sh... |
$\newcommand{\np}{\mathsf{NP}}\newcommand{\cc}{\textrm{Circuit-SAT}}$I am having difficulty understanding the $\np$-hardness proof for $\cc$ in [CLRS](http://en.wikipedia.org/wiki/Introduction_to_Algorithms).
>$\cc = \{\langle C \rangle : C \text{ is a satisfiable combinatorial boolean circuit} \}$
>**Lemma:** Th... |
**Question 1:** What is the average access time for a 3-level memory system with access time $T_1$, $2T_1$ and $3T_1$? (Hit ratio $h_1$ = $h_2$ = 0.9)
The solution given is: $0.9[T_1] + 0.1(0.9[2*T_1] + 0.1[3*T_1]) = 1.11[T_1]$ **(Method 1)**
Here, they have considered the page won't be copied to the lower level... |
Doubt regarding cache hit ratios and access time |
|cpu-cache| |
I am interesting in proving that there is no search problem that is polynomial bounded and self-reducible, as long as ${\sf P} \neq {\sf NP} \cap {\sf coNP}$.
The problem is I don't know how to approach the proof, below I wrote few ideas with open questions.
We can start by denoting the search problem in set ${... |
Not self-reducible NP problem |
|complexity-theory|reductions| |
The intervals are represented as two numbers, e.g. $(4.3, 5.6)$. The intervals are unique.
If for $(x,y)$ and $(u,v)$, $x≤u$ and $v≤y$, $(x,y)$ is nested in $(u,v)$
How do I find out which intervals are nested in others efficiently?
The hint is to use two induction hypotheses: one to assume you can solve the ... |
Finding nested intervals efficiently |
|algorithms|induction| |
Hello guys it might sound like a stupid question but i'm really curious to know how computer knows that 1<2=true ? Also how computer knows that the numbers order is 1,2,3,4,5,...etc and Alphabet is A,B,C,D...etc. Is it somewhere stored in like hardware or the Operation System provides this kind of information.
Thanks ... |
How computer knows that a number is smaller or greater than another? |
|computability| |
|computer-architecture| |
It's not operating system that compares integers, CPU is taking care of it.
It's made on logical gates level, please refer to this slides http://www.cs.bris.ac.uk/~page/teaching/material/arch/arith.04.n.pdf to see how its can be done.
About alphabet, in ASCII [ASCII][1] alphanumeric and other siecial characters are... |
I'm trying to understand a proof regarding radix-sort but to no avail.
I'll first write down a brief summary of the proof and then assign some questions which I hope will be clarified enough.
>Suppose you have an array of integer numbers in the range $\{0,1,2,\ldots n \log n\}$.
Show and explain an effective a... |
It might sound like a stupid question but I'm really curious to know how a computer knows that $1<2$? Also, how does a computer know that the order of integer is $1,2,3,4,5,\ldots$ and alphabet is A,B,C,D,.... Is it somewhere stored in the hardware or does the operating system provide this kind of information.
|
|algorithms|optimization| |
I am doing research on control flow analysis on aspect oriented programs and I found in some papers an interprocedural approach for doing control flow analysis on others call graph or control flow graph. Is there a real difference between control flow graphs and interprocedural control flow graphs?
|
You would use binary search. Start with the lower bound being 3 and the upper bound $n$, where $n$ is the number of vertices. Call your clique decision oracle with a $k$ value halfway between the two bounds. If it answers "yes", move your lower bound to $k + 1$. If it answers "no", move your upper bound down to $k ... |
i was wondering how should i proceed in order to show that the composition of (say) two one-way function (either weak or strong or both together) is not a one-way function.
Assuming the definition of one-way function is the one based on : easy evaluation and hard to invert (with negligible probability),
what's the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.