10 likes | 115 Views
<300<=…<500<=. 100– 200 300—400 500-600. 1164. 1038. 9114. 2314. 3678 4164. 5931 6104. MIS 3500 * Exercise: Creating B+Tree (Updated 2014). Task: Use the set of values below to design a B+ tree with m=3 (i.e., the max number of values per node is 3, and
E N D
<300<=…<500<= 100– 200 300—400 500-600 1164 1038 9114 2314 3678 4164 5931 6104 MIS 3500 * Exercise: Creating B+Tree (Updated 2014) Task: Use the set of values below to design a B+ tree with m=3 (i.e., the max number of values per node is 3, and the min. number of values is 2. Use the example below for modeling the bigger, equal and smaller than operators. • A procedure for creating a B+-tree: • Line up all key values at the leaf level in increasing order. • Specify “triplets” and/or pairs of key values (as shown here). • To get a balanced tree, set the root value (a single number on the top of the tree) should be around the mid-point of the key values set. This will determine which values will be on the left and which on the right side of the tree. • Move up to the first node level above the leaves and specify a range (e.g., 8442--8777 in the example below) or a single value at the node, while respecting the relational operators (e.g., values down the left side of the 8442--8777 node must be either equal or smaller than 8442). • 5. Repeat step 4 until your reach the root. • Leaf values: 7368 7547 8442 8556 8777 Example: Some hints: - All values must appear at the leaf level, and all leaves are on the same level. • Search starts at the root level, and moves through nodes to leaves. Some leaf values are repeated in nodes. • There can be empty slots on the leaf level ready to receive new data. - The tree can be designed in different ways, depending on what values are stored in nodes. • A good tree is nearly balanced in relation to the root. • The operators can also be <=, < ; whichever you use make sure it is consistent throughout the tree.