{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 11-7 notes - 11-7 Notes Algorithms and Data Structures...

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

11-7 Notes Algorithms and Data Structures Every node of a B-tree must contain at least t-1 keys and at most 2t-1 keys (except root may have as few as one key) M / \ DH QTX / | \ / | | \ BC FG JKL NP RS UW YZ Find out how are we going to implement insertion and deletion in a B-Tree that is guaranteed? Insertion o Key: how do we (1) not create new levels at a level below current leaves, (2) insert if a leaf is already full? o Idea: node splitting T = 3 (full = 5 keys) Leaf: PQRST Parent: NW Split leaf at R New Leaves: PQ && ST new Parent: NRW Redistribute any sub-leaves o Code SPLIT(x) //x is full K k t (x) Create node x L from k 1 (x)…k t-1 (x) Create x R from k t+1 (x)…k 2t-1 (x) Move k into parent of x Add pointers to x L , x R on either side of k o Problems: What if the parent is full? Make sure it never happens What if x is root? create a new root What is the parent? Always go down, never up o Idea: do recursive DoINsert(x,k) o * Invariant: when we call DoInsert(x,k),

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

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