Why is this a proof by contradiction for this algorithm? Isn't this a direct proof instead? The 2019 Stack Overflow Developer Survey Results Are In Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Loop invariants?Heap-like data structure allowing peek at largest & smallestIs this algorithm actually a graph-traversal algorithm?Sorting an “almost sorted” array in sub linear timeTrying to understand this Quicksort Correctness proofCorrectness proof: 2-approximation of greedy matching-algorithmProof of correctness of algorithm to determine whether the elements of an array are repeated an equal number of timesIs this lower bound proof for the comparison-based sorting problem correct?Proof of Lower Bound for Deterministic Distinct Elements AlgorithmArray contains elements that differ by K correctness proof

Is every episode of "Where are my Pants?" identical?

How many people can fit inside Mordenkainen's Magnificent Mansion?

When did F become S in typeography, and why?

What do you call a plan that's an alternative plan in case your initial plan fails?

Segmentation fault output is suppressed when piping stdin into a function. Why?

Is this wall load bearing? Blueprints and photos attached

First use of “packing” as in carrying a gun

Is there a writing software that you can sort scenes like slides in PowerPoint?

How to split my screen on my Macbook Air?

Do warforged have souls?

How to delete random line from file using Unix command?

How to stretch delimiters to envolve matrices inside of a kbordermatrix?

Python - Fishing Simulator

What is this lever in Argentinian toilets?

Are my PIs rude or am I just being too sensitive?

How to politely respond to generic emails requesting a PhD/job in my lab? Without wasting too much time

Derivation tree not rendering

Relations between two reciprocal partial derivatives?

Why does the Event Horizon Telescope (EHT) not include telescopes from Africa, Asia or Australia?

Simulation of a banking system with an Account class in C++

Cooking pasta in a water boiler

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

How can I protect witches in combat who wear limited clothing?

Why did all the guest students take carriages to the Yule Ball?



Why is this a proof by contradiction for this algorithm? Isn't this a direct proof instead?



The 2019 Stack Overflow Developer Survey Results Are In
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Loop invariants?Heap-like data structure allowing peek at largest & smallestIs this algorithm actually a graph-traversal algorithm?Sorting an “almost sorted” array in sub linear timeTrying to understand this Quicksort Correctness proofCorrectness proof: 2-approximation of greedy matching-algorithmProof of correctness of algorithm to determine whether the elements of an array are repeated an equal number of timesIs this lower bound proof for the comparison-based sorting problem correct?Proof of Lower Bound for Deterministic Distinct Elements AlgorithmArray contains elements that differ by K correctness proof










3












$begingroup$


First Slide: Find Max(A)



  1. // INPUT: A[1..n] - an array of integers

  2. // OUTPUT: an element m of A such that m >= A[j], for all 1 <= j <= A.length

  3. max = A[j==1]

  4. for j = 2 to A.length

  5. if max < A[j]

  6. max = A[j]

  7. return max

Second Slide: Proof By Contradiction



Proof: Suppose the algorithm is incorrect. Then for some input A, either:



  1. max is not an element of A or

  2. A has an element A[j] such that max < A[j]

Max is initialized to and assigned to elements of A - so (1) is impossible.



After the j-th iteration of the for loop (lines 4 - 6), max >= A[j]. From lines 5,6 max only increases. Therefore upon termination, max >= A[j] which contradicts (2).



End Of Slides



This algorithm (first slide) finds the max element in the array. This is a proof by contradiction. Isn't this algorithm already proved when it gets to max >= A[j] in the last line of the second slide. Is which contradicts (2) even necessary? Because in the second slide you showed max is in the array, and then you met the condition of a maxium m: an element m of A such
that m >= A[j] for all 1 <= j <= A.length.



This seems to be two proofs in one. And since it seems to me that the direct proof happens first, then the proof by contradiction is redundant and therefore not necessary. Am i missing something here? Is this only a proof by contradiction? Or is it a direct proof instead?



The image below is just the slides 1 and 2 that I transcribed above. From York University.



Find Max: Slides 1 and 2










share|cite|improve this question











