I want this in C programming   Phase 1 Each person eligible to win is placed in one of G groups. For each group, a process is used to narrow down the possible number of winners. The process is as follows:Let a group initially start with p people. We can number the people within a group from 1 to p and assume they are arranged in a circle(circular linked list), with 1, then 2, ..., then p, followed by 1. Each group has its own skip number, s, and its own threshold number, t, where t< p. To eliminate some people in a group from possibility of winning the lottery, start at the person labeled 1 and skip over speople in line. Then, remove the following person. (Thus the first person removed is always person number s+1.)Then repeat the process. Since the line is circular, once you pass the highest numbered person left in line, you'll continue to the lowest numbered person left in line. Continue eliminating people in this fashion until there are precisely t people left.   Phase 2 Of all of the people left, the winner of the lottery will be the lowest numbered person from any group. If there are multiple people from different groups with the same lowest number, then the person from the lowest group number is chosen as the lottery winner.The state started forcing people to come out and form lines doing the process as described, but this was extremely time consuming and they got many complaints from the losers who were forced to stand out in a big hot field for many hours before they got eliminated Now, the state has decided to hire you to simulate the process and determine who the winner will be without actually forcing all participants from standing around in circles!   The Problem Given a list of the number of groups, the initial sizes of each group, the skip value for each group and the threshold value for each group, determine the winner of the lottery (group number and person number).In addition to determining the lottery winner, you must print a log for each group of which people get eliminated (in the order that they are eliminated from contention of winning the lottery.)   The Input(to be read from standard input) The first line will contain a single positive integer, n(n≤ 25), representing the number of input cases to process.The first line of each input case will contain a single positive integer G(G≤10), representing the number of groups for the lottery selection.The following G lines will each contain information about each of the G groups. The ith of these lines will have information about group number i(1≤i≤G). The ith of these lines will have three space separated integers: pi(2 ≤pi≤10^5), si(0 ≤si

Question
I want this in C programming
 
Phase 1
Each person eligible to win is placed in one of G groups. For each group, a process is used to narrow down the possible number of winners. The process is as follows:Let a group initially start with p people. We can number the people within a group from 1 to p and assume they are arranged in a circle(circular linked list), with 1, then 2, ..., then p, followed by 1. Each group has its own skip number, s, and its own threshold number, t, where t< p. To eliminate some people in a group from possibility of winning the lottery, start at the person labeled 1 and skip over speople in line. Then, remove the following person. (Thus the first person removed is always person number s+1.)Then repeat the process. Since the line is circular, once you pass the highest numbered person left in line, you'll continue to the lowest numbered person left in line. Continue eliminating people in this fashion until there are precisely t people left.
 
Phase 2
Of all of the people left, the winner of the lottery will be the lowest numbered person from any group. If there are multiple people from different groups with the same lowest number, then the person from the lowest group number is chosen as the lottery winner.The state started forcing people to come out and form lines doing the process as described, but this was extremely time consuming and they got many complaints from the losers who were forced to stand out in a big hot field for many hours before they got eliminated Now, the state has decided to hire you to simulate the process and determine who the winner will be without actually forcing all participants from standing around in circles!
 
The Problem
Given a list of the number of groups, the initial sizes of each group, the skip value for each group and the threshold value for each group, determine the winner of the lottery (group number and person number).In addition to determining the lottery winner, you must print a log for each group of which people get eliminated (in the order that they are eliminated from contention of winning the lottery.)
 
