An algorithm is a method of doing an operation. Writing and studying algorithms is one of the biggest branches of computer science.

For reasons that I cannot fathom, templates terrify many C++ programmers. Not just beginners; hang around any sizable C++ community for any length of time and you will inevitably see someone who is otherwise quite competent going to irrational lengths to avoid writing a template. This fear baffles me, because templates are not really any harder to write than non-templates – in fact, in many cases you can simply replace the hard-coded types with T, add the template declaration, and you’re done. This refusal to simply go generic when it is obviously the way to go can make an otherwise potentially useful bit of code almost entirely useless. Continue Reading

One of my pet peeves about most C++ courses, tutorials, and books is that they seem to pointedly ignore algorithms. I don’t mean algorithms from a theoretical perspective, I mean the standard algorithms library – I am stunned at how many C++ teachers insist their students don’t use algorithms in their assignments. And aside from the actual standard algorithms themselves, most books, tutorials, and courses make absolutely no effort to discuss algorithms that follow the same general design. In my opinion, writing a standard-like algorithm should be one of the key parts of a modern C++ beginner’s course outline. Continue Reading