Discussion 3 - Rogaway 1. HW - explain what is asked 2. A lower bound: finding the min and the max: homework: showed how to do in 3n/2-2 comparisons claim: for every n, you can't do it in less than 3n/2-2 comparisons by any comparison-based algorithm!! WLOG, assume keys are distinct. Any algorithm that identify MAX and MIN: - every element other than MAX must have lost some comparison - every element other than MIN must have won some comparions So: when count each win as one unit of information, each loss as one unit of information. So: Any comparion-based algorithm must provide (n-1) + (n-1) = 2n-2 units of information. Idea: Adversary tries to make lots of the comparisions give one unit of information, only a few of the comparison give two units of information. Every element has a status: one of N - the element has neither won nor lost any comparison W - the element has won but never lost L - the element has lost but never won WL - the element has both won and lost compare return new status inf units ---------------------------------------------- N : N > W L 2 W : N > W L 1 WL: N > WL L 1 L : N < L W 1 W : W > W WL 1 L : L > WL L 1 W : L > W L 0 WL: L > WL L 0 W : WL > W WL 0 WL: WL consistent WL WL 0 Assign values as you go. Adjust these values when necessary. You will never get stuck: example: n=6. 7 Comparisons necessary. call elements: a b c d e f g a b c d e f g a:b N N N N N N N 2 1 W L c:d 4 3 W L d:e 5 W f:g W L 7 6 a:c 8 WL b:c d:g 0 WL c:d > Always consistent with some ordering. n even: at most n/2 2-information calls; Ask q questions. 2 (n/2) + (q-n/2) >= 2n-2 n + q-(n/2) >= 2n-2 q >= 3n/2 - 3/2 n odd: at most n-1/2 2-information calls; 2 ((n-1)/2) + (q-((n-1)/2)) >= 2n-2 n - 1 + q - n/2 + 1/2 >= 2n-2 q >= 3n/2 - 3/2 3. Do dynamic programming problem from last year's midterms