The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 3 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Need help with create favorite function.
Also all other function are working
10/17/2016Advanced C Programming :: HW10https://engineering.purdue.edu/ece264/16au/hw/HW101/9Due 10/21Advanced C ProgrammingAutumn 2016 :: ECE 264 :: Purdue UniversityHomeScheduleSyllabusResourcesStandardsScoresLinked lists #3GoalsThis assignment builds on your work onHW07,HW08, andHW09with linked lists. The goals are as follows:1. Learn how to keep data separate from containers2. Prac偆ce designing algorithms and data structures3. Prac偆ce using code that uses the following:a. linked listsb. structures for data encapsula偆onc. dynamic memory (i.e., malloc)d. struct ini偆alizer syntax (C99)OverviewYourpick_leader(…)inHW07implemented thepluralitysystemof vo偆ng: voters choose one candidate astheir favorite, and the candidate with the most votes wins. This is the system used in most elec偆ons in theUnited States.Plurality has an obvious problem: a candidate can win even if they are not preferred by a majority (>50%) of thevoters. This has been seen in numerous elec偆ons.For this assignment, you will modify your code fromHW09to follow theinstant‐runofmethod of choosing awinner. Each person choosesone or morefavorites. If one candidate receives over 50% of the vote, then thatcandidate is the winner. Otherwise, the candidate with the fewest number of votes is eliminated fromconsidera偆on, and the process is repeated.ExampleIn this team, each person has given a list of favorites. For example, Kami's top choice is Fujita. If Fujita doesn'twin, then she would prefer Baba. If neither Fujita nor Baba wins, then she would prefer Azuma. Kami has noaddi偆onal preferences.Round 1Azuma's favorites: Ihara, Azuma, EdoBaba's favorites:Azuma, Ihara, EdoDoko's favorites:Doko, Azuma, Hata, EdoEda's favorites:Doko, Azuma, BabaFujita's favorites:Azuma, Doko, BabaGima's favorites:Doko, Azuma, BabaHata's favorites:Ihara, Azuma, BabaIhara's favorites:Doko, BabaKami's favorites:Fujita, Baba, AzumaMaeda's favorites: Gima, AzumaDoko gets 4 votes (40%) but fails to win a majority. Azuma and Ihara each get 2 votes (20%). Fujita and Gimaeach get 1 vote (10%). Fujita and Gima are eliminated since they have the fewest votes.Round 2Azuma's favorites: Ihara, Azuma, EdoBaba's favorites:Azuma, Ihara, Edo