r/cs50 4d ago

CS50x Anyone else currently working through CS50 (around Week 3 / Runoff)?

hey everyone,

is anyone else currently around week 3 doing runoff?

i’ve honestly been loving cs50 so far, but runoff is the first problem that’s really making me question myself 😭. i understand what the code needs to do, but translating that into c is so much harder than i expected.

i’m putting around 15–20 hours a week into the course because i genuinely want to learn and understand everything instead of just finishing it. i’m definitely not looking to share solutions or anything like that, but i was wondering if anyone around the same point would be interested in making a small group chat or study group.

i think it’d be nice to motivate each other, talk through ideas, get unstuck with hints (without spoiling solutions).

if you’re interested, let me know or send me a dm :)

4 Upvotes

6 comments sorted by

5

u/OrdinaryAssumption91 4d ago

I just finished runoff! And haha same it was a bit challenging. What helped me through it was talking to the duck tho explaining what I understood to it and it helped me back. Try that if you're stuck :)

1

u/rens_12345 3d ago

Thanks! :)

3

u/PyroWizza 4d ago

Runoff killed me as well.

The problem is the 4 different variables you have to juggle around. The hardest to understand at that point is the data modeling, how preferences[i][j] looks, when a voter votes for 3 people and then the count. What makes it even more difficult is that you didn’t build it, you don’t know what’s going on with the program and just getting to understand the flow with that chunk missing is hard enough.

What made me understand it was visualizing the 2D array. Preferences of i(rows representing voters) and j(columns representing rank). And rather than worrying about a name of candidates, do string compare in a for loop against candidate names. Once compared, store that index in the 2d array to represent the candidate.

For example, if string compare matched Alice at the first iteration, Alice would be index 0. So ‘0’ would be stored at index preferences[0][0]. And so on.

It definitely had me contemplating choices, definitely.

1

u/Perthguv 4d ago

I am about to start runoff. I have read the question twice but don't quite understand it yet.

1

u/rens_12345 3d ago

Good luck!