The Input(to be read from standard input)
The first line will contain a single positive integer, n(n≤ 25), representing the number of input cases to process.The first line of each input case will contain a single positive integer G(G≤10), representing the number of groups for the lottery selection.The following G lines will each contain information about each of the G groups. The ith of these lines will have information about group number i(1≤i≤G). The ith of these lines will have three space separated integers: pi(2 ≤pi≤10^5), si(0 ≤si<pi)and ti,(1 ≤ti<pi), representing the number of people in group i, the skip number for group i, and the threshold for group i, the number of people who will remain for contention to win the lottery after Phase 1 finishes for that group.The sum of si(pi-ti) over all groups will be 10^7or less. (This means that over all groups, as you simulate Phase 1, you won't have to move forward from node to node more than 10^7times.)
 
The Output(to be printed to standard out)
For each group, print the following header on a line by itself: Group#x:
where x is the 1-based number of the group.Follow this with pi-ti
integers, one per line, representing the people eliminated from contention of winning the lottery in the order in which they were eliminated.Print the information for each group in order by group number. Don't put any blank lines between the output for different groups.Follow this with a single line in the following format:
Lottery winner is person k from group g.
where k is the number of the person (1-based) and g is the group number (also 1-based) of the person who was selected to win the lottery.The total output for all cases won't exceed 10^6lines.
 
Sample Input
1
5
10 2 2
8 1 1
7 2 3
5 1 3
9 1 4
 
Sample Output
Group #1:
3
6
9
2
7
1
8
5
Group #2:
2
4
6
8
3
7
5
Group #3:
3
6
2
7
Group# 4:
2
4
Group #5:
2
4
6
8
1
Lottery winner is person 1 from group 2.
 
Implementation Restrictions/ Run-Time/Memory Restrictions
Although there is a much faster way to get the final answer, you must implement a linked list of integers to simulate the elimination process for each group.You must actually "walk" around the linked list, going node by node, to do the eliminations.You must write standard linked list functions (insert, delete) that operate on arbitrary circular linked lists. you will be able to obtain a pointer to the node to delete (and/orthe node before the one to delete).4. Your code must be modular. For each group, the same set of functions should be called, and these functions should in turn call the same linked list functions. You must free all dynamically allocated memory at the appropriate time during execution. (Memory for nodes representing all people eliminated during phase 1 should be freed as soon as it's determined that person is eliminated. Memory for nodes representing people making it past Phase 1 should be freed at the very end of the processing of each case.)

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Statement of stockholders' equityScott Lockhart owns and operates AAA Delivery Services. On January ...

A: Ending balance of Equity = Beginning v + Net income - dividend paid 

Q: The world record for the hundred meter dash is 9.58 s. What is the corresponding average speed in un...

A:  

Q: Neptune Corporation borrowed extensively when interest rates were low. Now the firm wants to decreas...

A: Whenever a corporation requires additional funds to raise capital for supporting its financial needs...

Q: 1. Two positive charges of 1 mC and 10 mC are separated by a distance of 10 m. Find the direction an...

A: Click to see the answer

Q: For a story she is writing in her high school newspaper, Grace surveys moviegoers selected at random...

A: There are two categorical variables which are rating and age. Rating has 2 types which are thumbs up...

Q: Question 5 Sugar gliders and Northern flying squirrels are mammals that have many morphological simi...

A: "Since you have asked multiple questions, we will solve the first question for you. If you want any ...

Q: An aluminum atom has a mass of 4.48 x10 -23 g and a small airplane has a mass of 5000. kg. Use this ...

A: Avogadro's number is the number of units in one mole of any substance equal to 6.022×1023. The units...

Q: A student needs to run 3.2 km to get to school. If the student can run 55 mi/hr how many hours will ...

A: Click to see the answer

Q: Andy is disgusted by the plate of crickets the chef places in front of him. He immediately pushes th...

A: Answer 1. The attitudinal component tells about the feeling of an individual toward any situation an...

Q: . Water at the top of Horseshoe Falls (part of Niagara Falls) is moving horizontally at 9.2 m/sm/s a...

A: Click to see the answer

Q: hich 3 lists will she find on the All lists window?(Select all that apply)

A: List that will appear : 1) Chart of Accounts 2)Payment Methods 3)Vendors 4) All Transactions  

Q: List the CPT code verified in the CPT Tabular List.  List the HCPCS code verified in the HCPCS Tabu...

A: CPT Code:    Current Procedural Terminology is the full form of CPT. These are numeric codes assigne...

Q: Journal entries and trial balanceElite Realty acts as an agent in buying, selling, renting, and mana...

A: "Since you have asked multiple sub part question we will solve the first three sub part question for...

Q: Consider the processWords method. Assume that each of its two parameters is a String of length two o...

A: Method A method is defined as the part of the code which only executes or runs only this method is c...

Q: Kevlar epoxy is a material used on the NASA space shuttles. Strands of this epoxy were tested at the...

A: Click to see the answer

Q: Quick Stop Fashion House produces "fast fashion" clothes that represent the current fad. In the fore...

A: Price sensitivity correlates to how much demand increases as the price level of a product or service...

Q: You're trying to isolate limonene, an oil found in grapefruits which can be used to make medications...

A: Thin Layer Chromatography is one of the chromatography technique used to isolate non-volatile mixtur...

Q: Your analysis of Moen Corporation's fixed asset accounts at year end reveals the following informati...

A: Classified balance sheet : The main elements of balance sheet assets, liabilities, and stockholders'...

Q: The first step in converting 30/50 = ?/200 to higher terms is to: Divide 200 by 50 Multiply 4 times...

A: Click to see the answer

Q: 9. Triangle RST has vertices at R(-4, 7), S(-6, 3) and T(-2, 3). Jennifer believes that the perimete...

A: Click to see the answer

Q: Water temperature affects the growth rate of brook trout. The table shows the amount of weight gaine...

A: The table shows the amount of weight gained by brook trout after 24 days in various water temprature...

Q: An element has an atomic number of 16. An ion of this element has a 2-charge. How was the ion formed...

A: Click to see the answer

Q: You are a pricing manager at a generic pharmaceutical distributor. The CEO of the company calls a me...

A: Price elasticity of demand:- Consumers will react to a price cut by buying more, but the law of dema...

