Shortcut for chapter specific information

Tuesday, April 26, 2011

Daily Practice 20110426

Insertion sort 40 (C): Good
Selection sort 10,11,12 (C): 10 Bad, 11 Bad, 12 Good.  Why? 
10 used tmp rather than A in swapping - it's a good thing to always mind the variable you used.
11 used the assign A[j] to min instead of j.  The caused the whole program looks like it is working.  This is a subtle bug if the value of A is closed to sort.

My problem of selection sort is that I hadn't gone through the what if analysis of the whole algorithm.  I should try it some time.

33_P

No comments:

Post a Comment