How to run a Tideman election - C Programming

  Рет қаралды 10,344

BogdanBudaca

BogdanBudaca

Күн бұрын

Пікірлер: 39
@BogdanBudaca
@BogdanBudaca 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
@kasperjeppesen4907
@kasperjeppesen4907 4 жыл бұрын
Amazing! :) It really helped understand quite alot of the problem. Thank you for your awesome videos!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Really glad to hear, thank you, cheers
@green-coder
@green-coder 4 жыл бұрын
hello sir "check50" reported an error with "sort_pairs", the rest were all green! how i fix this error please thanks
@josephsozio7316
@josephsozio7316 4 жыл бұрын
Thanks for the help on this one! Recursion really melts my brain :) Quick question - I noticed this function prototype used v as a variable name for the int parameter but in the implementation you used i bool check_cycle_util(int v, bool visited[]); vs. bool check_cycle_util(int i, bool visited[]){} Looks like it still compiled fine for both you and me. I am still learning C, do you know why this compiles without complaining about the above mismatch?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hi Joseph, same for me, it will get easier with further iterations :) Good catch, cheers, didn't even notice, turns out the declaration and implementation can have different argument names, just need same order and data types, found this stackoverflow.com/questions/39224689/different-parameter-name-in-function-prototype
@waltertaju
@waltertaju 4 жыл бұрын
Great help Bogdan! But the "check50" reported an error with "sort_pairs", the rest were all green! Did you have the same issue? Suggestion: upgrade the mic, I missed some of the words you said. Thanks a ton!
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Thanks Walter, cheers. Hmh, it worked for me in the end. Sorry about the audio, had my AC on cause it was super hot and my mic was fighting the background noise, with my voice as collateral.
@waltertaju
@waltertaju 4 жыл бұрын
@@BogdanBudaca Alright. Will keep debugging my code.
@green-coder
@green-coder 4 жыл бұрын
@@waltertaju how do you fix this error please ?
@emmafrankly
@emmafrankly 4 жыл бұрын
So on the actual ballot for the voters, it's just simple ranked voting? "Rank the candidates by preference," with mandatory ranking (i.e., have to choice a first choice, a second choice, and a third choice in a 3-candidate instance)?
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Yup, that's right
@emmafrankly
@emmafrankly 4 жыл бұрын
@@BogdanBudaca Great, thank you!
@mihirpatel9941
@mihirpatel9941 4 жыл бұрын
Thanks man loved it
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Cheers Mihir
@MKSundaram
@MKSundaram 3 жыл бұрын
I am getting one frown face that is for print_winner prints of election when some pairs are tied print_winner did not print winner of election. could yoi please help me?
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Oh the code on Github might help get a hint if you want to check it out
@MKSundaram
@MKSundaram 3 жыл бұрын
@@BogdanBudaca - Thanks. God bless you :-)
@MKSundaram
@MKSundaram 3 жыл бұрын
I found that my print statement was inside the if(locked) block and that's why the error. I placed it after the inner loop and inside the outer loop. It worked. Thanks. :-)
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Oh great, glad to hear you spotted the issue
@MKSundaram
@MKSundaram 4 жыл бұрын
I'm confused about the rank variable. I'm not able to trace the source of input to int rank. From where does it take its argument?
@MKSundaram
@MKSundaram 4 жыл бұрын
Finally, I traced the source of rank, it is variable 'j'. Now I don't understand preferences array. How it gets populated and how does the increment operator helping in populating the array.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hey there, we look at the ranks array and compare candidates two by two; the candidate at index 0 for example beats candidate at index 1, being the first choice. With this info we go into the preferences matrix and update it at index [ranks[0]][ranks[1]], thus marking +1 for the preferred candidate over the less preferred one.
@MKSundaram
@MKSundaram 4 жыл бұрын
@@BogdanBudaca Oh! That was so simple, how did I missed that. Thanks.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Glad it helped
@stantonreddy6276
@stantonreddy6276 6 ай бұрын
@BogdanBudaca i appreciate yr videos, but what set u aside from the others, is the way you explain things, unfortunately in this video, the audio is bad, yes i can see the code, but its missing yr explanation which is the most important part😞
@organizedchaos4559
@organizedchaos4559 4 жыл бұрын
I usually really like your videos for these problems as you do a really good job on explaining it but I think for this one you leave me more confused.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Yup, not really happy about the audio, was hoping the explaining that was audible and the code would help a bit more
@steveyee5775
@steveyee5775 4 жыл бұрын
Wish this was watchable man but the sound is more painful and frustrating that tideman itself
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Oh yup, agreed, might look at a redo soon, but hope the code helps
@_Silviu
@_Silviu Жыл бұрын
Plâng de 2 zile la problema asta😂 Sper că e cea mai grea de la CS50, fiindca altfel îl termin la anul😜 Dacă nu reușesc pana la finalul săptămânii, revin😁
@BogdanBudaca
@BogdanBudaca Жыл бұрын
Da, a fost f dificila si pt mine, inca ma bantuie 😆
@vladh2557
@vladh2557 3 жыл бұрын
Bogdan thanks for the video, but please do something with the sound. A lot of the time it breaks up
@BogdanBudaca
@BogdanBudaca 3 жыл бұрын
Yup I know, sorry about that, didn't get to re-shoot this one yet, hope the code helps though
@soulcrystals
@soulcrystals 4 жыл бұрын
Thanks for the effort and the good intention but with this sound I just cannot watch a video for 52min... information gets lost while i am focusing on what you say but I miss bits of it.
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Hey there, yup, it's pretty bad, been thinking about having another go at it but I'm a little caught up for a few weeks, I hope that at least the code helps some
@DigitalDivotGolf
@DigitalDivotGolf 3 жыл бұрын
If you were to make another video and voice over this one you could explain with good quality sound but this is unlearnable. Thanks for the video but it’s more of a distraction trying to guess/understand what you said than it’s worth watching.
@Venezuelangel
@Venezuelangel 4 жыл бұрын
sound is terrible
@BogdanBudaca
@BogdanBudaca 4 жыл бұрын
Yup, sorry about that, it was hot and had the AC on, the mic kept cutting my voice along with the background noise
How to run a plurality election - C Programming
23:01
BogdanBudaca
Рет қаралды 5 М.
Andro, ELMAN, TONI, MONA - Зари (Official Music Video)
2:50
RAAVA MUSIC
Рет қаралды 2 МЛН
БАБУШКА ШАРИТ #shorts
0:16
Паша Осадчий
Рет қаралды 4,1 МЛН
5 Simple Steps for Solving Dynamic Programming Problems
21:27
Reducible
Рет қаралды 1,1 МЛН
How To Think Like A Programmer
1:00:07
Coding Tech
Рет қаралды 2,1 МЛН
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 916 М.
How to run a runoff election - C Programming
21:00
BogdanBudaca
Рет қаралды 9 М.
Reinforcement Learning - My Algorithm vs State of the Art
19:32
Pezzza's Work
Рет қаралды 153 М.
1. Algorithms and Computation
45:39
MIT OpenCourseWare
Рет қаралды 1,5 МЛН
How I program C
2:11:32
Eskil Steenberg
Рет қаралды 801 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
Where Does Bad Code Come From?
42:21
Molly Rocket
Рет қаралды 212 М.