lec3 - n CS 323/700 Lecture 3 o Design and Analysis of...

Info iconThis preview shows pages 1–6. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: n CS 323/700 Lecture 3 o Design and Analysis of Algorithms Hoeteck Wee · [email protected] http://algorithms.qwriting.org/ Data structures I maintain a dynamically changing set that supports insert and extract I use queues (FIFO) or stacks (LIFO) I python lists as stacks: append(v) , pop() I python lists as queues: append(v) , pop(0) Hoeteck Wee CS 323 Feb 8, 2010 2 / 23 Priority queues PRIORITY QUEUES. dynamically changing sets with priorities I managing real time events, e.g. process scheduling on a PC I each process has a priority (i.e. key ), e.g. bash : 31, firefox : 57 I processes do not arrive in order of priorities I want to extract and run process with highest priority (smallest key) I Priority queue operations I insert ( v ) (assume v is the key) I findmin I extractmin I Implementation using python (unsorted) list and a pointer to smallest key I insert ( v ) : O ( 1 ) time I findmin : O ( 1 ) time I extractmin : O ( n ) time Hoeteck Wee CS 323 Feb 8, 2010 3 / 23 Priority queues implementations I using python (unsorted) list and a pointer to smallest key I insert ( v ) : O ( 1 ) time I findmin : O ( 1 ) time I extractmin : O ( n ) time I using python sorted list I insert ( v ) : O ( n ) time I findmin : O ( 1 ) time I extractmin : O ( n ) time I using sorted doubly linked list I cannot exploit binary search for insert Hoeteck Wee CS 323 Feb 8, 2010 4 / 23 Priority queues implementations I using python (unsorted) list and a pointer to smallest key I insert ( v ) : O ( 1 ) time I findmin : O ( 1 ) time I extractmin :...
View Full Document

This note was uploaded on 05/31/2010 for the course COMPUTER S 700 taught by Professor Joewhite during the Spring '10 term at Universidad San Martín de Porres.

Page1 / 23

lec3 - n CS 323/700 Lecture 3 o Design and Analysis of...

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