Priority Queues and Heaps_Part_7

# Priority Queues and Heaps_Part_7 - Iterative vs Recursive...

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

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”

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

View Full Document
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder - 32 - Adaptable Priority Queues 3 a 5 g 4 e
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 ()

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

View Full Document
Last Updated: 06/02/12 8:32 PM CSE 2011 Prof. J. Elder
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
Ask a homework question - tutors are online