

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Instructions for assignment 9 in the cgs 3460 - programming using c course, where students are required to implement a double-ended queue (deque) data structure using c. The deque should contain integers with no size limit, and students must define functions to add and remove elements from the front and back of the queue. The document also includes instructions for submitting the assignment.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Assignment # 20 Points Assigned: 07/24/2009, Friday Due: 07/30/2009, Thu, 11:59 PM For this assignment, there is a single project. We will being implementing an abstract data type known as a double ended queue(DEQUE). You may want to check out http://en.wikipedia.org/wiki/Double-ended_queue for more information on the DEQUE. Also note that the implementation of a similar abstract data type, known as a stack is discussed in the book in chapter 19. The DEQUE will contain integers and have no limit on the size. You will define your DEQUE in files called deque.h and deque.c. All variables used should be accessible only to functions defined in deque.c.(i.e., we should not be able to access any of your variables in main.) The following functions should be defined so that we can modify the DEQUE from main. They should be declared in deque.h and defined in deque.c. You may add any additional “helper” functions you wish, however, we should not be able to call your helper functions. Note that limiting access to a variable or a function in your deque.c file is as simple as applying a certain key word. void addToFront(int v); - Adds the given value to the front of the queue. Note, if you decide to use a dynamic array to keep track of the elements in your DEQUE and the number of elements in your DEQUE becomes larger than the array size, you will need to create a new array that is large enough to hold the number of elements in your queue, copy the elements from the old array to the new one, and use the new array to hold the elements. void addToBack(int v); - Adds the given value to the back of the queue. Note, if you decide to use a dynamic array to keep track of the elements in your DEQUE and the number of elements in your DEQUE becomes larger than the array size, you will need to create a new array that is large enough to hold the number of elements in your queue, copy the elements from the old array to the new one, and use the new array to hold the elements. int removeFromFront(); - Removes the element at the front of the queue and returns it. If the DEQUE is empty, it returns -1. int removeFromBack(); - Removes the element at the back of the queue and returns it. If the DEQUE is empty, it returns -1. int checkFront(); - Returns the element at the front of the queue, but does not remove it. If the DEQUE is empty, it returns -1. int checkBack(); - Returns the element at the back of the queue, but does not remove it. If the DEQUE is empty, it returns -1.
Instructions for submitting Assignment 9
cd assign ls main.c deque.h deque.c .. tar cvf assign9.tar deque.h deque.c ls main.c deque.h deque.c assign9.tar ….
cd //to change to the home directory mkdir assign9 //to create the directory under home directory