Well, Prof. David Malan liked my tweet so...
A volcano. A plume of smoke roars up into the steel grey sky. Angela walks towards you, framed in red fiery light, carrying - on her shoulders - the dead carcass of a hash table of linked lists. This is @cs50 pset5! She raises her C sword and frees some more memory. "Raaaah!"— Angela Ambroz (@angelaambroz) March 20, 2018
I'm so pleased.
Data structures are complicated
I'm also pleased because I feel like I reached peak CS50 this past week. Where by "week", I mean "month". Life happened, but this was also the densest part of the course and I wanted to take my time. It was hard, brain-sweaty work and it was awesome. And it was over far too soon. I want to take a full course on data structures and algorithms, because the ~6 hours of struggle on problem set 6 were definitely not enough. Definitely need more hours on this. MORE HOURS.
For my problem set, I implemented a hash table with linked lists, and fumbled through
malloc() (nightmare of
malloc()!) and freeing memory. Apparently, I free up too much memory every time.
valgrind (a command-line utility which checks your C program for any memory leaks) usually complained that I had allocated space for 3 things and freed 5. Woops. I JUST WANT TO BE SURE.
These "Dense Materials, Ahoy!" lectures are longer (1hr 45min) than the earlier weeks. The "shorts" - additional videos where a CS50 staff member goes in more detail - are, cumulatively, another ~2 hours or so. This is a lot of content! It takes forever, but - again - I loved it and feel hashtag-blessed that we have this resource available, for free, on the intertoobs. I really agree with this gushing Reddit post, too - the problem sets are challenging grinds, but they're not impossible, and I feel like I learn a lot from them.
- Welp, now I know how to define my own data types in C with
typedef struct. Wooo hooooo.
- Learned about a bunch of data structures: linked lists, hash tables, tries, stacks, queues. Only implemented a hash table with linked lists, and still feel shaky on pointing my pointers to the right places. I wanted to try a trie, but - at 6-hour pset mark - I was pretty pooped.
Looking ahead: Lectures & psets
Looking ahead: Final project thoughts
After the lectures and psets, there is the final project. I found this book the other day - Build Your Own Lisp - and am thinking of using it in my final project, since I've always wanted to know how "higher-level" programming languages work. e.g. The most widely-used implementation of Python is written in C, and I was always like, "But what does that mean?"
I'm also interested in investigating the intersection between natural and programming languages: specifically, every programming language I've seen is written in English. I wonder if there's any effect, then, of how all our technology is written in English - e.g. is there a Sapir-Whorf effect where even fundamental computer science paradigms would be re-envisioned if the higher-level languages had been written in, say, हिंदी ?
(My prior is actually, no, the effect is probably limited, since low-level programming languages are just math and logic, which are a universal language. It's all binary underneath, after all. Maybe there'd be some effect as you go further up the levels of abstraction, e.g. Python, Ruby, etc.)
Anyway, I'm really looking forward to more CS50!