[Year 12 SofDev] Selection sort 2016. Goodbye Bubbles.

Mark mark at vceit.com
Sun Dec 14 10:47:36 EST 2014


It's interesting to see that the bubble sort has lost its job in the 2016
study design (U4O1 KK05).
It has been replaced by the selection sort.

I wonder why... it's not much smarter than bubble (or 'Bubbles', as she
likes to be known).

FYI - the selection sort (adapted from theoryapp.com)

*Selection sort* is to repetitively pick up the smallest element and put it
into the right position:

   - Find the smallest element, and put it to the first position.
   - Find the next smallest element, and put it to the second position.
   - Repeat until all elements are in the right positions.

A loop through the array finds the smallest element easily. After the
smallest element is put in the first position, it is fixed and then we can
deal with the rest of the array. A *nested loop* can repetitively pick up
the smallest element and swap it to its final position.
-- 

Mark Kelly
mark AT vceit DOT com
http://vceit.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.edulists.com.au/pipermail/sofdev/attachments/20141214/6d3c6545/attachment.html 


More information about the sofdev mailing list