$endgroup$







  • 3




    $begingroup$
    The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
    $endgroup$
    – philipxy
    Mar 25 at 8:46







  • 1




    $begingroup$
    Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
    $endgroup$
    – dkaeae
    Mar 25 at 10:22















3












$begingroup$


First Slide: Find Max(A)



  1. // INPUT: A[1..n] - an array of integers

  2. // OUTPUT: an element m of A such that m >= A[j], for all 1 <= j <= A.length

  3. max = A[j==1]

  4. for j = 2 to A.length

  5. if max < A[j]

  6. max = A[j]

  7. return max

Second Slide: Proof By Contradiction



Proof: Suppose the algorithm is incorrect. Then for some input A, either:



  1. max is not an element of A or

  2. A has an element A[j] such that max < A[j]

Max is initialized to and assigned to elements of A - so (1) is impossible.



After the j-th iteration of the for loop (lines 4 - 6), max >= A[j]. From lines 5,6 max only increases. Therefore upon termination, max >= A[j] which contradicts (2).



End Of Slides



This algorithm (first slide) finds the max element in the array. This is a proof by contradiction. Isn't this algorithm already proved when it gets to max >= A[j] in the last line of the second slide. Is which contradicts (2) even necessary? Because in the second slide you showed max is in the array, and then you met the condition of a maxium m: an element m of A such
that m >= A[j] for all 1 <= j <= A.length.



This seems to be two proofs in one. And since it seems to me that the direct proof happens first, then the proof by contradiction is redundant and therefore not necessary. Am i missing something here? Is this only a proof by contradiction? Or is it a direct proof instead?



The image below is just the slides 1 and 2 that I transcribed above. From York University.



Find Max: Slides 1 and 2










share|cite|improve this question











$endgroup$







  • 3




    $begingroup$
    The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
    $endgroup$
    – philipxy
    Mar 25 at 8:46







  • 1




    $begingroup$
    Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
    $endgroup$
    – dkaeae
    Mar 25 at 10:22













3












3








3





$begingroup$


First Slide: Find Max(A)



  1. // INPUT: A[1..n] - an array of integers

  2. // OUTPUT: an element m of A such that m >= A[j], for all 1 <= j <= A.length

  3. max = A[j==1]

  4. for j = 2 to A.length

  5. if max < A[j]

  6. max = A[j]

  7. return max

Second Slide: Proof By Contradiction



Proof: Suppose the algorithm is incorrect. Then for some input A, either:



  1. max is not an element of A or

  2. A has an element A[j] such that max < A[j]

Max is initialized to and assigned to elements of A - so (1) is impossible.



After the j-th iteration of the for loop (lines 4 - 6), max >= A[j]. From lines 5,6 max only increases. Therefore upon termination, max >= A[j] which contradicts (2).



End Of Slides



This algorithm (first slide) finds the max element in the array. This is a proof by contradiction. Isn't this algorithm already proved when it gets to max >= A[j] in the last line of the second slide. Is which contradicts (2) even necessary? Because in the second slide you showed max is in the array, and then you met the condition of a maxium m: an element m of A such
that m >= A[j] for all 1 <= j <= A.length.



This seems to be two proofs in one. And since it seems to me that the direct proof happens first, then the proof by contradiction is redundant and therefore not necessary. Am i missing something here? Is this only a proof by contradiction? Or is it a direct proof instead?



The image below is just the slides 1 and 2 that I transcribed above. From York University.



Find Max: Slides 1 and 2










share|cite|improve this question











$endgroup$




First Slide: Find Max(A)



  1. // INPUT: A[1..n] - an array of integers

  2. // OUTPUT: an element m of A such that m >= A[j], for all 1 <= j <= A.length

  3. max = A[j==1]

  4. for j = 2 to A.length

  5. if max < A[j]

  6. max = A[j]

  7. return max

Second Slide: Proof By Contradiction



Proof: Suppose the algorithm is incorrect. Then for some input A, either:



  1. max is not an element of A or

  2. A has an element A[j] such that max < A[j]

Max is initialized to and assigned to elements of A - so (1) is impossible.



