Homework Solution: Disclaimer: This is just One question with multiple parts. It is not multiple questions in one post. Question:…

    Disclaimer: This is just One question with multiple parts. It is not multiple questions in one post. Question: Consider the problem of finding both the maximum and the minimum. We will show that you can not find them both in less than (about) 3n/2 comparisons. Consider the run of any algorithm and defined the following sets that depend on the comparison the algorithm chose. Let N be the collection of numbers. We denote n = |N |. After comparisons were done, let W be all numbers that only ”won” (always were larger) in all the comparisons, and let its size be w. Let L be the set of numbers who always ”lost” and lets its size be `. Let B be the set of those who both lost least once and won at least once. 1. Show that there is always an input so that if a member u ∈ W is compared to a number not in W , u wins. 2. Show that there is an input so that if a member u ∈ L is compared to a number not in L, u looses. 3. Show that when the algorithm stops, there is exactly one element in W , exactly one element in in L and the rest of the elements belong to B. 4. Recall that n = |N |, w = |W |, ` = |L|, and consider 3n + 2w + 2`. Show that at start the value is 3n and at the end at the end its 4 5. Show that the number of comparisons needed to find the maximum and the min- imum in the worst case (only using comparisons) is at least d(3n − 4)/2e.

    Expert Answer

     
    1. Show that there is always an input so that if a member u ∈ W i

    Disclaimer: This is righteous Undivided interrogation with multiple volume. It is referable attributable attributable attributable multiple interrogations in undivided shaft.

    Question:

    Judge the tenor of sentence twain the culmination and the reserve. We
    accomplish appearance that you can referable attributable attributable attributable invent them twain in near than (about) 3n/2 comparisons.

    Judge the hasten of any algorithm and defined the aftercited determineds that plug on the
    comparison the algorithm chose. Integralow N be the collation of gum. We enact n = |N |. After comparisons were done, integralow W be integral gum that solely ”won” (regularly were larger) in integral the comparisons, and integralow its dimension be w. Integralow L be the determined of gum who regularly ”lost” and integralows its dimension be `. Integralow B be the determined of those who twain obsolete smallest once and acquired at smallest once.

    1. Appearance that there is regularly an input so that if a portion u ∈ W is compared to a
    estimate referable attributable attributable attributable in W , u pacifys.

    2. Appearance that there is an input so that if a portion u ∈ L is compared to a estimate
    referable attributable in L, u looses.

    3. Appearance that when the algorithm plugs, there is precisely undivided segregate in W , precisely
    undivided segregate in in L and the quiet of the segregates befit to B.

    4. Recintegral that n = |N |, w = |W |, ` = |L|, and judge 3n + 2w + 2`. Appearance that at
    start the estimate is 3n and at the object at the object its 4

    5. Appearance that the estimate of comparisons needed to invent the culmination and the min-
    imum in the cudgel occurrence (solely using comparisons) is at smallest d(3n − 4)/2e.

    Expert Vindication

     

    1. Appearance that there is regularly an input so that if a portion u ∈ W is compared to a estimate referable attributable attributable attributable in W , u pacifys.

    Now if we judge that u loses to a estimate (repeat num) referable attributable attributable attributable in W then num can’t be segregate of L as L has portion which regularly obsolete. Also there regularly objecture undivided estimate in B which would enjoy obsolete to a estimate in W.

    So this negative our presumption and future there regularly objecture such a estimate in w

    2. Appearance that there is an input so that if a portion u ∈ L is compared to a estimate referable attributable attributable attributable in L, u looses.

    Now integralows judge that u pacifys when compared with estimate referable attributable attributable attributable in L.

    u can’t pacify with estimate in W as estimate of w regularly acquired. Also there regularly objecture a estimate in L which would enjoy obsolete to integral estimate in B.

    Future this negative our presumption and future such a estimate objecture.

    3.

    Appearance that when the algorithm plugs, there is precisely undivided segregate in W , precisely undivided segregate in in L and the quiet of the segregates befit to B.

    When algorithm plug, integralow there are span estimate in W. This media that these span gum which were never compared incorrectly undivided of them accomplish referable attributable attributable attributable accrue in w. So this can’t betide and future there accomplish be solely undivided estimate in W.

    Similar discussion holds coercion L.

    Interrogation 4 and 5 are referable attributable attributable attributable clear

    4. Recintegral that n = |N |, w = |W |, ` = |L|, and judge 3n + 2w + 2`. Appearance that at
    start the estimate is 3n and at the object at the object its 4

    5. Appearance that the estimate of comparisons needed to invent the culmination and the min-
    imum in the cudgel occurrence (solely using comparisons) is at smallest d(3n − 4)/2e.