Probabilistic algorithms

Slides:



Advertisements
Similar presentations
Comp 122, Spring 2004 Order Statistics. order - 2 Lin / Devi Comp 122 Order Statistic i th order statistic: i th smallest element of a set of n elements.
Advertisements

College of Information Technology & Design
Order Statistics Sorted
Algorithms Analysis Lecture 6 Quicksort. Quick Sort Divide and Conquer.
Analysis of Algorithms CS 477/677 Instructor: Monica Nicolescu Lecture 6.
Theory of Computing Lecture 3 MAS 714 Hartmut Klauck.
WS Algorithmentheorie 03 – Randomized Algorithms (Primality Testing) Prof. Dr. Th. Ottmann.
1 Today’s Material Medians & Order Statistics – Ch. 9.
Randomized Algorithms Fundamentals of Algorithmics.
Probabilistic (Average-Case) Analysis and Randomized Algorithms Two different approaches –Probabilistic analysis of a deterministic algorithm –Randomized.
Median/Order Statistics Algorithms
Probabilistic (Average-Case) Analysis and Randomized Algorithms Two different but similar analyses –Probabilistic analysis of a deterministic algorithm.
© 2004 Goodrich, Tamassia Selection1. © 2004 Goodrich, Tamassia Selection2 The Selection Problem Given an integer k and n elements x 1, x 2, …, x n, taken.
Randomized Algorithms Prof. Dr. Th. Ottmann University of Freiburg
S: Application of quicksort on an array of ints: partitioning.
1 Randomness in Computation Example 1: Breaking symmetry. Example 2: Finding witnesses. Example 3: Monte Carlo integration. Example 4: Approximation algorithms.
Computer Science CS 330: Algorithms Quick Sort Gene Itkis.
Selection1. 2 The Selection Problem Given an integer k and n elements x 1, x 2, …, x n, taken from a total order, find the k-th smallest element in this.
Randomized Algorithms (Probabilistic algorithm) Flip a coin, when you do not know how to make a decision!
Stochastic Algorithms Some of the fastest known algorithms for certain tasks rely on chance Stochastic/Randomized Algorithms Two common variations – Monte.
Randomized Turing Machines
RSA Parameter Generation Bob needs to: - find 2 large primes p,q - find e s.t. gcd(e, Á (pq))=1 Good news: - primes are fairly common: there are about.
Prabhas Chongstitvatana 1 Primality Testing Is a given odd integer prime or composite ? No known algorithm can solve this problem with certainty in a reasonable.
Chapter 14 Randomized algorithms Introduction Las Vegas and Monte Carlo algorithms Randomized Quicksort Randomized selection Testing String Equality Pattern.
Order Statistics The ith order statistic in a set of n elements is the ith smallest element The minimum is thus the 1st order statistic The maximum is.
Computer Science 101 Fast Searching and Sorting. Improving Efficiency We got a better best case by tweaking the selection sort and the bubble sort We.
CPSC 335 Randomized Algorithms Dr. Marina Gavrilova Computer Science University of Calgary Canada.
Amplification of stochastic advantage
Computation Model and Complexity Class. 2 An algorithmic process that uses the result of a random draw to make an approximated decision has the ability.
Chapter 9: Selection Order Statistics What are an order statistic? min, max median, i th smallest, etc. Selection means finding a particular order statistic.
Prabhas Chongstitvatana1 Las Vegas algorithm The answer obtained is always correct but sometime no answer. Modified deterministic algorithm by using randomness.
Computer Science 101 A Survey of Computer Science QuickSort.
 initially Treat data as N sorted collections that are each one datum long.  merge Merge each consecutive pair of collections to form sorted collections.
