Randomized Quicksort pdf for DAA, Lecture notes of Design and Analysis of Algorithms

this is the Randomized Quicksort pdf for DAA being uploaded purely for answers, quite useless tbh

Typology: Lecture notes

2022/2023

Uploaded on 06/23/2023

rohan-srivastav-21bkt0166
rohan-srivastav-21bkt0166 🇮🇳

3 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
MODULE6 : RANDOMIZED
ALGORITHMS
The hiring problem
Rajesh A
pf3
pf4
pf5

Partial preview of the text

Download Randomized Quicksort pdf for DAA and more Lecture notes Design and Analysis of Algorithms in PDF only on Docsity!

MODULE6 : RANDOMIZED

ALGORITHMS

  • The hiring problem

Rajesh A

The Hiring Problem ▪ You want hire a office assistant (secretary) from an employment agency ▪ You are always committed to employ best candidate irrespective of cost of replacement ▪ There in total n candidates and you are going to eventually interview all of them ▪ You interview the candidate, if better than current candidate, you replace the candidate

The Hiring Problem ▪ Best Case: Best candidate comes first. We end up hiring only once. Hiring cost (Ch) ▪ Worst case: Candidates come in increasing order of quality. we actually hire every candidate we interview. We hire n times, hiring cost O(Ch n) ▪ We don’t have control on the order of quality of candidates ▪ Average Case is more useful; but to perform we need to perform probabilistic analysis ▪ For probabilistic Analysis, we need to know the distribution of inputs; Often distribution of inputs is un-known ▪ Nevertheless, we can use probability and analysis as tool for algorithm design by making the algorithm do some kind of randomization of inputs ▪ In Hiring Problem, we ask agency to give the n number of candidates upfront and we call candidates at random

Hiring Problem - Randomized ▪ Hiring problem is now Randomized problem; algorithm itself makes random choices ▪ Expected Running time vs Average case running time

Hiring Problem – Expected Cost Using Indicator Variable By linearity of expectation Candidate i is hired exactly when the candidate i is better than each of candidates from 1 through i-1 interviews 1/(i) Harmonic Series Hiring cost O(Ch x m) where m = number of candidates hired m = ln n O(Ch x ln n) n = total number of candidates