Priority Queues - UAH CPE 212 Fundamentals of Software...

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

View Full Document Right Arrow Icon
UAH CPE 212 Fundamentals of Software Engineering Agenda Class 14 Queues 2 Priority Queues Key Concepts
Background image of page 1

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

View Full DocumentRight Arrow Icon
UAH CPE 212 Today Last Time Queue Concept Queue Implementations Queue Application This Time Priority Queue
Background image of page 2
UAH CPE 212 Priority Queue Priority Some things are more important than other Priority is problem and context specific How Assign priority to each arrival Sort by priority inside the queue OR Use different queues for each priority level
Background image of page 3

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

View Full DocumentRight Arrow Icon
UAH CPE 212 Queues Abstract Concept Can have heterogeneous or homogeneous queues Often called First In First Out (FIFO) Uses: Message handling Task handling, e.g printers Key Operations enque(insert) deque(remove) Enque Deque 1 2 3 4 Tail Head Sort queue by priority Enque Deque 1 2 3 4 Tail Head Enque Deque 1 2 3 4 Tail Head Enque Deque 1 2 3 4 Tail Head Enque Deque 1 2 3 4 Tail Head High Priority Low Priority What about a linked list?
Background image of page 4
UAH CPE 212 Queue Implementation #ifndef QUEUE1_H // Prevent duplicate definition #define QUEUE1_H #include <stdlib.h> // Provides size_t template <class Item> class Queue { public: // MEMBER CONSTANTS -- See page 87 for a better alternative
Background image of page 5

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

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

Page1 / 11

Priority Queues - UAH CPE 212 Fundamentals of Software...

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

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