Welcome to Part 5 of The Harvard CS50x Adventures, where I’ll show you my firsthand experience of taking the CS50 Introduction To Computer Science course on edX as a beginner.
In Part 4 of The Harvard CS50x Adventures, I experienced the most challenging problem of the course, Tideman. As a result, I went on a long break of almost more than two months to the point that I forgot about this course. But I’m back now and ready to learn more.
Week 4 was about memory—things such as memory allocation, pointers, hexadecimals, and call stacks. The concepts were definitely more difficult, which made the problems more difficult. Let’s dive a little deeper.
Momentum is such a massive part of what you’re able to get done. I lost all my momentum with the Tideman problem from Problem Set 3. Not being able to solve the problem as fast as I usually do drained my energy and motivation.
That’s why I didn’t work on any course or post any articles for almost two months. I almost forgot that I was taking a course.
When you’re learning anything, you retain more and learn faster if you have momentum. Momentum comes from accomplishing various tasks without failure or getting stuck. When you get stuck, you start to lose energy and the ability to learn better as well.
For me, I took a long break, but now I’m coming back. It’s time to rebuild my learning momentum and look at Part 5 of The Harvard CS50x Adventures.
More On Memory
In Week 4 of the CS50 course, we looked at memory a bit more.
First, we started off by looking at hexadecimal. Hexadecimal is another counting system. The reason we look at it in Week 4 is that memory addresses use the counting system hexadecimal.
The main advantage of the hexadecimal system is that it can count higher using fewer digits. Addresses and colors are some of the primary users of hexadecimal, where they need very large numbers.
Next, we dove into pointers, which was quite confusing for me. Admittedly, I did not fully understand pointers. But in a general sense, a pointer points to a location in the memory, and we denote it using an asterisk (*) symbol.
And once again, strings are getting more complicated. It turns out, strings are not exactly arrays like I talked about in Part 3 of The Harvard CS50x Adventures. They’re actually pointers to the beginning of a section of memory.
After establishing the idea of pointers and memory, we start breaking down some of the past problems and how certain functions can be developed with the usage of pointers. For example, swapping and compare functions.
We also talked about segmentation faults and how memory is limited. As we code more advanced programs without the use of libraries such as the CS50 library, we’ll have to be careful about memory allocation and freeing memory to make sure our program doesn’t crash or do worse things, such as corrupt another external program.
While the concepts weren’t that difficult, this is the first time the syntax really confuses me and throws me off guard. Specifically, the code related to files, and you’ll see that I had some trouble with one of the problem sets due to this.
Filter, Pretty Simple Concepts
Filter was pretty easy. Mind that this week, I only did the less comfortable problem for Filter. Usually, I do both the less comfortable and the more comfortable problems to improve my programming skills. Though, I didn’t this week for a pretty stupid reason.
Both files used the exact same name. If I implemented the more comfortable version of Filter, I would have to overwrite the old version or change the names. And I didn’t want to get into that because there might be code within the file that depends on file names. I don’t know if that’s true, but that’s why I didn’t do the more difficult Filter problem.
I’m not missing much, though. I looked over the more comfortable version of Filter, and it’s basically the same except with hexadecimals and highlighting edges instead of a sequoia filter.
And the coding behind Filter is pretty straightforward. In general, you’re just putting each individual pixel into formulas the course gives you to get the new filter results.
Recover Is Difficult If…
Recover was the hard part of this week. Recover is difficult if you don’t understand how to use the functions related to files. That was my problem.
The concepts were pretty simple. All you had to do was follow the walkthrough’s pseudocode. But the actual implementation of the pseudocode was challenging.
To figure out the problem, I had to watch a few walkthroughs to get through it. Working with the new code is definitely something I need to work on. Hopefully, I won’t have to work with pointers or even the C programming language too much in the future.
I’ll Push Myself To Do More
And that was Part 5 of The Harvard CS50x Adventures. I will put more work into learning to code and will be back soon with Part 6 of The Harvard CS50x Adventures. It’s time to dive into data structures!
If you have any questions or comments, don’t hesitate to leave them down below. Also, make sure to check out Part 4 of The Harvard CS50x Adventures if you haven’t already. Have a great day!