Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Write a generic queue in Cusing a \"void implementation. The implementation s

ID: 3796671 • Letter: 1

Question

1. Write a generic queue in Cusing a "void implementation. The implementation should use an array to hold the queue elements. Use a "circular" implementation that wraps the end of the queue around to the front of the array once it reaches the end of the array. Your implementation will need to keep track of two indices--one that points to the front of the queue and one that points to the end of the queue. If you have the Scott text, you can look at Figure 8.4 on page 413 to get an idea of the implementation I want The API that you will implement is void *queue new (int numItems); create a queue that can hold the indicated number of items void queue enqueue (void wa, void item add the element to the back of the queue void *queue dequeue (void *q); remove and return the element at the front of the queue int queue isEmpty (void *q); 1 if empty and 0 otherwise I have included several files for this problem o queueDriver.c: the driver program o queue h: the h ile you should use. Notice that it does not contain a struct for queue You should place your queue struct into queue.c so that you achieve information hiding. If you are confused about how to do information hiding in C,then re-watch my video on Modules-C-C+t or look at my notes about modules in Cand C++ o queue Input: some sample input. You should test your program with other input, but do not worry about bad input, input that overflows the queue, input that tries to access an empty queue, etc If you have questions abou what your output should look like,Ihave placed a C executable of queueDriver in /home/bvz/cs365/hw/hw5 2. The queue in question 1 requires that you write downcasts in order to extract values of a specific type, such as int, from the queue. This can be dangerous because the downcasts are not checked at run time to ensure that they are safe. Given an example of how this failure to check the downcasts could lead to a catastrophic result (i.c., a core dump or totally non-sensical output)

Explanation / Answer

if u pass 2 it will initaially insert into quee latter we add 2 to 0 and send to back of quee

so now quee looks like 0 2 we are removing 2

so we get 0 so its is failue

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote