24_QueueImplementations

24_QueueImplementations - Click to edit Master subtitle...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Click to edit Master subtitle style 2009 Dr. Tim Data Structures and Algorithms I Implementations of the Queue ADT Dr. Tim Margush University of Akron 2009 2009 Dr. Tim Goals Be able to implement a Queue using Linked Lists An Array A List Know the tradeoffs for common implementations of a queue Know how to modify these implementations for a deque and priority queue 2009 Dr. Tim 2009 Dr. Tim Linked List Queue A Linked implementation is Easily expanded Efficient Simple to implement The LLQueue class maintains a pointer to the front and rear of the queue The reference to the last item (rear) facilitates adding (enqueueing) 2009 Dr. Tim 2009 Dr. Tim LLQueue 2009 Dr. Tim public class LLQueue<E> implements QueueInterface<E>{ private Node<E> front, rear; public LLQueue(){ //dummy header } public boolean empty(){ } 2009 Dr. Tim LLQueue 2009 Dr. Tim public class LLQueue<E> implements QueueInterface<E>{ private Node<E> front, rear; public void enqueue(E anEntry){ } public E dequeue(){ } 2009 Dr. Tim Array Based Queue An Array implementation is Not as easily expanded Efficient, except for unused space in the array Simple to implement The class stores the location of the front and rear, and size in int members Array may need to be resized 2009 Dr. Tim 2009 Dr. Tim Array Based Queue The obvious choice to make 0 the...
View Full Document

This note was uploaded on 02/22/2011 for the course CS 463 taught by Professor Dr. tim margush during the Fall '09 term at The University of Akron.

Page1 / 22

24_QueueImplementations - Click to edit Master subtitle...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online