lec12 - Binomial Heaps Leftist trees O(log n O(log n O(log...

Info icon This preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
Binomial Heaps Binomial heaps Leftist trees Actual Amortized Insert O(log n) O(1) O(1) Remove min (or max) O(log n) O(n) O(log n) Meld O(log n) O(1) O(1)
Image of page 1

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

View Full Document Right Arrow Icon
Min Binomial Heap Collection of min trees. 6 4 9 5 8 7 3 1 9 5 6 5 9 2 8 6 7 4
Image of page 2
Node Structure Degree Number of children. Child Pointer to one of the node’s children. Null iff node has no child. Sibling Used for circular linked list of siblings. Data
Image of page 3

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

View Full Document Right Arrow Icon
Binomial Heap Representation Circular linked list of min trees. 6 4 9 5 8 7 3 1 9 5 6 5 9 2 8 6 7 4 A Degree fields not shown.
Image of page 4
Insert 10 Add a new single-node min tree to the collection. 10 Update min-element pointer if necessary. 6 4 9 5 8 7 3 1 9 5 6 5 9 2 8 6 7 4 A
Image of page 5

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

View Full Document Right Arrow Icon
Meld Combine the 2 top-level circular lists. 9 5 7 A 4 8 7 3 1 B Set min-element pointer.
Image of page 6
Meld 9 5 7 4 8 7 3 1 C
Image of page 7

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

View Full Document Right Arrow Icon
Remove Min Empty binomial heap => fail.
Image of page 8
Nonempty Binomial Heap Remove a min tree. Reinsert subtrees of removed min tree.
Image of page 9

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

View Full Document Right Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern