instruction
stringlengths
0
29.8k
⌀
how to show composition of one way function is not such?
|cryptography|hash|
|graph-theory|terminology|graphs|programming-languages|
If you want to show that $L$ is context-free, you can proceed as follows: Build a push-down automaton $P$ that accepts $L$. $P$ will read the input and put all the read characters on its stack. At some point it guesses (non-deterministically!) that half of the input has been read. Then it reads the remaining input a...
null
Inspired by this [question on Suffix Trees][1], and the fabulous winning answer, I would hereby ask for a similar explanation of Myers' [Fast Bit-Vector Algorithm for Approximate String Matching Based on Dynamic Programming][2]. [1]: http://stackoverflow.com/questions/9452701/ukkonens-suffix-tree-algorithm-in-p...
Myers' Fast bit-vector algorithm in plain English?
|algorithms|strings|
There are two stacks A and B. A : a,b,c,d ('a' is on top and 'd' is at the bottom of the stack) B : (empty) There are two rules. If an element of A is popped, it must be printed immediately or pushed into B. If an element of B is popped, it can only be printed. So, how many permutations...
A puzzle in Permutation
|stacks|permutations|
This problem looks like the problem of single stack sorting. "Single" because onle your stack B is used to sort, the stack A is only for input. Donald Knuth has analysed this, and characterized it as the 231-avoiding permutations, and has shown their number equals the [Catalan numbers][1]. Now if my observation is c...
There are two stacks A and B. A : a,b,c,d ('a' is on top and 'd' is at the bottom of the stack) B : (empty) There are two rules. If an element of A is popped, it must be printed immediately or pushed into B. If an element of B is popped, it can only be printed. So, how many permutations...
This problem looks like the problem of single stack sorting. "Single" because onle your stack B is used to sort, the stack A is only for input. Donald Knuth has analysed this, and characterized it as the 231-avoiding permutations, and has shown their [number][1] equals the Catalan numbers. Now if my observation is c...
null
|combinatorics|recursion|
|algorithms|formal-languages|
How does this algorithm for verifying if a string is $0^n1^n$ work?
|formal-languages|computability|turing-machines|
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...
DIfferences between computer vision and image processing
|education|image-processing|computer-vision|
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...
How to determine the polynomial runtime of an NP reduction?
|complexity-theory|np-complete|reductions|proof-techniques|
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...
|computer-architecture|cpu-cache|
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?
How does the computer that a number is smaller or greater than another?
It's not the operating system that compares integers, the CPU is taking care of it. It's made on logical gates level, please refer to [these slides](http://www.cs.bris.ac.uk/~page/teaching/material/arch/arith.04.n.pdf) to see how it can be done. About the alphabet, in ASCII [ASCII][1] alphanumeric and other special...
It doesn't just "know", it checks every time. Basically, it does the same thing you would do: in order to compare, it checks (from the left) which number has the first digit that is larger than the corresponding one in the other number. Of course you have to add leading zeroes to the shorter number. Letters are just...
I was wondering how should I proceed in order to show that the composition of (say) two one-way functions (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 being easy to evaluate and hard to invert (with negligible probability), what ...
How to show composition of one way function is not such?
|complexity-theory|proof-techniques|cryptography|
|terminology|algorithm-analysis|programming-languages|
Is the complement of $ww^R$ context-free?
|formal-languages|context-free|
It's not the operating system that compares integers, the CPU is taking care of it. It's made on logical gates level, please refer to [these slides][2] to see how it can be done. About the alphabet, in [ASCII][1] alphanumeric and other special characters are represented as integers so comparing them is also an inte...
How does the computer tells that a number is smaller or greater than another?
null
How does the computer determine whether a number is smaller or greater than another?
first your integer numbers are converted into binary numbers.<br/> > `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or equal to the other > number. Comparators are use...
first your integer numbers are converted into binary numbers.<br/> > `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or equal to the other > number. Comparators are use...
first your integer numbers are converted into binary numbers.<br/> > `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or equal to the other > number. Comparators are use...
first your integer numbers are converted into binary numbers.<br/> > `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or equal to the other > number. Comparators are use...
first your integer numbers are converted into binary numbers.<br/> > `digital comparator` or magnitude comparator is a hardware electronic > device that takes two numbers as input in binary form and determines > whether one number is greater than or less than or equal to the other > number. Comparators are use...
null
you can find answer of these in title itself. image processing- title says that it processes image, means does some transformations on image. that means may be it does some smoothing,sharpening, contrasting,stretching.. on the image for making image more enhancive & readable that is input and output of a process ar...
you can find answer of these in title itself. > `image processing`- title says that it processes image, means does > some transformations on image. that means may be it does some > smoothing,sharpening, contrasting,stretching.. on the image for making > image more enhancive & readable that is input and output of...
You should be able to modify the dynamic program for global alignment 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 a...
$3^n = 2^{O(n)}$ is apparently true. I thought that it was false though because $3^n$ grows faster than any exponential function with a base of 2. How is $3^n = 2^{O(n)}$ true?
Why is $3^n = 2^{O(n)}$ true?
|time-complexity|
With some algebra (and changing the constant in the $O(n)$), we can actually change the bases. $$3^n = (2^{\log_2 3})^n = 2^{n\log_2 3}$$ Since $\log_2 3$ is a constant, $n\log_2 3 = O(n)$. So $3^n = 2^{O(n)}$. I'm not sure what you mean by "$3^n$ grows faster than any exponential function with a base of 2." ...
null
$3^n=2^{O(n)}$ is in fact true because if you recall [$O(n)$ definition][1] you will see that you can add/multiply by any constant. So: $3^n < 2^{kn}$ // $ \log_2 $ $n\log_2(3^n) < kn\log_2(2)$ $k > \log_2(3) $ So as you can see $2^{kn}$ is bigger then $3^n \iff k > \log_2(3)$ [1]: http://en.wikiped...
null
Although the first answer has already been accepted, I understand that the power of the multiple heap automata described here have not been resolved. With two heaps, and just a single heap symbol each (apart from the bottom-of-heap), it seems one can simulate a *two-counter automaton*. Such an automaton keeps two n...
null
you can find answer of these in title itself. > `image processing`- title says that it processes image, means does > some transformations on image. that means may be it does some > smoothing,sharpening, contrasting,stretching.. on the image for making > image more enhancive & readable that is input and output of...
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...
|algorithms|graphs|optimization|
null
I am looking for O(V+E) algorithm for finding the transitive reduction ([hell][1]) given a DAG. That is remove as many edges as possible so that if you could reach v from u, for arbitrary v and u, you can still reach after removal of edges. If this is a standard problem, please point me to some model solution. ...
Transitive reduction of DAG
|algorithms|graphs|
I am looking for O(V+E) algorithm for finding the [transitive reduction][1] given a DAG. That is remove as many edges as possible so that if you could reach v from u, for arbitrary v and u, you can still reach after removal of edges. If this is a standard problem, please point me to some model solution. [1]:h...
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$, $(u,v)$ is nested in $(x,y)$ 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 ...
I am trying to reduce NAE SAT to MAX-CUT with weighted edges. I know that if there are weights to the edges, then I can reduce NAE SAT to MAX CUT by have a $G$ with $2n$ nodes ($x_i$ and $\bar{x}_i$) and edges between the nodes based on each clause. And, adding edges between $x_i$ and $\bar{x}_i$, so on. BUt, I am...
NAE SAT reduction to weighted MAX CUT
|reductions|
It is well-known that 1-in-k SAT is NP-complete for k=3. What about for k > 3? Thanks.
Is 1-in-k SAT NP-complete for k > 3
|complexity-theory|
It's still in NP by using a truth assignment as a proof. You can reduce 1-in-3 SAT to 1-in-$k$ SAT to show hardness as follows. Let $\phi$ be an instance of 1-in-3 SAT with clauses $C_i$ for $1 \le i \le m$. For each $C_i$ we define $C_i'$ by adding $k - 3$ instances of the literal $y$ (where $y$ is a new variable t...
1. In the formula $\Theta(d(n+k))$, $d$ is the number of digits (iterations in the sort) and $k$ is the size of the buckets (the base you are working in). So, if you were sorting the numbers 0 through 999 with 10 buckets, there would be $d=3$ iterations (since the numbers have length 3 in base 10) and we would have $k=...
I need a clarification related to the following situation. Consider a Turing machine $T_1$ that halts for every input. In other words $J_1 = L(T_1) \subseteq \Sigma^*$ is recursive. Suppose we are given a function $f:\Sigma^* \mapsto \Sigma^*$ and a language $J_2 \in \Sigma^*$ such that $$ x \in J_2 \iff f(x) \in J_...
Reducing recursive languages
|computability|turing-machines|
I am trying to reduce NOT-ALL-EQUAL SAT to MAX-CUT with weighted edges. I know that if there are weights to the edges, then I can reduce NOT-ALL-EQUAL SAT to MAX CUT by have a $G$ with $2n$ nodes ($x_i$ and $\bar{x}_i$) and edges between the nodes based on each clause. And, adding edges between $x_i$ and $\bar{x}_i...
The answer is already in your question. One must assume that $f$ is effectively computable, i.e., there is a Turing Machine that, given $x$ (on one tape) computes $f(x)$ (on another tape). It should also halt on every input, but that is implicit in 'computes'. We need this in order to avoid that $f$ indeed compute...
null
|terminology|reference-request|distributed-systems|history|
|complexity-theory|reductions|
It is well-known that 1-in-k SAT is NP-complete for k=3. What about for k > 3?
|complexity-theory|reference-request|np-complete|
null
A solution must look like this: we have list of intervals and we must tell for a new interval which of the intervals contain it and which of the list are contained in the new interval. A logical start will be that the list of intervals are sorted in some data structure and we need to add the new interval in its prop...
null
Probably this was not the right place for this question, but anyway, I found the answer in the meantime, in the form of a mostly "digestible" proof at http://wqzhang.wordpress.com/2009/06/09/sicp-exercise-1-14/.
In famous Structure and Interretation of Computer Programs, there is an exercise ([1.14][2]), that asks for the time complexity of the following algorithm - in Scheme - for counting change (the problem statement suggests drawing the tree for `(cc 11 5)` - which looks [like this][3]): ; count change (defin...
Time complexity for count-change procedure in SICP
|algorithms|time-complexity|space-complexity|
Reductions are about translating one problem to another. In our case, we *reduce* the question "$x \in J_2$" to the question "$f(x) \in J_1$". Naturally, for this to make any sense $f$ has to be computable (otherwise we can reduce anything to anything). But it is also important to pay attention to the totality of $f$. ...
I have devised the following TM for the language EQUAL. EQUAL accepts all strings with the same number of a's and b's. It is context free but non regular. Using the TM I devised, how can I show that EQUAL is recursive? ![enter image description here][1] [1]: https://i.stack.imgur.com/81uEa.png
I have devised the following TM for the language EQUAL. EQUAL accepts all strings with the same number of a's and b's. It is context free but non regular. Using the TM I devised, how can I show that EQUAL is recursive? How can I show that it crashes when the input is not in EQUAL. ![enter image description h...