[Year 12 SofDev] Selection sort 2016. Goodbye Bubbles.
Kevork Krozian
kevork at edulists.com.au
Sun Dec 14 22:02:58 EST 2014
Hi Mark
A good comparison between the two here http://cs.stackexchange.com/questions/13106/why-is-selection-sort-faster-than-bubble-sort
Basically, bubble keeps swapping ( bubbling or floating to the end after every comparison ), whilst selection swaps once per pass placing the largest in the subarray at the last location .
I do accept the similarities are quite strong.
Speak soon
Kevork Krozian
Edulists Creator Administrator
www.edulists.com.au
tel: 0419 356 034
From: sofdev-bounces at edulists.com.au [mailto:sofdev-bounces at edulists.com.au] On Behalf Of Mark
Sent: Sunday, 14 December 2014 10:48 AM
To: Year 12 Software Development Teachers' Mailing List
Subject: [Year 12 SofDev] Selection sort 2016. Goodbye Bubbles.
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/f4637dec/attachment.html
More information about the sofdev
mailing list