Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please write this in c language 3. You must create a struct to store a queue of customers. This struct should have two pointers one
please write this in c language
3. You must create a struct to store a queue of customers. This struct should have two pointers one to the front of the queue and one to the back. 4. You must implement all of the lines that form as an array of size 15 (stored as a constant) of queues. [It is kind of an array of 15 queues, where each queue is a linked list] 5. You must dynamically allocate memory as appropriate for linked lists. 6. Your queue must support the following operations: a. Enqueue b. Dequeue c. Peek: Return the front of the queue WITHOUT dequeuing. d. Empty (returns 1 if the queue is empty, 0 if it is not) 7. You must free memory appropriately. Namely, when you dequeue, you'll free memory for a node, but you will NOT free memory for the customer. You will free this memory a bit later right after you calculate when that customer will finish checking out. 8. You must use the memory leak detector like PA1 and as shown in earlier labs. 9. Due to the nature of the problem, when you process the input, you can add everyone into their appropriate lines right at the beginning, before checking anyone out. This wouldn't work in all simulations (some of which you have to do in time order), but because there is ONLY one check out line, you can get away with it. The only thing you have to be cognizant about is that when you select a line, if the current time is 100 for example, and three lines have customers who arrived before time 100 and the other lines have customers in the front who arrived AFTER time 100, you have to ignore the customers in those lines who arrived after time 100. In the case that all the lines have customers who arrived after time 100 , you would take the line which has a customer who arrived first. You are guaranteed no ties for arrival time so this would be unique. Rubric (subject to change): The code will be compiled and tested in codegrade for grading. If your code does not compile in codegrade, we conclude that your code is not compiling and it will be graded accordingly. We will apply a set of test cases to check whether your code can produce the expected output or not. The output format has to match exactly to pass test cases. Failing each test case will reduce some grade based on the rubric given bellow. If you hardcode the output, you will get 200% for the assignment. 1. If a code does not compile: May result in 0 (still you should consider submitting it as we may/may not apply partial credit) 2. If you do not create/write/use the required structures and functions: you may get 0 3. Not writing and using the enqueue, dequeue, and peek function will receive 0 4. There is no grade for a well indented and well commented code. But a bad written/indented code will receive 20% penalty. Not putting comment in some important block of code 10%
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started