STinC++ rewrites the programs in Software Tools in Pascal using C++
This chapter is called Sorting and, by Jove, did we do some sorting. Three different sort algorithms and two separate text sort programs, one entirely in-memory, the other using temporary backing files so it can cope with arbitrarily enormous files. Finally we rounded out with a couple of examples of things having a sort utility enables, removing duplicates and the surprisingly fiddly keyword-in-context.
I enjoyed this chapter actually, especially implementing the various sort algorithms. Unless you’re doing something absurdly specialist (or an utterly ludicrous job interview) there’s no need to write your own sort routine. Because I’m neither absurdly specialist (quite the reverse, generalism is my thing) nor do I really do interviews (we’ll have a conversation, but I’m not doing tricks), I never have written a sort before. Working through quicksort was particularly illuminating, in that before I had a vague idea of how it worked, and now I actually understand it.
I also enjoyed the coincidence of starting to work on keyword-in-context at exactly the time there was a minor Twitter excitement about it, even it did subsequently take me six weeks to write the blessed thing up.
Hitting the end of Chapter Four marks the half-way point of Software Tools in Pascal, just shy of two years since starting this ridiculous little project. Thanks for coming along.
Chapter Five is entitled Text Patterns, I’m 52 today, and I’m excited. I’ve been looking forward to this chapter from the start.