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

• Notes
• 28

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

B-Trees (continued) Analysis of worst-case and average number of disk accesses for an insert. Delete and analysis. Structure for B-tree node

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

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.
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 .

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

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.
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

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

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
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

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

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.
This is the end of the preview. Sign up to access the rest of the document.
• Spring '10
• sartajsahani
• #, main memory, B-tree, 3-node. • 3-node

{[ snackBarMessage ]}

### What students are saying

• 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.

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

• 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.

Dana University of Pennsylvania ‘17, Course Hero Intern

• 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.

Jill Tulane University ‘16, Course Hero Intern