mdoery ~ software development

adventures in coding

coursera algorithms part i

| Comments

Summary: The coursera course Algorithms Part I is worth it, with some caveats

My educational background is in physics and math, not computer science. I’ve taken exactly one computer course (Pascal) as an undegraduate. Aside from that, the programming knowledge that I’ve got was all self-taught: from the Basic programs that I wrote as a teenager on my father’s Commodore 64, to the Fortran code that I wrote to study physical systems in grad school, it was all stuff I had learned on my own or from building on the code of others.

When my career took a left turn, and I started developing for web applications, my background served me well. However, I had the feeling that I was missing some things that I would have learned if I’d gone into a computer science degree program. This is hammered in when you go for job interviews where they ask you abstruse computer science questions.

Even so, it’s been hard to make myself study something like algorithms – there’s just so much time in life, and there always seem to be more urgent things to do… But then I noticed the Coursera course in algorithms, and finally decided to take a swing at it. This is Algorithms, Part I. The promotional material reads: “This course covers the essential information that every serious programmer needs to know about algorithms and data structures.” To top it off, it’s a Princeton University course – at no charge! What more could you ask for? And they tell you that the course requires “6-12 hours of work / week” for 6 weeks. I can certainly afford that! It seems time well spent.

I didn’t have much time during the month of June, but I figured I could catch up. It has not been easy! Each week covers 2 topics. Week 1 covers the “Union-Find” algorithm, and also “Analysis of Algorithms”. I just finished the first programming assignment for “Union-Find”. It didn’t take long for me to get running code which did what the spec wanted – perhaps 3 or 4 hours. But that’s not enough. When you submit your code, it’s run through an automated grading system. Little bugs which seemingly shouldn’t count for much can result in nearly complete failure.

In my case, I uploaded the assignment 5 different times, each time resulting in an improvement until it passed with 100% the very last time. The first couple times I had to debug a few items because I had misunderstood the spec for a couple of API methods. In one particularly nasty bug, I had somehow managed to use the wrong version of their algorithm class (QuickFindUF instead of WeightedQuickUnionUF) in my code – oops! That turned out to be very difficult and time-consuming to discover. The automated grading system gives you hints about what is going wrong, but in some cases it just appears to be annoyingly cryptic.

Fortunately, there’s a tipsheet that goes with each assignment. And there are also discussion forums for when you get really desperate. With all this help, it still took me at least 10 hours to finish just this initial programming assignment, and I haven’t even touched the next one yet. I hope things go faster from here on out, but I’m skeptical about that.