I want to tell you one interesting story told by my friends.
He wanted to criticize one inferior way of thinking which he, ridiculously enough, attributed to one particular school. This way of "engineering thinking" included, as a part of it, taking special proud of "the skills of reading technical literature" (a trivial thing, in my opinion and opinion of my friend). And here the story goes…
This engineer was given a problem of writing a median filter
. This filter is often used and have a remarkable features of noise reduction without softening edges too much. As you can see from the suggested pseudo-code, sorting is involved: http://en.wikipedia.org/wiki/Median_filter
The filter has certain width parameter N. N elements are taken on input, sorted, and middle element from the sequence of N is passed to output. Then one element is added to this set of N, which is sorted again and so on.
This person speculated "logically": "Aha, the filter… Where is my book on algorithms? Here… Now, sorting algorithms… here is the list… let's see… this one is called "quick sort". After all, do we need slow sort? So, let's take quick sort."
And he took it from the book, and implemented it, and the sorting worked, and the filter ultimately worked. So, in effect, the median filter algorithm was ready, too. Is it good or not?
But my friend sayd: "Fool, you are fool. You did not need this general-purpose sorting. You needed to place one element in an already sorted sequence.
Are you getting the idea?