B Trees

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What are the properties of a B tree?

1. degree m = max number of children 2. leaf nodes have no children 3. all leaf nodes are the same distance from the root 4. interior nodes have at least m/2 children 5. Root nodes can have 0 children, otherwise they have 2 to m children 6. Number of keys in an interior node is one fewer than the number of children 7. Leaf nodes can have 1 to m-1 keys

Define a 2-3-4 tree

A 2-3-4 tree is a b tree where m = 4

What is the time complexity of insert and remove in a 2-3-4 tree? (its the same for average and worst case) use big o notation

O(log n)

2-3-4 tree: a non-root leaf node has reached 3 keys. It has no parents with 3 keys. What is neccessary to add another node to its section of the tree?

Push the middle value up into the parent. make the remaining keys into separate 1-key nodes that are children of that parent

2-3-4 tree: There is a tree that has a node with key 4 as its root. Its left child is a node with key 2 that has children of keys 1 and 3. On the the right of the node with key 4 is a node of keys 6,8,10. It has 4 children with the keys of 5 and 7 and 9 and 11. You are trying to add 12. What will the tree look like when you are done

The 8 is pushed up into the root to create 4,8. The left child of the root and its children stay the same. The middle child of the root is 6 with children 5 and 7. The right child of the root is 10 with children 9 and 11,12

2-3-4 tree: There is a tree that as a node with keys 2,4,6 as its root. Its root has children with keys 1 and 3 and 5 and 7. You are trying to add an 8. What will the tree look like after you have added an 8? (i don't believe this tree could actually appear in a real situation but the same algorithm should work)

The root had key 4. The root's left child has key 2. The root's left child has children 1 and 3. The root's right child has key 6. The root's right child has children 5 and 7,8

How many children does an interior node with n keys have?

n+1 children

2-3-4 tree: You are trying to add a key to a node whose ancestor has 3 keys. What must you do first?

split the ancestor with 3 nodes

2-3-4 tree: the root node is a leaf and has reached 3 keys. what is neccessary to add another node?

split the root. the middle value becomes the root. the right and left values become the children


संबंधित स्टडी सेट्स

ECON101 Exam 2: Problem Sets and Quizzes

View Set

BME Financial Analysis Unit Exam

View Set

DAILY ROUTINE, FREE TIME, HOBBIES / QUESTIONS AND ANSWERS

View Set

ch. 22 Body Organization and Structure

View Set

Business Communications Chapter 2

View Set

Food science quiz #2 (nutritionism)

View Set