DOC PREVIEW
TRINITY CSCI 1321 - List Based Stacks and Queues

This preview shows page 1-2 out of 6 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 6 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1List Based Stacks and Queues3/6/20082Opening Discussion■Let's look at solutions to the interclass problem.■Iterators and how they work.3Stacks/Queues with Linked Lists■The last time we talked about stacks and queues we implemented the ADTs using arrays. Part of the idea of an ADT though is that the implementation can vary as long as it has the right behavior.■Since you now know how to write linked lists, we want to look at how we would write stacks and queues using linked lists.4Code■I want to write a ListStack and a ListQueue. These should implement MyStack and MyQueue, but instead of using arrays (like ArrayStack and ArrayQueue), they should have a linked list inside of them.■Remember that it is essential that the implementation be O(1) for all operations.5Priority Queue ADT■A priority queue has the same methods as a normal queue, only the contents are ordered not only be arrival time, but also by a priority. So dequeue gets the highest priority object and if several have that priority, it gets the one that has been there the longest.■One way to implement a priority queue is with a sorted linked list. To make this flexible, you could have it take a comparator that tells you the ordering. That would be provided when the priority queue is constructed.■What order are the various operations for this implementation of a priority queue?6Minute Essay■What do you see as the relative advantages and disadvantages of the array and list based implementations of stacks and queues?■The midterm is next class. The office hours on Monday will be used for a review session if you show up with questions for me to answer.■Interclass Problem – Make your GUI calculator work properly. We'll look at these after the


View Full Document

TRINITY CSCI 1321 - List Based Stacks and Queues

Documents in this Course
Recursion

Recursion

11 pages

Iterators

Iterators

10 pages

Actors

Actors

9 pages

Recursion

Recursion

15 pages

Recursion

Recursion

10 pages

Threads

Threads

7 pages

Trees

Trees

11 pages

Load more
Download List Based Stacks and Queues
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view List Based Stacks and Queues and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view List Based Stacks and Queues 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?