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 garages on campus, numbered from to 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
groups where 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 consists of students. Every student in the group is assigned a
sequence number from to 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 students, their positions were reversed, as shown in the figure below. let us say
number of students in this group is :
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.
Phase Elimination:
In Phase eliminations occur within each group. For a given group the elimination phase
continuous until the number of students in the group is reduced to a threshold are progressively removed. As mentioned, the elimination process for the group will stop when
the group has number of soldiers.
In summary, for a group you have the total number of students and a number
which indicates that students are skipped and th student is eliminated in circle. There is
a threshold GGFor each line of a group, the first integer indicates the garage number the next integer
indicates the number of students in the group the next integer indicates the value of
and then the next integer indicates the value of integer.
Output Specification Output must be on standard console. No file io:
If you have any submissions that uses fil then you will get 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 numberthe students to the queue. However, the phase elimination process is not a queue
operation. Phase 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 createStudentint sequence: It takes an integer, dynamically allocate a
Student structure and returns a Student node
j void createReverseCircle queue : 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 it should produce a circular singly linked list starting from and ending at as sequence number. During this process, use the createStudent function as well as enqueu function to add the Student to the queue.
k void rearrangeCirclequeue 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
