< More Posts

CS50: Weeks 3 / 4

Published 12 July 2020 at Yours, Kewbish. 1323 words. Subscribe via RSS.

Also published on Dev.to.


I severely underestimated how long these posts took to write, and I miscalculated my schedule a little in trying to keep up with my classmates, so here we are with a second post this week. Truly becoming an online content creator, with a release schedule. This post’ll go through weeks 3 and 4 of CS50, and include my notes and comments for both, because I couldn’t be bothered to write up two separate posts. I’ll go back to one a (CS50)week when we hit Week 5.

Week 3 goes through several common sorting algorithms and Big-O notation, and week 4 goes through memory and files. Both problem sets are slightly unrelated, but that’s fine - I learned a ton this week as well. We’re in the thick of it now - weeks 3 - 5 are apparently the most difficult in CS501.

Week 3

Let’s start with the usual notes:

Personally, I found the lecture pretty unrelated to the problem set, which was all about voting. This was one week where I kind of regretted my idea to do both less/more comfortable versions of a problem - Runoff and Tideman were both super difficult. This was also the first week we got ‘distribution code’, or a template that takes care of most of the functions for us.

One thing that was a significant obstacle was the various structs and variables, and how we got the distribution code. I didn’t spend much time poring over the given code, and as a result, it was a little difficult to remember the types and purposes of each variable. I kept having to refer to the Walkthrough video to remember what each function was supposed to do. Runoff was clearer in this case, providing actual hints. I guess Tideman was supposed to be more difficult, but it would have been nice to have more hints along the way.

Tideman also involves a decent amount of graph theory, or at least knowledge of recursion. Nowhere in the lecture was the graph theory really covered, so I had to do a lot of figuring and drawing algorithms out on my own. :sigh: It was helpful to draw dummy tables out and go through the algorithm step by step, at least.

Week 4

Here are my notes:

This week’s problem set was a lot less painful. I guess it’s just because week 3 was more focused on algorithms and abstract programs, whereas this week was more hands-on and practical. The distribution code this week was also less related to what we actually had to implement, so was much easier to just skim through.

Having experience with Python’s file operations definitely helped a lot, and made the entire file open/read/close flow easier to understand. I think the most annoying part of this week was definitely just learning that fwrite != fprintf (one is bytes and the other is strings). Besides that, the photo filtering and recover algorithms were really well explained in the problem brief, and didn’t require too much mental gymnastics to figure out.

(Also, brief note that Filter Less and Filter More are basically the same program. More just replaces Sepia with Edges, but Edges builds off Blur, anyhow. Again, do both parts of the problem, I promise it’s fun!)

In general, I think that I prefer practical projects rather than more abstract problems, which also explains my difficulties with algorithms. Well, I guess that was why I took this course - more pain algorithms!


In my predictions, I’d thought that weeks three through five were going to be the most painful, and I guess now that I’m here I kind of agree. Week 4 was tolerable, but Week 3 was absolute torture, and I’m not looking forward to Week 5 either. (On the bright side, Week 6 means the glory of Python once again.)

I’ve been working on a little Vue and Firebase thing, trying to properly understand how authentication and Vue Router work. It’s actually been a lot less painless than I thought, despite my initial reservations with diveintoht.ml. I might make DIH my final project, actually. I’d like to move to a different markdown parser, add Vue Router, adjust authentication, and fix some performance issues. I’m looking forward to it actually - not having to come up with a project idea and just doing some maintenance can be pretty fun. Alright, I’d better get back to calculus now-

  1. According to r/cs50, which is a highly reliable source. ↩︎

- Yours, Kewbish

< More Posts