This preview shows pages 1–7. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Binomial Heaps Data Structures and Algorithms Andrei Bulatov Algorithms – Binomial Heaps 212 Priority Queues • Supports the following operations. – Insert element x. – Return min element. – Return and delete minimum element. ecrease key of element x to k – Decrease key of element x to k . • Applications. – Dijkstra's shortest path algorithm. – Prim's MST algorithm. – Eventdriven simulation. – Huffman encoding. – Heapsort. – . . . Algorithms – Binomial Heaps 213 Dijkstra’s Algorithm set S:={s} and d(s):=0 while S ≠ V do pick a node v not from S such that the value s minimal )} ( ) ( { min : ) ( ' ), , ( e len u d v d S u v u e + = ∈ = is minimal set S:=S ∪ {v}, and d(v):=d’(v) endwhile Algorithms – Binomial Heaps 214 Dijkstra’s Algorithm: PQ Style call PQinit set S:=V set key(s):=0 PQinsert(s) for each v ∈ V{s} key(v):= ∞ call PQinsert(v) while not PQisempty set v:=Pqdelmin set S:=S{v} for each w ∈ Q such that (v,w) ∈ E if key(w)>key(v)+len(v,w) then call PQdecrease(w,key(v)+len(v,w)) Algorithms – Binomial Heaps 215 Priority Queues makeheap Operation insert findmin elete in 1 Binary log N 1 g N 1 Binomial log N log N g N 1 Fibonacci * 1 1 g N 1 Relaxed 1 1 g N 1 Linked List 1 N Heaps Dijkstra/Prim 1 makeheap V insert V deletemin E decreasekey deletemin union decreasekey delete log N N log N log N log N log N log N log N log N 1 1 log N log N 1 1 log N N 1 1 N isempty 1 1 1 1 1 O(E + V log V) O(E log V) O(V 2 ) Algorithms – Binomial Heaps 216 Binomial Tree Recursive definition: B is a single node...
View
Full
Document
This note was uploaded on 11/19/2009 for the course CS CMPT 307 taught by Professor A.bulatov during the Fall '09 term at Simon Fraser.
 Fall '09
 A.BULATOV
 Algorithms, Data Structures

Click to edit the document details