Week 11 - Monday
What did we talk about last time? Euler paths Network flow Started B-trees
Lab hours Wednesdays at 5 p.m. in The Point 113 Saturdays at noon in The Point 113 CS Club Tuesdays at 5 p.m. in The Point 113 (or next door in The Point 112) Halloween party tomorrow! Women in STEM panel Tonight at 6 p.m. in The Point 113
12 a b 16 20 4 9 7 10 s t 13 4 c d 14
Binary trees are great However, only two splits means that you have a height of log 2 n when you want to store n things If n = 1,000,000, log 2 n = 20 What if depth was expensive? Could we have say, 10 splits? If n = 1,000,000, log 10 n = 6
Answer: When the tree is in secondary storage Each read of a block from disk storage is slow We want to get a whole node at once Each node will give us information about lots of child nodes We don’t have to make many decisions to get to the node we want
A B-tree of order m has the following properties: The root has at least two subtrees unless it is a leaf 1. 2. Each nonroot and each nonleaf node holds k keys and k + 1 pointers to subtrees where m /2 ≤ k ≤ m Each leaf node holds k keys where m /2 ≤ k ≤ m 3. 4. All leaves are on the same level
50 70 80 10 15 20 54 56 71 76 81 89 6 8 11 12 16 18 21 25 27 29
12 5 8 13 15 Insert 7 12 5 7 8 13 15
12 2 5 7 8 13 15 Insert 6 6 12 2 5 7 8 13 15
Insert the following numbers: 86 69 81 15 100 94 8 27 56 68 92 89 38 53 88
When the list of keys drops below half m , we have to redistribute keys In the worst case, we have to delete a level
Instead of requiring every non-root node to be half full, every non-root node must be at least 2/3 full Key redistribution becomes more complex However, the tree is fuller
Essentially, make a B-tree such that all the leaves are tied together in a linked list It is also necessary that all keys in a B-tree appear as leaves Some other variations are possible, but we’ll end the list here 6 12 2 5 6 7 8 12 13 15
Hard graph problems Intractability and NP-completeness
Work on Project 3 Study for Exam 2 Next Monday
Recommend
More recommend