Tutorial 2Data Structures ’10Jonathan Cederberg thWednesday, September 15 , 2010First assignment Probability Sorting Invariants Second assignment SlackOutline1 First assignment2 Probability3 Sorting4 Invariants5 Second assignment6 Slack2 DS’10 | Tutorial 2 (Data Structures ’10)First assignment Probability Sorting Invariants Second assignment SlackThings to rememberThe definitions of ;O:A sum grows according to its fastest growing term (the leftone)Polynomials grow faster than polylogsExponentials grow faster than polynomialsLarger exponent =) faster growthLarger base =) faster growth4 DS’10 | Tutorial 2 (Data Structures ’10)First assignment Probability Sorting Invariants Second assignment SlackReview of assignment 1 nn 3lgn 2n 4 n! lgn 2 (n +1)!23 n nn nlgn 2 n25 DS’10 | Tutorial 2 (Data Structures ’10)First assignment Probability Sorting Invariants Second assignment SlackCommentsI have still not received any questions on e-mail. Use thispossibility to influence these sessions.Deadlines are hard. Late submissions of the assignments willnot be considered. You just have to get the 24 points.When presenting proofs, use some words like “since” and“therefore”. The three dots are forbidden.Answers without explicit justifications give 0 pts in an exam.Numerical justification is no justification.6 DS’10 | Tutorial 2 (Data Structures ’10)First assignment Probability Sorting Invariants Second assignment ...
The definitions ofΩ,O.Θ A sum grows according to its fastest growing term (the left one) Polynomials grow faster than polylogs Exponentials grow faster than polynomials Larger exponent=⇒faster growth Larger base=⇒faster growth
I have still not received any questions on e-mail. Use this possibility to influence these sessions. Deadlines are hard. Late submissions of the assignments will not be considered. You just have to get the 24 points. When presenting proofs, use some words like “since” and “therefore”. The three dots are forbidden. Answers without explicit justifications give 0 pts in an exam. Numerical justification is no justification.
Note thatE[∙]is a linear operator, i.e. X(ai∙Xi) E"i=n1#=i=nX1(ai∙E[Xi])
Review of probability theory Asample space Sis the set of all possible outcomes. Anevent Ais a subsetA⊆S A random variable is often denotedX Theexpected value E[X]of a random variableXis defined as E[X] =Xx∙Pr{X=x} x
traStuFuicrss’traes)si1g0nkcalSntmegnsiasndcoSe
Unbiased-Random 1 while true 2do 3x←Biased-Random 4y←Biased-Random 5ifx6=y 6thenreturnx
Exercise: Bleaching You have a function, Biased-Random, that returns 1 with probabilitypand 0 with probability 1−p you do not. Sadly knowp a function Unbiased-Random that returns 1. Design with probability 1/2 and 0 with probability 1/2.
Exercise (cont.): Bleaching Why does this work? Because Unbiased-Random only returns whenx=0 andy=1 Pr{Unbiased-Randomreturns0}= Pr{x=0∧y=1}= (1−p)p= p(1−p) = Pr{x=1∧y=0}= Pr{Unbiased-Randomreturns1} and there are no other outcomes, Unbiased-Random is fair. Note that this relies on that the calls to Biased-Random are independent.