Probabilistic algorithms Flashcards

1
Q

Probabilistic quick sort algorithm (idea)

A

Pick a random index as the pivot point of the algorithm. Recursively do this until the sorting is done.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Probabilistic quick sort algorithm (run time)

A

We got a runtime that in the bad case in avarage is O(nlogn) where the bad cases are negligible. Inn the regular sort the bad case of O(n^2) is not negligible.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Random min cut (idea)

A

Choose a random edge, and combine the two vertices into one. Do this until you are left with only two nodes. (The graph will include multiple edges going from one node to the other, that will be the min cut)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Random min cut (accuracy)

A

In one run the algorithm has a (2/(n^2)) chance of getting it right. if you run it ((n^2)/2) times, it has a a chance of being wrong that is smaller than 1/e .

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Las Vegas algorithm

A

A probabilistic algorithm, that is never wrong and the run time is calculated by the expectation (תוחלת)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Monte Carli algorithm

A

A probabilistic algorithm that might be wrong. You can mitigate this by running multiple times. The run time isn’t random.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Matrix multiplication determinition (idea and run time)

A

Choose a random 1d vector x and multiply both sides ABx=Cx. If ABx≠Cx the for sure AB≠C. But if ABx=Cx then there is a 50% chance that AB=C. Run this multiple times each time choosing a new random vector. Runtime is O(n^2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

AKS algorithm

A

Ann algorithm for accurately determining if a number is prime in O(n^6)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Fermat’s Little Theorem

A

If p is a prime number, for any integer a: a^p = a%p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

The Miller Rabin primality test

A

Given a number p, pick a random integer a, and test if a^p = a%p. If not then p is for sure not prime else it might be. do this k times to control the mistake probability. There is a 4^(-k) probability for false positive. O(n^3) time (n number of digits)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly