How am I getting along with CS50? I completed the problem set on Week 4 Memory on Feb 23 but after starting a new job in March, progress on Week 5 Data Structures has been… sl… o… w… 🐢
I've had plenty weekends with good intentions and managing to take a crack at some progress, having an absolute blast with it, but also not getting any notable progress because by the time I was properly warmed up, it would typically be Sunday at 8 in the evening and time to get some dinner and ready for a new week. But some days off with no plans this summer and I found the time and energy to get properly started on problem set 5. This is last one using C before we move on to Python! 🐍
Interesting how the course designs the problem sets. For this one, you get some distribution code and guidance with the main architecture of the program. This means you can focus on the concepts — and there is no way you can manage to complete without understanding pointers, memory and hash tables.
typedef struct node
char word[LENGTH + 1];
struct node *next;
node; // Node in the hash table
const int N = 1; // Number of buckets (starting with one)
node *table[N]; // Array of node pointers
How to add data to my empty hash table? Allocate memory and store the address inside
node *n = malloc(sizeof(node));
One of the difficulties with spreading out my C programming efforts, is that I struggle to recall what I already learnt and keep needing to go back and revisit basic syntax. But lo and behold… 🥳 I do believe this program is currently
printfing addresses to show my first linked list is in business — which I am totally counting as a victory.
Next step; start looking at hash functions.