{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

SLN_2 - Problem 1 A heap of size n has at most n/2h 1 nodes...

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

View Full Document Right Arrow Icon
Problem 1 A heap of size n has at most d n/ 2 h +1 e nodes with height h . Proof : Property 1: Let S h be the set of nodes of height h , subtrees rooted at nodes in S h are disjoint. In other words, we cannot have two nodes of height h with one being an ancestor of the other. Property 2 All subtrees are complete binary trees except for one subtree. Now we derive the bounds of n by N h given these two properties. Let N h be the number of nodes of height h . Since N h - 1 of these subtrees are full, each subtree of them contains exactly 2 h +1 - 1 nodes. One of the height h subtrees may be not full, but contain at least 1 node at its lower level and has at least 2 h nodes. The remaining nodes have height strictly more than h . To connect all subtrees rooted at node in S h , there must be exactly N h - 1 such nodes. The total of nodes is at least ( N h - 1)(2 h +1 - 1)+2 h + N h - 1 while at most N h 2 h +1 - 1, So ( N h - 1)(2 h +1 - 1) + 2 h + ( N h - 1) n N h (2 h +1 - 1) + N h - 1 (1) ⇒ - 2 h n - N h 2 h +1 ≤ - 1 (2) The fraction part of n/ 2 h +1
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
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