Lecture11 - This operation takes O ( log n ) time....

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

View Full Document Right Arrow Icon
IE 495 Lecture 11 October 3, 2000
Background image of page 1

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

View Full DocumentRight Arrow Icon
Reading for This Lecture Primary Horowitz and Sahni, Chapter 2, Section 3 Kozen, Lectures 8-11
Background image of page 2
Binomial Trees The binomial tree of rank i ( B i ) is defined recursively. B i consists of a root with i children B 0 , . . ., B i-1 . B 0 B 3 B 2 B 1
Background image of page 3

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

View Full DocumentRight Arrow Icon
Binomial Heaps A binomial heap is a collection of heap ordered binomial trees and a pointer to the overall max/min. No more than one tree of each rank is allowed. The children of each vertex are maintained in a circular linked list . The basic operation is linking . Two trees of rank i can be combined into one tree of rank i+1 in constant time.
Background image of page 4
Eager Meld We can combine two heaps by performing a meld() reminiscent of binary addition. Successively link trees of equal rank and " carry " one if necessary. Must track the position of the new min/max element.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: This operation takes O ( log n ) time. Inserting into a Binomial Heap To insert() an element: Make a new heap from the single element to be inserted. Meld the new heap with the old one. To make_heap() from scratch, perform a sequence of inserts. To delete() the min/max element: The children of this element form a new binomial heap. Meld the old heap and the new one. Amortized Analysis meld() and delete() both take O(log n). We will use amortized analysis to show that insert() is constant time overall. Idea : The total number of linking operations can never be more than the number of insert operations. This means that any sequence of inserts takes constant time on average ....
View Full Document

This note was uploaded on 08/06/2008 for the course IE 495 taught by Professor Linderoth during the Fall '08 term at Lehigh University .

Page1 / 7

Lecture11 - This operation takes O ( log n ) time....

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

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