lec23 - B-Trees(continued Analysis of worst-case and...

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

View Full Document Right Arrow Icon
B-Trees (continued) Analysis of worst-case and average number of disk accesses for an insert. Delete and analysis. Structure for B-tree node
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
Worst-Case Disk Accesses 15 20 4 1 3 5 6 30 40 13 16 17 7 12 9 8 10 Insert 2. Insert 18. Insert 14.
Image of page 2
Worst-Case Disk Accesses Assume enough memory to hold all h nodes accessed on way down. h read accesses on way down. 2s+1 write accesses on way up, s = number of nodes that split. Total h+2s+1 disk accesses. Max is 3h+1 .
Image of page 3

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

View Full Document Right Arrow Icon
Average Disk Accesses Start with empty B-tree. Insert n pairs. Resulting B-tree has p nodes. # splits <= p –2 , p > 2 . # pairs >= 1+(ceil(m/2) 1)(p 1) . s avg <= (p 2)/(1+(ceil(m/2) 1)(p 1)) . So, s avg < 1/(ceil(m/2) – 1) . m = 200 => s avg < 1/99 . Average disk accesses < h + 2/99 + 1 ~ h + 1 . Nearly minimum.
Image of page 4
B-Tree – Delete Delete 3. Delete 8. Delete 7. 15 20 4 5 6 30 40 13 16 17 7 12 9 8 10 3
Image of page 5

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

View Full Document Right Arrow Icon
Delete (2-3 tree) Delete the pair with key = 8 . Transform deletion from interior into deletion from a leaf. Replace by largest in left subtree. 15 20 8 1 2 4 5 6 30 40 9 16 17 3
Image of page 6
Delete From A Leaf Delete the pair with key = 16 . 3 -node becomes 2 -node. 15 20 8 1 2 4 5 6 30 40 9 16 17 3
Image of page 7

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

View Full Document Right Arrow Icon
Delete From A Leaf Delete the pair with key = 17 . Deletion from a 2 -node. Check an adjacent sibling and determine if it is a 3 -node.
Image of page 8
Image of page 9
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