I thought algorithms were going to be difficult…welcome to memory and pointers! Once again, I’ve heard about these with extremely brief introductions, but now having to learn more indepth and apply? It was surely interesting and it mostly clicked after a while, but I hope not to have to deal with it in the future much! From my work place, I heard of memory leaks, heaps and NULL pointers, this part of the course put more of those concepts into a bit more context what they are. In a simpler way to explain them, pointers ‘point’ to a specific address of memory on your computer to use and each byte on your compputer and can return that information; this is important for a future problem set (recover).
Comparing the addresses, copying and swapping pixels was a common theme in the lecture and was used quite a bit in the problem sets as well. As mentioned way back in week 1 or 2, the removal of some training wheels occurred this week where get_int is part of the CS50 library, where scanf should be used instead. Similar with the ‘string’ data type is also part of this library preset and char *s is to denote the same.
This week’s problem sets were the most difficult, primarily filter. I adopted a cat about a month ago and have not been able to focus that much on the problem with the new routines and settling them into the house (still working on that!), but it’s gotten a little easier. With the problem set called filter, I had to reference quite a few walk throughs to understand how to approach some of the problem with scanning the pixels of an image to convert to grayscale, sepia, reflecting and blurring the image.
For recover, this one dove a bit more into pointers and the addresses they can utilize since it had to deal with images once more but recovering them if deleted. Turns out, jpegs have memory signatures and we’d check if certain images on an image card had a specific order of them to determine and copy them to a new file.
I found after this week’s work was done, I definitely prefer the problem sets that have you start out all the code yourself, rather than an existing file structure and starter code. This might be my lack of knowledge in C and some impatient-ness, but week 5 is the lack C week and onto something different finally!
week 5, data structures, onward!