Sunday 14 June 2015

computer science - Proving insertion sort using induction

A while back when I was taking a first year cs course, our professor had us write the algorithm for insertion sort in The Scheme programming language. There were also several other similar recursion type programs for us to write, and one of the question in the assignment was to prove that the programs are correct using Mathematical Induction. At first I tried to justify my program using "Weak Induction", however my professor insisted on me using "Strong Induction" and I lost marks for not using it. I was not confident at the time to engage in an argument or ask for reasons why Strong over Weak and this has been bugging me ever since.



So, the question is this: Using weak induction in the ordinary sense such as, proving n = 0 for base case and proving the inductive step of the algorithm, was there anything wrong other than pedagogy? If so, could you enlighten me by explaining why there was a need to use strong induction to prove recursion type algorithms such as insertion sort?




Thanks in advance

No comments:

Post a Comment

real analysis - How to find $lim_{hrightarrow 0}frac{sin(ha)}{h}$

How to find $\lim_{h\rightarrow 0}\frac{\sin(ha)}{h}$ without lhopital rule? I know when I use lhopital I easy get $$ \lim_{h\rightarrow 0}...