Q: a) Identify ONE way in which African states or societies changed as a result of the Cold War. b) Ex...

A: Many parts of Africa had separated into colonies till WWII. Western European Nations, drained by WWI...

Q: driver in a moving car applies the brakes. The car slows to a final speed of 1.70 m/s over a distanc...

A: This problem can be solved by using first and third equation of motion which is given as v = u + at ...

Q: A list of numbers has n elements, indexed from 1 to n. The following algorithm is intended to displa...

A: Programs: Generally, programs contain the instructions to solve a problem. Any kind of complex probl...

Q: Find the mode of the following number of computers available to students at randomly selected high s...

A: Given data, 9,19,7,16,13,19,7,13,13   Sort the data in ascending order. 7,7,9,13,13,13,16,19,19 Mode...

Q: Each time Henry visits the art museum he pays $15 for parking and $25 for admission. If he buys a me...

A: Click to see the answer

Q: The pOH of a solution made by combining 150.0 mL of 0.10 M KOH(aq) with 50.0 mL of 0.20 M HBr(aq) is...

A: Click to see the answer

Q: Ô https://learn.zybooks.com/zybook/SNHUIT140V3/chapter/5/section/7 My library > IT 140: Introduction...

A: Input : User Ounces Output : Compute the Popcorn time and print it.

Q: It takes 208.4 KJ of energy to remove 1 mole of electrons from an atom on the surface of rubidium me...

A: How much energy does it take to remove a single electron from an atom on the surface of solid rubidi...

Q: Relating to Procedures Completed on the Posterior Segment (67005-67299): The code range ____ to ___...

A: Relating to Procedures Completed on the Posterior Segment (67005-67299):   The code range ____ to __...

Q: 1. What is the empirical formula of naphthalene, C10H8? 2. The empirical formula of acetic is CH2O, ...

A: Since you have asked multiple questions we will solve the 1st three for you. If you want an answer t...

Q: Calculate the enthalpy of combustion (kJ/mol) of methyl linoleate (C₁₉H₃₄O₂), an important component...

A: Click to see the answer

Q: chromatography on Bio-Gel P-300. The column had a length of 37 cm and a 1.5-cm diameter. Eluate frac...

A: Molecular mass of transferrin = 80000       Molecular mass of ferritin = 450000             length o...

Q: Samantha, a CEO, was reviewing her firm’s budget. She was surprised to see that about 30% of the com...

A: It is True.Fringe Benefits are the employees benefits that they get other than their compensationpac...

Q: 1.18 LAB: Input and formatted output: Right-facing arrow   Given two input integers for an arrow bod...

A: GIVEN: 1.18 LAB: Input and formatted output: Right-facing arrow   Given two input integers for a...

Q: Proteus mirabilis produces the enzyme urease, which converts urea into ammonia. If a patient has a u...

A: Kidneys are the organs belong to excretory system in our body and play a major role in several other...

Q: 10. A researcher claims that reading information aloud affects students' ability to retain the infor...

A: Given: n = 30 Test statistic value t = 2.879 Critical value = 2.462  

Q: Two identical spoons were electroplated with Ag or Cd through the use of the electrolytic cells illu...

A: Amount of metal deposit on spoons depends on the amount of current passed.

Q: Jay Gatsby categorizes wines into one of three clusters. The centroids of these clusters, describing...

A: The distance amid them can be considered using following formula –

Q: Linear Depreciation A hospital purchases a $500,000 magnetic resonance imaging (MRI) machine that ha...

A: Click to see the answer

Q: What evidence would need to be provided to refute the theory of gravity? Write 1-2 sentences.

A: Theory of gravity didn't work for some things, like Mercury’s peculiar orbit around the sun. The orb...

Q: A shop owner raises the price of a $150 pair of shoes by 40%. After a few weeks, because of falling ...

A: Follow 2nd step.

Q: Mr. Clarke was admitted with bilateral renal calculi and has been receiving intravenous hydration an...

A: Actual renal failure occurs as a result of the deterioration of the function of the kidney. This lea...

Q: What are 3 benefits of adding non-QuickBooks Online clients to your Client List in QuickBooks Online...

A: The three benefits of adding non- QuickBooks Online Clients to Client List in QuickBooks Online Acco...

Q: Drag the appropriate labels to their respective targets. Reset Help Lamina Superior articular tacet ...

A: The vertebral column consists of series of bones known as vertebrae. The vertebral column is about 7...

Q: Operations Management Question

A: Hazmat products imply Dangerous goods    

Q: The angle of twist for a shaft subjected to twisting torque can be expressed by the equation:φ = (TL...

A: The expression for the angle of twist for a shaft is, Here, T is the torque, L is the length of the...

Q: Madison has set up a lemonade stand outside her house and sells small cups and large cups of lemonad...

A: We can set up system of equations as below