Priority Queues and Heaps_Part_7

Priority Queues and Heaps_Part_7 - Iterative vs Recursive...

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

View Full Document Right Arrow Icon
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 31 - Iterative vs Recursive MakeHeap Recursive and Iterative MakeHeap do essentially the same thing: Heapify from bottom to top. Difference: Recursive is “depth-first” Iterative is “breadth-first”
Background image of page 1

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

View Full DocumentRight Arrow Icon
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 32 - Adaptable Priority Queues 3 a 5 g 4 e
Background image of page 2
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 33 - Recall the Entry and Priority Queue ADTs An entry stores a (key, value) pair within a data structure Methods of the entry ADT: key (): returns the key associated with this entry value (): returns the value paired with the key associated with this entry Priority Queue ADT: insert (k, x) inserts an entry with key k and value x removeMin () removes and returns the entry with smallest key min () returns, but does not remove, an entry with smallest key size (), isEmpty ()
Background image of page 3

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

View Full DocumentRight Arrow Icon
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/14/2012 for the course CSE 2011Z taught by Professor Elder during the Fall '11 term at York University.

Page1 / 5

Priority Queues and Heaps_Part_7 - Iterative vs Recursive...

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

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