in reply to Re^2: How to perform different sorts on multiple sections of items in the same array
in thread How to perform different sorts on multiple sections of items in the same array

The statement about <=> vs. the string version, cmp, is of course my blunder.   Oops.

The idea itself is certainly not new:   that’s how they did it (and, still do it ...) in the earliest COBOL days.   But it most certainly isn’t “plagarism,” as if such a curious term could actually apply in this context ... which it obviously can’t.   (In general, several of you routinely step over the line of decorum and civility . . . and I’ve simply given up asking you to stop.   But, I digress.)

A lot depends on exactly how much data we might be dealing with.   If the whole shebang fits easily within available memory, then it matters very little how you do it:   split the in-memory list into three in-memory lists, sort each one, splice ’em all together into one, and you’re done.   Or, pay your nod to Mr. Schwartz, if you prefer.   No discussion required.   But, if data volumes are large ... especially if they are very large ... custom sort-comparison routines work extremely well.

I decided to make this suggestion ... not to hear myself babble, nor with the slightest concern for “votes” ... but to offer an alternative strategy.   “There’s more than one way to do it,™” and here’s another.   Yes, it involves a non-trivial subroutine.   But, so do many sorts.   Even if it is deemed not-useful in this particular (small?) case, it is a useful alternative to keep in mind.