After the j-th iteration of the for loop (lines 4 - 6), max >= A[j]. From lines 5,6 max only increases. Therefore upon termination, max >= A[j] which contradicts (2).



End Of Slides



This algorithm (first slide) finds the max element in the array. This is a proof by contradiction. Isn't this algorithm already proved when it gets to max >= A[j] in the last line of the second slide. Is which contradicts (2) even necessary? Because in the second slide you showed max is in the array, and then you met the condition of a maxium m: an element m of A such
that m >= A[j] for all 1 <= j <= A.length.



This seems to be two proofs in one. And since it seems to me that the direct proof happens first, then the proof by contradiction is redundant and therefore not necessary. Am i missing something here? Is this only a proof by contradiction? Or is it a direct proof instead?



The image below is just the slides 1 and 2 that I transcribed above. From York University.



Find Max: Slides 1 and 2







algorithms correctness-proof check-my-answer






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Mar 26 at 1:25







user100752

















asked Mar 25 at 2:40









user100752user100752

1814




1814







  • 3




    $begingroup$
    The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
    $endgroup$
    – philipxy
    Mar 25 at 8:46







  • 1




    $begingroup$
    Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
    $endgroup$
    – dkaeae
    Mar 25 at 10:22












  • 3




    $begingroup$
    The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
    $endgroup$
    – philipxy
    Mar 25 at 8:46







  • 1




    $begingroup$
    Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
    $endgroup$
    – dkaeae
    Mar 25 at 10:22







3




3




$begingroup$
The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
$endgroup$
– philipxy
Mar 25 at 8:46





$begingroup$
The proof assumes the opposite of what is to be proved then shows a contradiction. So it is a proof by contradiction. And so it is not a direct proof. It happens to prove that the algorithm is correct. "when it gets to max >= A[j]" it has gotten there by having assumed the opposite of what is to be proved; it has not proved "max >= A[j]" having assumed nothing. Indeed since it assumed something that happens to be false, anything can be derived thereafter before discharging that assumption.
$endgroup$
– philipxy
Mar 25 at 8:46





1




1




$begingroup$
Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
$endgroup$
– dkaeae
Mar 25 at 10:22




$begingroup$
Don't use images as main content of your post. This makes your question impossible to search and inaccessible to the visually impaired; we don't like that. Please transcribe text and mathematics (note that you can use LaTeX) and don't forget to give proper attribution to your sources!
$endgroup$
– dkaeae
Mar 25 at 10:22










2 Answers
2






active

oldest

votes


















4












$begingroup$

You seem to think the structure of the proof is:



  1. suppose the algorithm is incorrect;

  2. prove that the algorithm is, in fact, correct;

  3. this contradicts 1., so the algorithm is correct.

That's almost, but not quite true. Step 2 doesn't prove that the returned value $mathrmmax$ is bigger than every element of the array, which is what would be required to prove that the algorithm is correct. It just proves that $mathrmmax$ is bigger than the specific array value that was supposed to be a counterexample in step 1.



