CP164 Lecture Notes - Lecture 6: Priority Queue, The Queue

138 views2 pages
School
Course

Document Summary

Standard queues and priority queues: the queue adt is the opposite from a stack in regard to objects being first-in- First out": no top value, queue are horizontal while stacks are vertical. insert() to add an object and . remove() to take an object. Is full method for if queue has a maximum limit to its size: not allowed to insert into a full data structure. Insert a copy (insert function): append to the right side of list (end of list, use peek at position a[0]-pop zero is at index. Priority queue: removal process based on priority (example: lowest number goes first) However, a priority queue can sometimes help find better solutions than a simple stack or queue. Items are sorted by priority so simply remove the item at the front of the storage list. Items must be put into their proper place in the sorted list when added to the queue. A linked structure is convenient for this implementation.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents