CS223-0212-Heap

CS223-0212-Heap - Priority Queue and Binary Heap Neil Tang...

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

View Full Document Right Arrow Icon
CS223 Advanced Data Structures and Algorithms 1 Priority Queue and Binary Heap Priority Queue and Binary Heap Neil Tang Neil Tang 02/12/2008 02/12/2008
Background image of page 1

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

View Full DocumentRight Arrow Icon
CS223 Advanced Data Structures and Algorithms 2 Class Overview Class Overview Priority queue Binary heap Heap operations: insert, deleteMin, de/increaseKey, delete, buildHeap Application
Background image of page 2
CS223 Advanced Data Structures and Algorithms 3 Priority Queue Priority Queue A priority queue is a queue in which each element has a priority and elements with higher priorities are supposed to be removed before the elements with lower priorities.
Background image of page 3

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

View Full DocumentRight Arrow Icon
CS223 Advanced Data Structures and Algorithms 4 Possible Solutions Possible Solutions Linked list: Insert at the front (O(1)) and traverse the list to delete (O(N)). Linked list: Keep it always sorted. traverse the list to insert (O(N)) and delete the first element (O(1)). Binary search tree
Background image of page 4
CS223 Advanced Data Structures and Algorithms 5 Binary Heap Binary Heap A binary heap is a binary tree that is completely filled, with possible
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 / 17

CS223-0212-Heap - Priority Queue and Binary Heap Neil Tang...

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