Randomized Algorithms


Published on

a full presentation on randomized algorithm

Published in: Technology, Sports
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Randomized Algorithms

  1. 1. Randomized Algorithm By Shoaib Khan IMCA/4511/12 3rd Semester
  2. 2. • It is defined as an algorithm that is allowed to access a source of independent, unbaised random bits. • The "worst case" is typically so unlikely to occur that it cannot be ignored .
  3. 3. Why randomized algorithms ? • Simplicity: This is the first reason for using randomized algorithms. There are numerous example where an easy randomized algorithm can match the performance of a deterministic algorithm. • Speed: The best known randomized algorithm are faster than the best known deterministic algorithm.
  4. 4. Las Vegas Algorithm • A Las Vegas algorithm is a randomized algorithm that always gives correct results, that is, it always produces the correct result or it informs about the failure. In other words, a Las Vegas algorithm does not gamble with the correctness of the result, it gambles only with the resources used for the computation. A simple example is randomized quicksort. • Randomized quick sort :randomized quicksort algorithm makes random choices during execution.
  5. 5. Randomized quick sort algo :Function RANDOMIZED-QUICKSORT(A, p, q) 1. if (p >=q) then 2. return 3. else 4. Choose a number, say r, uniformly and at random from the set {p,p+1,...,q}. 5. Swap A[p] and A[r]. 6. j = PARTITION(A, p, q). 7. Quicksort(A, p, j-1). 8. Quicksort(A, j+1, q). 9. end The complexity of randomized quick sort algorithm is O(n2).
  6. 6. Monte carlo algorithm • A randomized algorithm may produce incorrect results, but with bounded error probability. • For decision problems there are two kind of monte carlo algorithms: Two side error : If there is non zero probability error.when its output is either yes or no. One side error : When the probability that its error is zero for atleast one of possible output.
  7. 7. Min cut algorithm Let G = (V,E) be a connected , undirected multigraph with n vertices.A multigragh may contain multiple edges between any pair ofvertices.A cut in G is a set of edges whose removal results in G being broken into two or more components. A min-cut is a cut of minimum cardinality. For instance, say this graph represents a network, and we want to know how ”robust” it is in the sense of the the minimum number of links whose failure causes the network to become disconnected.The minimum cut problem is to find a cut of minimum size. Algorithm Min-Cut Input: Connected, undirected multigragh G(V,E). Output: Size of the min-cut. 1. while |V| >= 2 do 2. Pick an edge e randomly and contract it. 3. Remove Self Loops. 4. end while 5. Return
  8. 8. Thank you