startercros.blogg.se

Linked list stack implememntation using two queues 261
Linked list stack implememntation using two queues 261











the structures and the prototypes of functions a user of the stack interacts with) is already defined for you in the file stack.h.

linked list stack implememntation using two queues 261 linked list stack implememntation using two queues 261

In this way, the stack ADT behaves much like a physical stack, for example, a stack of books or of dishes, where we can only add and remove items to and from the top of the stack.įor this assignment, the interface for the stack (i.e. This constraint means that elements in a stack are ordered in "last in, first out" (or LIFO) order. Each new element must be inserted at the top of the stack, and only the element at the top of the stack (which is always the most recently added) may be removed. The first ADT you'll implement for this assignment is a stack.Īs we'll explore in lecture, a stack is a data type that only allows its user to work with one end of the collection being stored, which is referred to as the "top". In this assignment, you'll implement two new ADTs on top of the data structures you implemented in the previous assignment. In addition, you may modify the dynamic array implementation provided in dynarray.h/ dynarray.c or the linked list implementation provided in list.h/ list.c as needed to implement the queue and stack. If you change the prototypes, it will cause the tests to break, and your grade for the assignment will likely suffer.įeel free to add any additional functions you might need to queue.c and stack.c. To help grade your assignment, we will use a set of tests that assume these functions exist and have the same prototypes that are defined in those files.

linked list stack implememntation using two queues 261

It's important that you don't modify the function prototypes specified in queue.h and stack.h.

Linked list stack implememntation using two queues 261 code#

There are a couple parts to the assignment, each described below.įor this assignment, you are provided with some starter code that defines the structures you'll be working with and prototypes the functions you'll be writing and also provides some data structures upon which to build a stack and queue implementation. This assignment is intended to have you start working with stacks and queues and to start building ADTs on top of other data structures.











Linked list stack implememntation using two queues 261