# Tag Info

47

For any reasonable definition of perfect, the mechanism you describe is not a perfect random number generator. Non-repeating isn't enough. The decimal number $0.101001000100001\dots$ is non-repeating but it's a terrible generator of random digits, since the answer is "always" zero, occasionally one, and never anything else. We don't actually know if every ...

29

It is cryptographically useless because an adversary can predict every single digit. It is also very time consuming.

19

If the input array is distributed uniformly at random then (as you noted) there is no difference between always picking an element at a fixed position (for example the middle one as you suggest) or picking an element chosen at random. If however your input array is not really in random order (which happens to be the case in almost all practical scenarios) ...

18

The most obvious disadvantage is the unnecessary complexity of PRNG algorithms based on irrational numbers. They require much more computations per generated digit than, say, an LCG; and this complexity typically grows as you go further in the sequence. Calculating 256 bits of π at the two-quadrillionth bit took 23 days on 1000 computers (back in 2010) - a ...

17

if there are any practical applications of this algorithm in the domain of computer science besides being a theoretical improvement The application of this algorithm is trivial - you use it whenever you want to compute a median of a set of data (array in other words). This data may come from different domains: astronomical observations, social science, ...

17

You seem to have misunderstood what the key is. In the context of symmetric encryption, the key is a shared secret: something that is known to both the sender and receiver. For OTP, the key is the entire pad and, if two people wish to encrypt some message using OTP, they must ensure beforehand that they have a long enough pad to do that. For your proposed ...

15

The question really depends on what is the precise definition of a 2-hop. If by a 2-hop you mean the set $$hp(v) = \{ u \mid \mbox{there is a path of length 2 between u and v}\},$$ then the current answer is no, you cannot do it faster than $O(n^{\omega})$ where $\omega$ is the usual constant associated with the complexity of performing the matrix product. ...

13

Median filtering is common in reduction of certain types of noise in image processing. Especially salt and pepper noise. It works by picking out the median value in each color channel in each local neighbourhood of the image and replacing it with it. How large these neighbourhoods are can vary. Popular filter sizes (neighbourhoods) are for example 3x3 and ...

12

Vor's answer gives the standard definition. Let me try to explain the difference a bit more intuitively. Let $M$ be a bounded error probabilistic polynomial-time algorithm for a language $L$ that answers correctly with probability at least $p\geq\frac{1}{2}+\delta$. Let $x$ be the input and $n$ the size of the input. What distinguishes an arbitrary $\... 12 An example of such an algorithm is randomized Quick Sort, where you randomly permute the list or randomly pick the pivot value, then use Quick Sort as normal. Quick Sort has a worst case running time of$O(n^{2})$, but on a random list has an expected running time of$O(n\log n)$, so it always terminates after$O(n^{2})$steps, but we can expect the ... 12 Your argument appears to be perfectly valid (Fisher-Yates does indeed require$\log (n!)$bits of randomness), the discrepancy comes in by making different assumptions about the complexity of the random number generation. You're assuming generating a random number between$0$and$n$takes$O(\log n)$. But, when saying that the Fisher-Yates shuffle is$O(n)...

12

The formal, unambiguous way to state this is “terminates with probability 1” or “terminates almost surely”. In probability theory, “almost” means “with probability 1”. For a probabilistic Turing machine, termination is defined as “terminates always” (i.e. whatever the random sequence is), not as “terminates with probability 1”. This definition makes ...

11

