Sorting numbers without using sort is (in my eyes) a useful task in a beginners programming course. The student learns something about arrays here - and possibly something about algorithms and about partitioning a big problem (change the order of a huge list) into small steps (exchange two elements). So in my eyes it is far from being perverse.
However the goal of the task is not reached if the student just copies some lines found in the internet. Speaking of this, I'm tempted to advise to use David Morgan-Mar's algorithm intelligent design sort - as it is easy to implement and very fast, especially for huge amounts of data.
So long, Rata
| [reply] [Watch: Dir/Any] [d/l] |