How to run a runoff election - C Programming

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

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

  • @BogdanBudaca
    @BogdanBudaca  3 года назад +3

    If you enjoyed the video and what I am doing on this channel, consider buying me a warm cup of coffee ☕❤️
    www.paypal.com/donate?hosted_button_id=R8EXVLT5HFBYE

  • @ernestocosentino9241
    @ernestocosentino9241 4 года назад +6

    thank you this is hard for someone who has never coded before its very time. however, when you explain everything makes more sense when you explain. thank you

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

    After watching the highest viewed videos @8:29 this guy is literally the only person on youtube that i watched who explained this section as if you were a student and didn't assume you know every single detail and process. well done and god bless you, i am now subscribed!!!

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

    I really love the way you explain your logic, and then don't assume it is obvious. I like how you hope we were able to follow along instead. You seem like a genuinely nice guy. Thanks, Bogdan.

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

      honestly!!! best explanation i've seen. ppl explain things on youtube and assume you know everything, dude if i knew everything why would i need an explanation?

  • @arjunmongia3498
    @arjunmongia3498 4 года назад +5

    this was so helpful. you actually explained it well unlike the other coders. thanks.

  • @kasperjeppesen4907
    @kasperjeppesen4907 4 года назад +3

    Amazing! :) The video's are perfect to learn from, when I have done the assignments myself. I always learn new things from your video's! Great content!

  • @dzondoe3842
    @dzondoe3842 4 года назад +4

    concise and clear; thanks man!

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

    Hello everybody, just for future references: While making the cs50 Algorithms problem set, the system showed me an error. This is because the tabulate function is not completely right. I changed the i < candidate_count into j < candidate_count. Then everything worked just fine.

  • @dustinclark5620
    @dustinclark5620 3 года назад

    The way I did it was way more complicated. Thanks for showing a more clear version.

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

    Sir, you explained it perfectly. It was very easy to understand. Thanks 😊

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

    this was really helpful to understand. I tried to solve it by myself and then compared it with your solution. The review of the whole solution explaining how all parts connected to each other helped a lot. Thank you so much, man. You definitely deserve some coffee tips and you'll get them soon :). Pls, keep posting the problem videos.

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

    Bogdan, thank you for the video! It's very helpful unravelling this problem. For me personally it was a little fast to keep up. It would help if you type out all code instead of copy paste loop lines to create moren time to follow along, and if you'd take more time to scroll up and down when going from functions at bottom to main part of the code to explain what's happening. I hope my feedback is useful to you. Keep it up!

    • @BogdanBudaca
      @BogdanBudaca  4 года назад

      Hi, sure, this is valuable to me, thank you for the feedback

  • @daraudobong7195
    @daraudobong7195 4 года назад

    at 11:51 on your screen we can see that {for (int j=0; i < candidate_count; j++)} instead of {for (int j=0; j < candidate_count; j++)}

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

      Thank you, Dara, great catch, I've corrected that in the code on Github

    • @daraudobong7195
      @daraudobong7195 4 года назад +1

      BogdanBudaca great!

    • @daraudobong7195
      @daraudobong7195 4 года назад +1

      I was wondering why you equates least votes to voter count also, swing as the voter count is a fixed number, and doesn’t relate to the minimum votes

    • @daraudobong7195
      @daraudobong7195 4 года назад +1

      also how come you used least votes as your integer and not just min?

    • @BogdanBudaca
      @BogdanBudaca  4 года назад

      That is just what I initialize it to and then changing it to the lowest number as we loop

  • @EmeraldGamingNewz
    @EmeraldGamingNewz 4 года назад +1

    I have a question for the find_min function. You returned the value of least_votes outside the closed curly braces. Why not put it right after least_votes = candidates[i].votes < least_votes. by you putting it outside wouldn't that mean that the function would only return the voter_count if the condition (!candidates[i].eliminated && candidates[i].votes < least_votes) is not met?

    • @BogdanBudaca
      @BogdanBudaca  4 года назад

      Hey there, that's a good point, thank you, however only updating least_votes in the check allows us to keep iterating until we find the least existing number of votes, and stop only then, instead of returning on the first hit. We initialize it with the max possible number of votes and keep deducting, and the if check would always hit.
      Pretty sure it's not the best way to do it however, please feel free to play with it and point out any refactoring you'd see fit, cheers.

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

    as usual your uploads are helpful. could you help me with preferences array? I am completly confused about it, how it is managing to store the voters and ranks. that is when used in bool vote function. Thanks :-)

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

      The main thing it does is help us identify and match by name, the candidate passed as the argument, in the candidates array, and get the index. We loop through the candidates array, and once there's a match on the name, we further use that index.
      With that index, we use the other two arguments which help us navigate the matrix, we go to the position they indicate (voter = row & rank = column), and we store that index from above there to populate the matrix, and so on for each vote.
      Hope this helps a bit

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

      @@BogdanBudaca Thanks. somewhat I am getting the idea of the array.

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

      What I find really useful for me, is just slowly going through the code and each iteration in my mind or on paper, pass some values and go through the flow to see what the code does, or in reverse what I would need it to do

    • @MKSundaram
      @MKSundaram 4 года назад +1

      @@BogdanBudaca very practical approach. will practice the same. Thanks :-)

  • @mariajenny9960
    @mariajenny9960 4 года назад +1

    hi, i had a question. Whats's the use of char name[50]? what does it do

    • @BogdanBudaca
      @BogdanBudaca  4 года назад +1

      Hi Maria, that is a char array, used this one to store a name. (C doesn't have the string datatype)

    • @mariajenny9960
      @mariajenny9960 4 года назад +1

      @@BogdanBudaca thank you

  • @atif_ali10
    @atif_ali10 3 года назад

    I have a question. In the tabulate function, line 152, wouldn't that operator '!' make the condition true since candidates[i].eliminated was set to false at the start of the code (line 56)? Any help in understanding this would be greatly appreciated. Thanks. :)

    • @BogdanBudaca
      @BogdanBudaca  3 года назад

      Think the eliminate() function and line 120 in the while loop take care of updating that, they just all start as 'not eliminated'

  • @davidallsopp4030
    @davidallsopp4030 4 года назад +1

    Great work! Thank you!

  • @forest3064
    @forest3064 4 года назад

    Alice is index 1 in the argument vector, since the ./runoff would be index 0

    • @BogdanBudaca
      @BogdanBudaca  4 года назад

      Hi, yes that's correct, thank you

  • @fallofmanbrand
    @fallofmanbrand 4 года назад +1

    amazing video

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

    thank you 🥰

  • @daraudobong7195
    @daraudobong7195 4 года назад +1

    Thank you!

  • @mihirpatel9941
    @mihirpatel9941 4 года назад +1

    We need tidemen method of voting in the next video in c language 😀

    • @mihirpatel9941
      @mihirpatel9941 4 года назад +1

      Hey when will you post tideman

    • @BogdanBudaca
      @BogdanBudaca  4 года назад +1

      Hi Mihir, I had a bit of vacation and I'm still working on tideman, hope to have that soon

    • @mihirpatel9941
      @mihirpatel9941 4 года назад

      How much more time for tideman🤔🤔😢