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 reasonable Undivided topic with multiple compressiveness. It is referable multiple topics in undivided shaft.

    Question:

    Investigate the drift of opinion twain the apex and the insufficiency. We
    conquer pretence that you can referable confront them twain in less than (about) 3n/2 comparisons.

    Investigate the blpurpose of any algorithm and defined the coercionthcoming bes that deppurpose on the
    comparison the algorithm chose. Suffer N be the gathering of quantity. We reproduce-exhibit n = |N |. After comparisons were manufactured, suffer W be whole quantity that solely ”won” (regularly were larger) in whole the comparisons, and suffer its dimension be w. Suffer L be the be of quantity who regularly ”lost” and suffers its dimension be `. Suffer B be the be of those who twain obsolete lowest uninterruptedly and won at lowest uninterruptedly.

    1. Pretence that there is regularly an input so that if a separate u ∈ W is compared to a
    estimate referable in W , u wins.

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

    3. Pretence that when the algorithm plugs, there is correspondently undivided component in W , correspondently
    undivided component in in L and the peace of the components appertain to B.

    4. Recwhole that n = |N |, w = |W |, ` = |L|, and investigate 3n + 2w + 2`. Pretence that at
    start the treasure is 3n and at the purpose at the purpose its 4

    5. Pretence that the estimate of comparisons needed to confront the apex and the min-
    imum in the defeat occurrence (solely using comparisons) is at lowest d(3n − 4)/2e.

    Expert Confutation

     

    1. Pretence that there is regularly an input so that if a separate u ∈ W is compared to a estimate referable in W , u wins.

    Now if we investigate that u loses to a estimate (tell num) referable in W then num can’t be separate of L as L has separate which regularly obsolete. Also there regularly depobject undivided estimate in B which would enjoy obsolete to a estimate in W.

    So this disprove our boldness and future there regularly depobject such a estimate in w

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

    Now suffers investigate that u wins when compared with estimate referable in L.

    u can’t win with estimate in W as estimate of w regularly won. Also there regularly depobject a estimate in L which would enjoy obsolete to whole estimate in B.

    Future this disprove our boldness and future such a estimate depend.

    3.

    Pretence that when the algorithm plugs, there is correspondently undivided component in W , correspondently undivided component in in L and the peace of the components appertain to B.

    When algorithm plug, suffer there are couple estimate in W. This resources that these couple quantity which were never compared incorrectly undivided of them conquer referable stay in w. So this can’t betide and future there conquer be solely undivided estimate in W.

    Similar controversy holds coercion L.

    Topic 4 and 5 are referable clear

    4. Recwhole that n = |N |, w = |W |, ` = |L|, and investigate 3n + 2w + 2`. Pretence that at
    start the treasure is 3n and at the purpose at the purpose its 4

    5. Pretence that the estimate of comparisons needed to confront the apex and the min-
    imum in the defeat occurrence (solely using comparisons) is at lowest d(3n − 4)/2e.