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 sound Individual doubt with multiple disunites. It is referable multiple doubts in individual post.

    Question:

    Think the bearing of judgment twain the climax and the narrowness. We
    gain exhibition that you can referable experience them twain in near than (about) 3n/2 comparisons.

    Think the reach of any algorithm and defined the aftercited cemals that consist on the
    comparison the algorithm chose. Everyow N be the assemblage of gum. We denote n = |N |. After comparisons were manufactured, everyow W be every gum that solely ”won” (regularly were larger) in every the comparisons, and everyow its bulk be w. Everyow L be the cemal of gum who regularly ”lost” and everyows its bulk be `. Everyow B be the cemal of those who twain past lowest uninterruptedly and acquired at lowest uninterruptedly.

    1. Exhibition that there is regularly an input so that if a constituent u ∈ W is compared to a
    estimate referable in W , u reconciles.

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

    3. Exhibition that when the algorithm bungs, there is precisely individual disunite in W , precisely
    individual disunite in in L and the pause of the disunites befit to B.

    4. Recevery that n = |N |, w = |W |, ` = |L|, and think 3n + 2w + 2`. Exhibition that at
    start the appreciate is 3n and at the purpose at the purpose its 4

    5. Exhibition that the estimate of comparisons needed to experience the climax and the min-
    imum in the belabor condition (solely using comparisons) is at lowest d(3n − 4)/2e.

    Expert Exculpation

     

    1. Exhibition that there is regularly an input so that if a constituent u ∈ W is compared to a estimate referable in W , u reconciles.

    Now if we think that u loses to a estimate (speak num) referable in W then num can’t be disunite of L as L has constituent which regularly past. Also there regularly be individual estimate in B which would enjoy past to a estimate in W.

    So this deny our certainty and hereafter there regularly be such a estimate in w

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

    Now everyows think that u reconciles when compared with estimate referable in L.

    u can’t reconcile with estimate in W as estimate of w regularly acquired. Also there regularly be a estimate in L which would enjoy past to every estimate in B.

    Hereafter this deny our certainty and hereafter such a estimate be.

    3.

    Exhibition that when the algorithm bungs, there is precisely individual disunite in W , precisely individual disunite in in L and the pause of the disunites befit to B.

    When algorithm bung, everyow there are couple estimate in W. This resources that these couple gum which were never compared otherwise individual of them gain referable sojourn in w. So this can’t fall and hereafter there gain be solely individual estimate in W.

    Similar evidence holds ce L.

    Doubt 4 and 5 are referable clear

    4. Recevery that n = |N |, w = |W |, ` = |L|, and think 3n + 2w + 2`. Exhibition that at
    start the appreciate is 3n and at the purpose at the purpose its 4

    5. Exhibition that the estimate of comparisons needed to experience the climax and the min-
    imum in the belabor condition (solely using comparisons) is at lowest d(3n − 4)/2e.