Computer Science 101 Fast Algorithms. What Is Really Fast? n O(log 2 n) O(n) O(n 2 )O(2 n )
RSA cryptosystem--preview Suppose n=p  q and  (n)=(p-1)(q-1), where p and q are big primes. Select (find) a and b, such that a  b=1 mod  (n). K=(n,p,q,a,b),
Prabhas Chongstitvatana1 Monte Carlo integration It is a numerical probabilistic algorithm ab I/(b-a) f.
Recurrence Relations Analyzing the performance of recursive algorithms.
Instructor Neelima Gupta Expected Running Times and Randomized Algorithms Instructor Neelima Gupta
ICS 353: Design and Analysis of Algorithms
NP-Completness Turing Machine. Hard problems There are many many important problems for which no polynomial algorithms is known. We show that a polynomial-time.
Prabhas Chongstitvatana1 Numerical probabilistic The answer is always an approximation.
 initially Treat data as N sorted collections that are each one datum long.  merge Merge each consecutive pair of collections to form sorted collections.
Quick-Sort 2/18/2018 3:56 AM Selection Selection.
Confidence Intervals for Proportions
Statistics 200 Lecture #9 Tuesday, September 20, 2016
May 26th –non-comparison sorting
Significance Test for the Difference of Two Proportions
Handbook of Applied Cryptography - CH4, from 4.1~4.3
Randomized Algorithm (Lecture 2: Randomized Min_Cut)
Confidence Intervals for Proportions
Randomized Algorithms
Randomized Algorithms
Lecture 8 Randomized Algorithms
QuickSort QuickSort Best, Worst Average Cases K-th Ordered Statistic
Selection Selection 1 Quick-Sort Quick-Sort 10/30/16 13:52
Prabhas Chongstitvatana
Numerical probabilistic
Randomized Algorithms
Lecture 6 Efficiency of Algorithms (2) (S&G, ch.3)
The Practice of Statistics in the Life Sciences Fourth Edition
Amplification of stochastic advantage
Accuracy vs. Precision & Significant Figures
Randomized Algorithms
Confidence Intervals for Proportions
Monte Carlo integration
Probabilistic algorithms
Quick-Sort 5/7/2019 6:43 PM Selection Selection.
The Selection Problem.
Quick-Sort 5/25/2019 6:16 PM Selection Selection.
Confidence Intervals for Proportions
Presentation transcript:

Probabilistic algorithms Sometimes it is preferable to choose a course at random, rather than spend time working out which alternative is best. Main characteristic The same algorithm may behave differently when it is applied twice to the same instance. Prabhas Chongstitvatana

Probabilistic != Uncertain Paradox : The error probability can often be brought down below that of a hardware error during the significantly larger time needed to compute the answer deterministically. Prabhas Chongstitvatana

Prabhas Chongstitvatana There are problems for which no algorithm is know, be deterministic or probabilistic, that can give the answer with certainty within a reasonable amount of time, yet probabilistic algorithm can solve the problem quickly if an arbitrarily small error probability is tolerated. Example : determine whether a 1000 digit number is prime or composite. Prabhas Chongstitvatana

Prabhas Chongstitvatana Type of probabilistic algorithms Numerical Confidence interval More time = more precise Monte Carlo Exact but sometimes wrong More time = less error probability Las Vegas Always correct but sometimes no answer If soln can be verified efficiently Answer with confidence interval : “with probability 90% the answer is 59 plus or minus 3” Prabhas Chongstitvatana

Expected vs average time deterministic Average time The average time taken by an algorithm when each possible instance of a given size is equally likely. probabilistic Expected time The mean time that it would take to solve the same instance over and over. Prabhas Chongstitvatana

Prabhas Chongstitvatana Worst-case expected time Expected time taken by the worst possible instance of a given size. Example Las Vegas can be more efficient than deterministic one but only with respect to expected time. (if bad luck, LA takes long time) Quicksort deterministic worst-case Quicksort probabilistic Prabhas Chongstitvatana

Prabhas Chongstitvatana QuicksortLV( T[i..j] ) If j-i is sufficiently small then insertsort( T[i..j] ) else p = T[uniform(i..j) ] pivotbis(T[i..j],p,k,l) quicksortLV(T[i..k]) quicksortLV(T[l..j]) Pivotbis(T[i..j], p, k, l) partitions T into three sections, p as pivot. After pivoting the elements in T[i..k] < p, T[k+1.. l-1] = p and T[l..j] > p. Return k,l. Prabhas Chongstitvatana