It’s never too late to learn algorithms, and don’t let anyone tell you otherwise. It’s not going to happen overnight or over a single lunch break, but an hour here a weekend there and you might see progress. But where do you start? That’s a good question. Algorithms are one of those complex arguments with foundations in something even more complex like mathematics and statistics, and can scare some people away. I don’t have a complete road map to studying these topics either, at least yet, but I can share some study notes as I go along.
What’s in it for you, though? That’s a legitimate question. Why would someone even study something like algorithms? An MIT OpenCourseWare inspired answer could be to put some order into chaos, but that’s way too philosophical for engineers and aspiring students of algorithms. However, seriously, the MIT 604 course Introduction to Algorithms presents the point in those exact terms. Computers and computer programs are complex, with algorithms we can observe them as something we can do mathematical calculations on. Makes it easier to reason. And if we want to compare two ways of writing a program, the best way is to compare them not by their execution speed, but by how that speed grows as the input grows. We don’t compare how fast a way of writing a program is, but how that speed changes with the amount of input we feed into it.
I don’t know if you, the reader of this blog, have a degree in Computer Science or not, if you program and if you do it as a job or as a hobby. Maybe you have passed exams in algorithms, maybe you have loved or hated the experience. Either way it doesn’t have to stop at that.
Even if you don’t implement complex algorithms in your code every day, having studied them changes the way you think and that changes the way you code.
It certainly doesn’t have to stop at that. It certainly won’t for me. As Prof. Charles Leiserson puts it
“If you want to be a good programmer, program every day for two years. If you want to be a world-class programmer, program every day for twenty years. Or program every day for two years, and take an algorithms class.”
And I have no time to waste. Plus, you don’t want to miss out on the lectures by Prof. Erik Demaine. Don’t know who he is? Click “Continue reading”, or visit the 604 course website or use a search engine.
Prof. Erik Demaine of MIT explains various topics to his students in interesting ways, and he also teaches algorithms to whomever will listen in the videos that MIT has put online. He does speak a bit fast, but you may pause every once in a while if you need to and you might discover you can follow it anyway. If you visit http://erikdemaine.org/ you might discover things about folding algorithms, computational origami and other fun topics – consider those as motivational while you learn your sorting and search basics. Try to view algorithms as much as a game as possible. A bit like Sudoku. Even the hard parts. Especially the hard parts. Take them apart, see how they click, play with them, apply them to something real life related, like a bookmarklet to list the urls in a webpage in alphabetical order, or to find something in something else.
And what about asymptotic notation? The big-O? Does it scare you? Well, I’m certainly trying to face it as a challenge and as a new continent to explore. Or a new toy. I’m trying to figure it our for myself and myself alone, no exams (for now), no one looking over my shoulder or judging me. I’ll try to have fun and conquer it little by little. Apparently studying the notation helps us balance mathematics and “engineering common sense”, or at least that’s how they put it at MIT. We can ignore machine dependant constants and compare ways of reasoning and their workings. Which is good brain training and can help you in many areas of life and programming, I guess.
So, I’m not an expert in algorithms. I’ve studied them in the past but never really as much as I should have. But I have the rest of my life in front of me, and it’s better like this then having obsessed over CS theory in college and then forgotten about it forever. Of course, total respect for anyone who has studied CS in college, I have nothing but admiration, and humbly admit you are way ahead of me in every way and a source of inspiration, all of you:)
I could go on and on but it’s getting late. Off to do some exercises and then sleep. Have fun and remember to learn something new every day. EVERY day.