CS50 Problem Set 3 - Plurality Solution (Step by Step Walkthrough for Beginners)

Поделиться
HTML-код
  • Опубликовано: 26 дек 2024

Комментарии • 127

  • @semple888
    @semple888 2 года назад +62

    These walkthroughs help me so much,
    Can you please keep uploading the rest of the weeks of CS50.
    thank you so much for helping everyone.

  • @kevinplascencia1131
    @kevinplascencia1131 2 года назад +57

    I wouldn't be able to finish pset1 and pset2 without your help, in pset3 however, I was able to finish the first assignment all by myself and I watched your video to solve the 2nd assignment, I feel like I am getting better and you're helping me a lot, thank you so much.

    • @Jack_______oh
      @Jack_______oh 2 года назад

      By the first assignment do you mean the lab, or this problem?
      I still feel as lost on this one as I did with previous problem sets. I have a lot of pseudo code written out and have implemented some of it, but I get tripped up when it comes time to sort the data after the votes have been counted. If you figured that out on your own, props, because I am totally lost on it.
      Gonna watch this video to hopefully work it out.
      EDIT: Lol. This solution was much simpler than what I was attempting. Still so much to learn!

    • @Нива-ш7з
      @Нива-ш7з 2 года назад

      @@Jack_______oh yeah it always seem so easy after you realize the solution. I didn't know about nested loops so I couldn't do mario, but after the videos I went back to it and I could do it in minutes

  • @MrBobbtyGT
    @MrBobbtyGT 2 года назад +29

    These walkthroughs are extremely helpful. The way you write out the problems in a word document helps to visualize the actual code. Great videos

  • @desistarrecords
    @desistarrecords 2 года назад +7

    You're doing such a great job. Not having a CS background and still nailing the couree and teaching/helping others. It's such an achievement.

  • @oliviacolton3661
    @oliviacolton3661 2 года назад +14

    Still don’t understand what you get out of this, but you’re saving my life. Thank you!

  • @mitchschlesinger4326
    @mitchschlesinger4326 Год назад +6

    You do a great job explaining the "why" as well as the "how to." Keep up the good work!

  • @alliemiles5109
    @alliemiles5109 3 месяца назад +1

    This young man is the best on the net! He really breaks things down and makes them completely understandable! Thank you Rahul!!! I am sad that your last problem set walkthrough is this one. If I join your channel can I perhaps get access to subsequent walkthroughs?

  • @coltoneaston4621
    @coltoneaston4621 2 года назад +15

    21:45 bruh 😂

  • @a.iso.thirdgenerationstudios
    @a.iso.thirdgenerationstudios Год назад

    to put your thinking into words that I can understand is a mystery that only you have been solving. thank you.

  • @chidebrutechs
    @chidebrutechs 2 года назад +2

    I'm still in PSET1 but I love your explanations...they are on point, keep on the good work...you are unlocking many dreams...CS50 isn't for the faint-hearted, your push is welcomed wholeheartedly bro. Much love from KE

  • @iHaterzXD
    @iHaterzXD 2 года назад +4

    Dude 21:43 had me laughing so hard. Great video! I was able to get through updating the candidate vote count, but was unable to figure out that the "print winner" portion should be broken down in two steps. Your videos are extremely helpful, thanks so much for taking the time to create them.

    • @sahilvermaH
      @sahilvermaH 11 месяцев назад

      david malan handsome cs50 🤣🤣

  • @zaheer25
    @zaheer25 2 года назад +2

    I love how you walk through the problem. The main thing I have learnt from your videos is how to walk through the code and make sense of it. With Pset2 I relied a lot on your video. This time I tried to think the way you were thinking and got pretty far on my own. Thank you!

  • @gabsmary
    @gabsmary 2 года назад +8

    Cara, não desiste de fazer os vídeos, as explicações são maravilhosas.

    • @matheuslima793
      @matheuslima793 2 года назад

      Br tu acha em tudo quanto é lugar kkkk
      o mlk é pica nas aulas

  • @coffeemiss1150
    @coffeemiss1150 Год назад +1

    The best series of videos for CS50's problem sets since the explanations are from learners' perspectives. Thank you so much Rahul~

  • @austin9070
    @austin9070 2 года назад +1

    The sudo code you write in word document really help visualize the solution.....it need not let me look at the actual code....
    Great video 🤞

  • @martinhansen5521
    @martinhansen5521 4 месяца назад

    20:20 watch out for the small change from < to ; at line 85

  • @keithb0000
    @keithb0000 Год назад +1

    Our dude left us to become tiktok famous in his country. Thanks for all the help so far dude! Wish you completed the whole CS50 with us!

  • @ansh4131
    @ansh4131 4 месяца назад

    For the first time , i did some coding in project by myself in C , Thanks for the walkthrough , i could understand the concept and finally able to it.

  • @rebekahmenn2118
    @rebekahmenn2118 2 года назад +1

    I would not have gotten this code without your video. I still don't understand it entirely, but I definitely learned something. Thank you!

  • @Aripepe
    @Aripepe 2 года назад +3

    Thanks again for explaining it so well. We missed you man! :)

  • @eva3696
    @eva3696 Год назад +1

    A very professional and simple way of explanation of not simple things ( I’m a beginner) thanks to you I started to understand and even sometimes know what we need to do the next step and etc , a very pleasant voice and high quality of the video thank you for your efforts , your video I want to watch again and again 👍🏻

  • @louiejacobson552
    @louiejacobson552 8 месяцев назад

    Killer maine! You're a beast! Wish we had more of your videos explaining general topics like functions. Hope you're doing well out there.

  • @shayan4572
    @shayan4572 2 года назад +2

    It would be great if you continue uploading these videos

  • @bells5967
    @bells5967 2 года назад

    You have no idea how helpful and simple your help is. Thank you.

  • @brandonclark3530
    @brandonclark3530 2 года назад

    thank you, man. i was beginning to feel I cannot understand this. you're a good teacher

  • @ajaramillo1109
    @ajaramillo1109 Год назад

    Please keep uploading these walkthroughs they help so much! I understand it better when you explain it.

  • @shahdelsayed8090
    @shahdelsayed8090 2 года назад

    wooow tbh i never knew i could do it as a total beginner thank u soo muchhh

  • @austinjday3768
    @austinjday3768 2 года назад

    honestly this guy is my hero

  • @finbarharris7069
    @finbarharris7069 Год назад

    love the videos man, there so helpfull. This is the first week i was able to go ahed by myslef and solve the print_winner section. Keep it up x

  • @ricardo-hf6er
    @ricardo-hf6er Год назад

    come back for the rest of cs50!!
    us new coders need you!

  • @MichaelNealeYT
    @MichaelNealeYT 2 года назад

    Thank you for making these videos. I appreciate how you step through the expected outcomes and give some more explanation before showing your solution. I try to use your videos as a last resort and struggle as long as I possibly can.

  • @marwan9995
    @marwan9995 2 года назад

    thnks man you help me and make me understand more what i learnd in cs50.
    my english not that good but i understand your clean language.

  • @cristianm5658
    @cristianm5658 2 года назад +1

    thanks for these walkthroughs, it is helping me a lot to learn and you are the best!
    lol 21:45

  • @1d_4e32
    @1d_4e32 Год назад

    amazing vid as always so grateful for these rahul!

  • @QK_Engineer
    @QK_Engineer 2 года назад +1

    You’re the best bro! Keep up these videos they are so helpful!

  • @mynamehereforsure
    @mynamehereforsure 2 года назад

    Perfect timing, I was looking for your walkthrough for this pset a few days ago

  • @MrJaywhelan
    @MrJaywhelan Год назад

    loving this videos! how come you haven't added any more since?

  • @AlejandroDeLaRosa05
    @AlejandroDeLaRosa05 2 года назад

    thank you for all your videos! you have no idea how much they've helped me. Sometimes just semantics alone lead me to errors but you are able to explain concepts pretty well.

  • @fai9092
    @fai9092 Год назад

    thank you so much for the help throughout these courses

  • @tommybc
    @tommybc Месяц назад

    Your tutorials are great, thank you for making them. In this one, up to timestamp 19:43 you have this code for the for loop in your line 85: for (int i = 0; i < candidate_count < i++). This does not compile as it should be, (int i = 0; i < candidate_count; i++), but you don't explain that error in the code we watch you write in the body of the video. How come? Thanks.

  • @davidcottrell1308
    @davidcottrell1308 2 года назад

    Thanks..very nicely and thoroughly explained.....keep it up....

  • @parsahoseiniyan6397
    @parsahoseiniyan6397 2 года назад

    perfect. your videos are so helpful. and they help to think more logically

  • @libo8318
    @libo8318 2 года назад

    Please keep making man ! you are awesome

  • @yasminetabbech2490
    @yasminetabbech2490 2 года назад +2

    when he says " its very simple right " i want to jump out of a cliff , ITS NOT SIMPLE FOR BEGINNEEERS . hahah
    Thanks alot tho you are helping alot

  • @zuku4399
    @zuku4399 2 года назад

    thanks! it really helped me understand another way of solving the problem

  • @Split-Sanity
    @Split-Sanity 4 месяца назад

    Im here in 2024 and these videos have been great could you please finish the walkthroughs im struggling without your help I have watched all your walkthrough videos and I cant continue without these videos

  • @relaxation2018
    @relaxation2018 2 года назад +1

    hi will you make a video on problem set 4?

  • @courtneylynne1103
    @courtneylynne1103 2 года назад

    Your videos are so helpful! I hope you upload more soon 🙂

  • @henriquedelben
    @henriquedelben 2 года назад +1

    I was trying to implement a merge sort algorithm to order all candidates of the array by the number of votes each one had, but it turned out I'd need to create another function to implement the divide part and then another to implement the merge part, this way is really more simple and makes more sense in a real life type of occasion since in a pluralized vote, the number of cadidates wouldn't be much bigger than 10, so it wouldn't make the program slow or something

  • @liamfinn564
    @liamfinn564 2 года назад

    You should post more of these, man

  • @haiyihuang3299
    @haiyihuang3299 Год назад

    thank you so much! your explain is so helpful ! will you do more of these problem sets? :(

  • @bedstuy89
    @bedstuy89 3 месяца назад

    hey brother you are an absolute lifesaver. thank you for all your hardwork. any chance you can make a video on problemset 3 runoff? thanks so much
    peace be upoon you

  • @oluwatunmiseesther8832
    @oluwatunmiseesther8832 2 года назад

    You are the best though...keep it up bruv

  • @repp181
    @repp181 Год назад +1

    when I try to compile, I have an error on line 71 saying error: use of undeclared identifier 'i'
    if (strcmp(candidates[i].name, name) == 0) with the arrow pointing the [i]
    can someone help me ?

  • @leudisfit6001
    @leudisfit6001 Год назад

    amazing video

  • @shankarenputten952
    @shankarenputten952 2 года назад +1

    Plzzz release the walkthrough of the other problem set.
    I cant wrap my mind around pset3: runoff

  • @MagicalShizzz
    @MagicalShizzz 2 года назад

    awesome! thanks so much!

  • @Nonsense855
    @Nonsense855 Год назад

    thank u so much bro

  • @artgrantolli4790
    @artgrantolli4790 2 года назад +1

    yoo bro this was very helpful can u do a video on lab4 and problem set 4 aswell ?

  • @greenrbtsiqi
    @greenrbtsiqi 2 года назад +2

    For the bool vote function, why is the condition set as "i < candidate_count" instead of "i < voter_count"? I understand it as if the number of votes is smaller than the total number of voters, then it should keep on counting. If "i < candidate_count", then it seems to be counting the number of votes up to the number of candidates. For example, if there are 3 candidates and 7 voters, by using "i < candidate_count", it feels like we are counting only 3 votes. Please let me know your thoughts. Thank you.

    • @lakshay964
      @lakshay964 2 года назад +1

      The loop is to find if the vote submitted by the user is actually a valid vote or not so we run through every candidate's name and how many names will there be? Equal to the no. of candidates and not voters. Hope it helps

  • @justinzhou
    @justinzhou Год назад

    thank you

  • @SirMika9
    @SirMika9 Год назад

    Damn, you print_winner solution is nice. I did more complicated and it was so simple. I sorted the entire candidates array lol. But at least it worked and I am able to do sort function by mysefl, so I am happy :D I really like your way of thinking the problem to a simple solution on paper. I need to be better at that. Thanks for sharing your solution, so we can compare and learn more after we finished the problem ;)

  • @limweiloong8256
    @limweiloong8256 2 года назад

    hi bro will u be doing more ? this is really helpful and it makes it a lot easier for uws begginers. pls continue to help us out :D

  • @Everson_Code
    @Everson_Code 5 месяцев назад

    Thanks.

  • @الطيبعثمان-ظ6ف
    @الطيبعثمان-ظ6ف 2 года назад

    man where are you ,
    we are waiting for you

  • @courtneynel7433
    @courtneynel7433 2 года назад +1

    is line 85 correct? I'm getting a "plurality.c:85:46: error: expected ';' in 'for' statement specifier
    for (int i = 0; i < candidate_count < i++)

    • @andrewcraigbrown2933
      @andrewcraigbrown2933 2 года назад +3

      He made a mistake and edited out himself fixing it. '< i++' should be '; i++'

  • @otrongkhoa1544
    @otrongkhoa1544 Год назад

    I have expected you would have used some kinds of complex sorting algorithms like merge sort v.v. Are the trade-offs of time and space worth to implement these ?

  • @sereynavives1389
    @sereynavives1389 Год назад

    can you please do runoff and following weeks ! i need the help

  • @mannasingh1931
    @mannasingh1931 2 года назад

    thank u bro

  • @farrasdarysantosa8682
    @farrasdarysantosa8682 6 месяцев назад

    21:34 bro got humours

  • @arjaymarioncodilla6711
    @arjaymarioncodilla6711 2 года назад

    Thankyou!!

  • @tramthuy6190
    @tramthuy6190 2 года назад

    hi, what does it mean when the code is "return 2" in populate array of candidates?

  • @adebowaledollars1
    @adebowaledollars1 2 года назад +1

    Can someone pls explain
    (1)why my code was counting the vote of the first candidate only because I had the return true line outside of the curly bracket
    for(int j=0; j

    • @gatewaynippon
      @gatewaynippon 2 года назад +1

      return true; should be inside the curly brackets just below the candidates[i].votes ++ .
      This essentially means that the for loop will iterate all the candidates one by one and increment the vote count by one for the candidate whose name matches with the name the voter has voted for(hence a valid name) and return true and then for loop will keep on executing until all candidates have been iterated through.
      If you put return true; outside curly braces of if statement,
      the code iterates the first candidate ,counts its vote and then returns true (and moves on to next lines of code!) ,without iterating further.
      Hope this helps!

    • @adebowaledollars1
      @adebowaledollars1 2 года назад +1

      @@gatewaynippon thank you, this helps.

  • @desistarrecords
    @desistarrecords 2 года назад

    Please upload all.

  • @maxmccann3617
    @maxmccann3617 2 года назад

    For anyone else who was confused, argc DOES NOT need to be greater than 2 as he stated in the video. Argc needs to be equal to or greater than two. The program is designed to run with only one candidate. Also, in case you get an error when you compile, in the video, he fixed a type-o on line 85 without showing it.

    • @DallasKeana
      @DallasKeana 2 года назад

      which type o

    • @maxmccann3617
      @maxmccann3617 2 года назад

      @@DallasKeana should be a semicolon after candidate_count and no less than symbol.

  • @arnschoeny
    @arnschoeny Год назад

    if 'name' is the only parameter being passed to the function vote, how does it work that you can compare 'name' to 'candidate[i].name'. Is 'candidate.name' a global variable?

  • @agustin8160
    @agustin8160 2 года назад +3

    :( vote returns false when given name of invalid candidate
    vote function did not return false
    :( vote leaves vote counts unchanged when voting for invalid candidate
    vote function modified vote totals incorrectly
    Does anybody knows why this is happening?

    • @bookwormd8627
      @bookwormd8627 Год назад +2

      I know its been close to a year but I'm replying in case anyone else is having this problem.
      Both of your errors are connected, you're probably missing a return false line in the bool vote function:
      bool vote(string name)
      {
      for (int i = 0; i < candidate_count; i++)
      {
      if (strcmp(name, candidates[i].name) == 0)
      {
      candidates[i].vote++;
      return true
      }
      }
      return false;
      }
      If you don't have that line, the program counts a vote for an invalid candidate

  • @MohamMeD-kd8gj
    @MohamMeD-kd8gj 2 года назад

    please post all problem sets and labs please please

  • @Ls-yg4od
    @Ls-yg4od 2 года назад

    i was stuck cuz i was typing for (i = 0; i < strlen(name); i ++) and it wasnt working untile i tried for (i =0; i < candidate_count; i ++)

  • @jayfrayy2368
    @jayfrayy2368 2 года назад

    I'm like 90% done pset 3 runoff but I'm stuck on a few things are you going to be making a video soon?

  • @yahyasamet5499
    @yahyasamet5499 2 года назад

    nice brooo

  • @TheRealPlayer00
    @TheRealPlayer00 2 года назад

    Hey, did you stop with the tutorials? :(

  • @oluwatunmiseesther8832
    @oluwatunmiseesther8832 2 года назад

    Please do 'credit' pset 1 assignment, I'm stuck, I don't know what to do

  • @Izanagli
    @Izanagli 2 года назад +1

    it weird how i follow step by step and the IDE always says my "int = 0" is a fatal error.

    • @Izanagli
      @Izanagli 2 года назад

      line 71. the "[i]" comes up as an error please help

    • @luchiya_darkness
      @luchiya_darkness 2 года назад +3

      You can't assign(=) a value to a data type. You need to write which variable you are assigning 0 to. In your case, int i = 0, i is name of variable, int - just data type

  • @artiphoria
    @artiphoria 2 года назад

    Man, you're awesome and the idea of this program is ultimately stupid and unreasonable. As , how come I enter the names of the candidates, and also chose each number of elected candidate? I know it's for educational purpose, but reality counts.

  • @kousenmujawar2387
    @kousenmujawar2387 Год назад +1

    Can someone explain me this code
    !vote(name)

    • @gustavolopo8564
      @gustavolopo8564 3 дня назад

      Basically, this function receives the input through the question: 'Vote.'
      It then compares the input with candidates[i].name in a loop that runs for the total number of candidates participating. Whenever the comparison is true, you just need to increment candidates[i].vote.
      After this, the vote function will return to the main function, increment the counter i, and perform the same process for the next input from the user.

  • @jonniejonnjon
    @jonniejonnjon 10 месяцев назад

    why do they use "return 2" instead of "return 1"?

    • @darrelljustice45
      @darrelljustice45 9 месяцев назад

      From my understanding, anything other than "return 0" is used to show failure, and each different return/exit value, such as return 1 or return 2, shows different parts in code that there was a failure or invalid input.

  • @Domlalvaro
    @Domlalvaro 2 года назад

    watching you making your exercise, Im fell afraid off just like: "My God, Will I ever learn and begin to understand this?"😥

  • @salahammar1521
    @salahammar1521 Год назад

    just my question is i cant do this alone i have to watch walkthroughs to be able to understand is that normal ???

    • @freddyhernandez8457
      @freddyhernandez8457 Год назад +1

      Yes, it's normal!! but you have to have a growth mindset, go ahead and spend hours trying, then watch a video and go through another part on your own, in my case, it took me 2 hours to do this exercise, and I came here to realize that I could improve myself code and see how to use better logic.

  • @joeyestrada9071
    @joeyestrada9071 2 года назад

    No matter what I keep getting "use of undeclared identifier i" and it's so annoying...

  • @TalkThisOut
    @TalkThisOut 2 года назад +1

    noice!

  • @RohanPadmukh-y9g
    @RohanPadmukh-y9g Год назад +1

    my code all good but just one mistake i placed one comparison operator incorrect '' 😂😂😂😂😂😂

  • @barboodG
    @barboodG 2 года назад

    Bro where is runoff

  • @ashleygrant6370
    @ashleygrant6370 2 года назад

    where'd you go my friend lab4 is murder and I need your genius brain to hold my hand through this mess

  • @ahmademad1
    @ahmademad1 2 года назад

    where are you now my friend

  • @ahmdfayzkaka
    @ahmdfayzkaka 3 месяца назад +1

    // Print the winner (or winners) of the election
    void print_winner(void)
    {
    int max_votes = 0;
    // First pass: find the maximum number of votes
    for (int i = 0; i < candidate_count; i++)
    {
    if (candidates[i].votes > max_votes)
    {
    max_votes = candidates[i].votes;
    }
    }
    // Second pass: print the names of all candidates with the maximum number of votes
    for (int i = 0; i < candidate_count; i++)
    {
    if (candidates[i].votes == max_votes)
    {
    printf("%s
    ", candidates[i].name);
    }
    }
    }

  • @akaa2007
    @akaa2007 2 года назад

    NOO PLEASE MAKE WALK THROUGHS FOR THE REST OF THE PROJECTSSS

  • @abdulaikamara2471
    @abdulaikamara2471 Год назад

    posting your Github account would be highly grateful, thanks

  • @JacoboKungaApito
    @JacoboKungaApito 2 года назад

    i love you

  • @arzamas1826
    @arzamas1826 2 года назад

    big like just for the picture with Trump ))