Question: I need full code in C language Problem: Who will get one year of free dedicated parking spot! Monster campus decided to award a dedicated

I need full code in C language
Problem: Who will get one year of free dedicated parking spot!
Monster campus decided to award a dedicated parking spot to a student for free for the whole
year to their choice of garage. To determine the winner, the campus is hosting a quirky game.Since parking spots on campus are scarce and expensive, students are eager to compete for the
chance to win.
There are exactly 10 garages on campus, numbered from 1 to 10 Participating students must
choose one garage, and they receive a sequence number based on the order in which they register
for their preferred garage. However, some garages may be less desirable due to their locations, so
not all of them may be selected by the students. Ultimately, the students are grouped into G
groups (where G10), based on their unique garage choices, and these groups are assembled on
a large campus field. Each group is identified by the garage number they selected, though some
garages may be left unchosen.
Game Day! Each group gi consists of ni(ni2) students. Every student in the group is assigned a
sequence number from 1 to ni. These students form a circular line, waiting to be eliminated
according to the game's rules. However, due to a distraction, it was discovered that the students
in each group were standing in reverse order instead of the correct sequence. For example, if a
group had 7 students, their positions were reversed, as shown in the figure below. (let us say
number of students in this group is 7):
After realizing the wrong order of sequence, they reversed the circle to the correct order (note
that they have not just changed their sequence number, they have physically changed their order)
The elimination process is divided into two phases, explained below.
Phase1 Elimination:
In Phase1, eliminations occur within each group. For a given group gi, the elimination phase
continuous until the number of students in the group is reduced to a threshold ki-1(ki>0)are progressively removed. As mentioned, the elimination process for the group gi will stop when
the group has ti number of soldiers.
In summary, for a group gi, you have the total number of students ni(ni2), and a number
0), which indicates that ki-1 students are skipped and ki th student is eliminated in circle. There is
a threshold thin,kn=5,k=2=2n=7,k=3th=33,6,2GGFor each line of a group, the first integer indicates the garage number gi(gi10), the next integer
indicates the number of students ni in the group (10000), the next integer indicates the value of
ki(ni>ki>0) and then the next integer indicates the value of thi(ni>thi>0) integer.
Output Specification (Output must be on standard console. No file i/o):
If you have any submissions that uses fil io, then you will get -100 penalty for the assignment.
Also, the output format must match the sample output.
Specified by the sample output bellow. The output mainly contains the simulation steps and the
last line will contain winner student number with the group number (aka garage number).the students to the queue. However, the phase 1 elimination process is not a queue
operation. Phase 2 can heavily use the peek and dequeue functions.
g) You should never access queue front and back properties outside of the queue related
functions.
h) In addition to the other functions of a queue like enqueue, dequeue, peek, isEmpty, etc
your code must implement the following functions and use them as part of the solution:
i) Student* createStudent(int sequence): It takes an integer, dynamically allocate a
Student structure and returns a Student node
j) void createReverseCircle (queue *q): It takes the reference of a queue, and creates a circular singly linked list for that queue where the nodes contain sequence numbers in reverse order. For example, if n=5 it should produce a circular singly linked list starting from 5 and ending at 1 as sequence number. During this process, use the createStudent function as well as enqueu() function to add the Student to the queue.
k) void rearrangeCircle(queue* q): This function takes the reference of a queue and
reverse the given circular singly linked list where the first node of the linked list is
pointed by the front of the queue
I need full code in C language Problem: Who will

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!