But, as Yuval has pointed out, the proof is much easier if you forget about contradiction completely and prove that $mathrmmax$ is in the array (identical to the given proof) and then show that $mathrmmax$ is at least as big as every array element (identical to the proof except "for all $j$" instead of just for one supposed counterexample.






share|cite|improve this answer









$endgroup$












  • $begingroup$
    When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
    $endgroup$
    – user100752
    Mar 27 at 6:03











  • $begingroup$
    @user100752 Yes, it's specifically the $j$ in point 2.
    $endgroup$
    – David Richerby
    Mar 27 at 10:10


















3












$begingroup$

It's a proof by contradiction that could easily be rewritten as a direct proof.



To rephrase it as a direct proof, we divide it into two claims:




  1. $max$ is an element of $A$.


  2. $max geq A[j]$ for all $j$.

We can conclude that $max = max(A)$.






share|cite|improve this answer









$endgroup$













    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "419"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f106019%2fwhy-is-this-a-proof-by-contradiction-for-this-algorithm-isnt-this-a-direct-pro%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4












    $begingroup$

    You seem to think the structure of the proof is:



    1. suppose the algorithm is incorrect;

    2. prove that the algorithm is, in fact, correct;

    3. this contradicts 1., so the algorithm is correct.

    That's almost, but not quite true. Step 2 doesn't prove that the returned value $mathrmmax$ is bigger than every element of the array, which is what would be required to prove that the algorithm is correct. It just proves that $mathrmmax$ is bigger than the specific array value that was supposed to be a counterexample in step 1.



    But, as Yuval has pointed out, the proof is much easier if you forget about contradiction completely and prove that $mathrmmax$ is in the array (identical to the given proof) and then show that $mathrmmax$ is at least as big as every array element (identical to the proof except "for all $j$" instead of just for one supposed counterexample.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
      $endgroup$
      – user100752
      Mar 27 at 6:03











    • $begingroup$
      @user100752 Yes, it's specifically the $j$ in point 2.
      $endgroup$
      – David Richerby
      Mar 27 at 10:10















    4












    $begingroup$

    You seem to think the structure of the proof is:



    1. suppose the algorithm is incorrect;

    2. prove that the algorithm is, in fact, correct;

    3. this contradicts 1., so the algorithm is correct.

    That's almost, but not quite true. Step 2 doesn't prove that the returned value $mathrmmax$ is bigger than every element of the array, which is what would be required to prove that the algorithm is correct. It just proves that $mathrmmax$ is bigger than the specific array value that was supposed to be a counterexample in step 1.



    But, as Yuval has pointed out, the proof is much easier if you forget about contradiction completely and prove that $mathrmmax$ is in the array (identical to the given proof) and then show that $mathrmmax$ is at least as big as every array element (identical to the proof except "for all $j$" instead of just for one supposed counterexample.






    share|cite|improve this answer









    $endgroup$












    • $begingroup$
      When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
      $endgroup$
      – user100752
      Mar 27 at 6:03











    • $begingroup$
      @user100752 Yes, it's specifically the $j$ in point 2.
      $endgroup$
      – David Richerby
      Mar 27 at 10:10













    4












    4








    4





    $begingroup$

    You seem to think the structure of the proof is:



    1. suppose the algorithm is incorrect;

    2. prove that the algorithm is, in fact, correct;

    3. this contradicts 1., so the algorithm is correct.

    That's almost, but not quite true. Step 2 doesn't prove that the returned value $mathrmmax$ is bigger than every element of the array, which is what would be required to prove that the algorithm is correct. It just proves that $mathrmmax$ is bigger than the specific array value that was supposed to be a counterexample in step 1.



    But, as Yuval has pointed out, the proof is much easier if you forget about contradiction completely and prove that $mathrmmax$ is in the array (identical to the given proof) and then show that $mathrmmax$ is at least as big as every array element (identical to the proof except "for all $j$" instead of just for one supposed counterexample.






    share|cite|improve this answer









    $endgroup$



    You seem to think the structure of the proof is:



    1. suppose the algorithm is incorrect;

    2. prove that the algorithm is, in fact, correct;

    3. this contradicts 1., so the algorithm is correct.

    That's almost, but not quite true. Step 2 doesn't prove that the returned value $mathrmmax$ is bigger than every element of the array, which is what would be required to prove that the algorithm is correct. It just proves that $mathrmmax$ is bigger than the specific array value that was supposed to be a counterexample in step 1.



    But, as Yuval has pointed out, the proof is much easier if you forget about contradiction completely and prove that $mathrmmax$ is in the array (identical to the given proof) and then show that $mathrmmax$ is at least as big as every array element (identical to the proof except "for all $j$" instead of just for one supposed counterexample.







    share|cite|improve this answer












    share|cite|improve this answer



    share|cite|improve this answer










    answered Mar 25 at 8:51









    David RicherbyDavid Richerby

    70.3k15107196




    70.3k15107196











    • $begingroup$
      When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
      $endgroup$
      – user100752
      Mar 27 at 6:03











    • $begingroup$
      @user100752 Yes, it's specifically the $j$ in point 2.
      $endgroup$
      – David Richerby
      Mar 27 at 10:10
















    • $begingroup$
      When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
      $endgroup$
      – user100752
      Mar 27 at 6:03











    • $begingroup$
      @user100752 Yes, it's specifically the $j$ in point 2.
      $endgroup$
      – David Richerby
      Mar 27 at 10:10















    $begingroup$
    When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
    $endgroup$
    – user100752
    Mar 27 at 6:03





    $begingroup$
    When it says "after the j-th iteration of the for-loop (lines 4 - 6) max >= A[j]" is it talking specifically about the index of the assumed counter example A[j]? When I initially read this proof I was thinking about j taking on all the values, so I was thinking at the end of each iteration max >= A[j]. And this is why I guess I was thinking along the lines of a direct proof.
    $endgroup$
    – user100752
    Mar 27 at 6:03













    $begingroup$
    @user100752 Yes, it's specifically the $j$ in point 2.
    $endgroup$
    – David Richerby
    Mar 27 at 10:10




    $begingroup$
    @user100752 Yes, it's specifically the $j$ in point 2.
    $endgroup$
    – David Richerby
    Mar 27 at 10:10











    3












    $begingroup$

    It's a proof by contradiction that could easily be rewritten as a direct proof.



    To rephrase it as a direct proof, we divide it into two claims:




    1. $max$ is an element of $A$.


    2. $max geq A[j]$ for all $j$.

    We can conclude that $max = max(A)$.






    share|cite|improve this answer









    $endgroup$

















      3












      $begingroup$

      It's a proof by contradiction that could easily be rewritten as a direct proof.



      To rephrase it as a direct proof, we divide it into two claims:




      1. $max$ is an element of $A$.


      2. $max geq A[j]$ for all $j$.

      We can conclude that $max = max(A)$.






      share|cite|improve this answer









      $endgroup$















        3












        3








        3





        $begingroup$

        It's a proof by contradiction that could easily be rewritten as a direct proof.



        To rephrase it as a direct proof, we divide it into two claims:




        1. $max$ is an element of $A$.


        2. $max geq A[j]$ for all $j$.

        We can conclude that $max = max(A)$.






        share|cite|improve this answer









        $endgroup$



        It's a proof by contradiction that could easily be rewritten as a direct proof.



        To rephrase it as a direct proof, we divide it into two claims:




        1. $max$ is an element of $A$.


        2. $max geq A[j]$ for all $j$.

        We can conclude that $max = max(A)$.







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Mar 25 at 7:36









        Yuval FilmusYuval Filmus

        197k15185349




        197k15185349



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Computer Science Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcs.stackexchange.com%2fquestions%2f106019%2fwhy-is-this-a-proof-by-contradiction-for-this-algorithm-isnt-this-a-direct-pro%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How should I support this large drywall patch? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How do I cover large gaps in drywall?How do I keep drywall around a patch from crumbling?Can I glue a second layer of drywall?How to patch long strip on drywall?Large drywall patch: how to avoid bulging seams?Drywall Mesh Patch vs. Bulge? To remove or not to remove?How to fix this drywall job?Prep drywall before backsplashWhat's the best way to fix this horrible drywall patch job?Drywall patching using 3M Patch Plus Primer

            random experiment with two different functions on unit interval Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Random variable and probability space notionsRandom Walk with EdgesFinding functions where the increase over a random interval is Poisson distributedNumber of days until dayCan an observed event in fact be of zero probability?Unit random processmodels of coins and uniform distributionHow to get the number of successes given $n$ trials , probability $P$ and a random variable $X$Absorbing Markov chain in a computer. Is “almost every” turned into always convergence in computer executions?Stopped random walk is not uniformly integrable

            Lowndes Grove History Architecture References Navigation menu32°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661132°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661178002500"National Register Information System"Historic houses of South Carolina"Lowndes Grove""+32° 48' 6.00", −79° 57' 58.00""Lowndes Grove, Charleston County (260 St. Margaret St., Charleston)""Lowndes Grove"The Charleston ExpositionIt Happened in South Carolina"Lowndes Grove (House), Saint Margaret Street & Sixth Avenue, Charleston, Charleston County, SC(Photographs)"Plantations of the Carolina Low Countrye