It’s all about sorting

There’s nothing more helpful or impressive than working with an application and the data displayed is all nicely sorted for you.  It’s often something that we just take for granted.

From the programming end, nothing could be further from the truth.  It’s seemingly simple concept yet really difficult for the beginning programmer to get their head around.  Many never really do; they view it as a black box where raw data goes in and comes out the other side nicely organized and little concern given to what happens inside that box.

So, how do you sort?

Computer Science teachers and programmers know that there are more than one ways to sort.  And, it’s a topic covered in the Computer Studies Curriculum.

A3.4 create a sort algorithm (e.g., bubble, insertion, selection) to sort data in an array;

I think that every programmer should have one sorting algorithm that they have committed to memory and can recreate at a moment’s notice.  In my classes, we explored many but the one that I always taught first was the Bubble Sort.  I think that’s probably the one that most classes use.  Somehow, the concept of air bubbles in your pop rising to the surface is easy to grasp.

Thanks, Toptal –

As a second choice, we would take a look at an Insertion Sort.

But, there’s more.  

Anyone who has studied Computer Science seriously will have been exposed to a number of different algorithms.  The study of sorting algorithms gets you to look very seriously at algorithm efficiencies and provides a choice for the programmer.  It gets really interesting when you take a look at different algorithms and different collections of data.

For a very visual resource, Toptal offers this which compares a number of algorithms with a number of ways that the data to be sorted is arranged.

When there comes a time when you need to compare sorting algorithms, be glad that you bookmarked this resource.


OTR Links 05/02/2017

Posted from Diigo. The rest of my favorite links are here.