The algorithm works, but to understand why, you need to know basic probability theory. The idea is to prove by induction that at step $t$, the currently selected algorithm is uniform among the first $t$ elements. This is clearly the case when $t=1$. Assume now the induction hypothesis for time $t$, and consider what happens at time $t+1$. With probability $1/... 11 Now to make a more efficient One-Time-Pad you'd use a pseudo-random number generator No, no and once again no. I'm concerned that this is what you're being taught. The absolutely fundamental concept of a one time pad and the notion of mathematically provable perfect secrecy is that the pad material is truly random. And it must never ever be reused, even ... 11 No, it's not possible. Suppose the bias of the coin is$1/3$, and suppose you could guarantee termination. Then there would be some$n$such that this always terminates after$n$coin flips. Let$S$denote the set of flip-sequences that causes your algorithm to output 0 (so that$\overline{S}$is the set of flip-sequences that causes your algorithm to ... 11 Your process is a textbook example of a branching process. Starting with one$E$, we have an expected$3/2$many$F$s,$9/4$many$T$s, and so$9/8$many remaining$E$s in expectation. Since$9/8 > 1$, it is not surprising that your process often failed to terminate. To gain more information, we need to know the exact distribution of the number of$E$-... 10 That looks correct to me. The difference between BPP and PP is that for BPP the probability has to be greater than$1/2$by a constant, whereas for PP it could be$1/2+ 1/2^n$. So for BPP problems you can do probability amplification with a small number of repetitions, whereas for general PP problems you can't. 10 Computing medians is particularly important in randomized algorithms. Quite often, we have an approximation algorithm that, with probability at least$\tfrac34$, gives an answer within a factor of$1\pm\epsilon$of the true answer$A$. Of course, in reality, we want to get an almost-correct answer with much higher probability than$\tfrac34$. So we ... 9 Your coin flips form a one-dimensional random walk$X_0,X_1,\ldots$starting at$X_0 = 0$, with$X_{i+1} = X_i \pm 1$, each of the options with probability$1/2$. Now$H_i = |X_i|$and so$H_i^2 = X_i^2$. It is easy to calculate$E[X_i^2] = i$(this is just the variance), and so$E[H_i] \leq \sqrt{E[H_i^2]} = \sqrt{i}$from convexity. We also know that$X_i$... 9 There is a simple$O(n)$algorithm using the technique of reservoir sampling. Keep a currently selected element$x$(initially, none). Go over all bits in the file in order. When seeing the$m$th zero, put it in$x$with probability$1/m$. You can show (exercise) that the final contents of$x$is a uniformly random zero from the file. If you are allowed ... 9 Complexity theory is a mathematical theory which aims at addressing one shortcoming of computability theory, namely, it takes into account the use of resources. While it is true that in its early days it aimed to capture the notion of "practical computation" (even particular flavors such as parallel computation, supposedly captured by NC), it has since ... 9 Suppose that the array has length$n$. Since you are making$n$random choices of numbers from 1 to$n$, the probability to obtain any specific permutation is of the form$A/n^n$, for some integer$A$. Therefore your algorithm could work only if$n^n/n!$is an integer, which is only the case when$n \leq 2$. More concretely, if you shuffle the array$1,2,3$,... 9 There is some research in this area. In The Effect of Restarts on the Efficiency of Clause Learning Jinbo Huang shows empirically that restarts improve a solver's performance over suites of both satisfiable and unsatisfiable SAT instances. The theoretical justification for the speedup is that in CDCL solvers a restart allows the search to benefit from ... 8 Basic idea: Pick a random assignment and check it. Then, repeat it many times. Even if one of the assignments satisfies the formula you answer "YES" (otherwise, you answer "NO") We know that the input formula is "simple": in plain words it means that either it is not-satisfiable or it has "many" satisfying assignments. If it is not satisfiable - no matter ... 8 The probabilistic method is typically used to show that the probability of some random object having a certain property is non-zero, but doesn't exhibit any examples. It does guarantee that a "repeat-until-success" algorithm will eventually terminate, but does not give an upper bound on the runtime. So unless the probability of a property holding is ... 8 The two terms randomized algorithms and probabilistic algorithms are used in two different contexts. Randomized algorithms are algorithms that use randomness, in contradistinction with deterministic algorithms that do not. Probabilistic algorithms, for example probabilistic algorithms for primality testing, are algorithms that use randomness and could make ... 8 Following up on a comment by sdcvvc I checked out example 11.7 in Computational Complexity: A Modern Approach by Arora and Barak (Draft of 2008). There, the authors describe a "PCP algorithm" for the problem Graph Non-Isomorphism (GNI): Input: Two graphs$G_0$and$G_1$with$n$vertices each. Output: Accept if and only if$G_0$and$G_1$are not ... 8 You made a crucial change to the question. I've updated my answer to respond to the new question; I'll keep my original answer below for posterity as well. To answer the latest iteration of the question: If the problem you really want to solve is a decision problem, and you've shown that it is NP-complete, then you might be in a tough spot. Here are some ... 8 Yes, the constant is entirely arbitrary. Call an algorithm a$p$-algorithm if: When the correct answer is NO, it always answers NO. When the correct answer is YES, it answers YES with probability at least$p$. Note that the probability in the YES case is only over the algorithm's coin tosses. Given a$p$-algorithm and a constant parameter$m\$, we ...

8

There are implementations of Quicksort (the partitioning algorithm, specifically) which deal badly with duplicates. No matter how much you randomize -- shuffling the input, random choice of the pivot, random choice of the pivot with sampling, ... -- if all entries are the same (or there are only constantly many distinct values), these bad implementations ...

Only top voted, non community-wiki answers of a minimum length are eligible