Knowee
Questions
Features
Study Tools

Create a order 3 B-Tree for the following key data    10, 6, 12, 18, 13, 15, 3, 2, 1. What are the key values at the leaf nodes from left to write in the sequence.

Question

Create a order 3 B-Tree for the following key data    10, 6, 12, 18, 13, 15, 3, 2, 1. What are the key values at the leaf nodes from left to write in the sequence.

🧐 Not the exact question you are looking for?Go ask a question

Solution

To create a B-Tree, we start with an empty tree and insert the given key values one by one.

Step 1: Insert 10 into the empty tree. The tree now becomes:

     10

Step 2: Insert 6. Since the tree is not full, we can directly insert it as the left child of 10. The tree now becomes:

     10
    /
   6

Step 3: Insert 12. Again, the tree is not full, so we insert it as the right child of 10. The tree now becomes:

     10
    /  \
   6    12

Step 4: Insert 18. The tree is full, so we need to split it. We promote the middle key (12) to the parent node and create a new node to hold the remaining keys. The tree now becomes:

     12
    /  \
   10   18
  /
 6

Step 5: Insert 13. We compare it with the keys in the node and find that it should be inserted in the right subtree of 12. The tree now becomes:

     12
    /  \
   10   18
  /     \
 6      13

Step 6: Insert 15. We compare it with the keys in the node and find that it should be inserted in the right subtree of 12. The tree now becomes:

     12
    /  \
   10   18
  /     \
 6      13
          \
           15

Step 7: Insert 3. We compare it with the keys in the node and find that it should be inserted in the left subtree of 6. The tree now becomes:

     12
    /  \
   10   18
  /     \
 6      13
/ \

3 15

Step 8: Insert 2. We compare it with the keys in the node and find that it should be inserted in the left subtree of 3. The tree now becomes:

     12
    /  \
   10   18
  /     \
 6      13
/ \

3 15 / 2

Step 9: Insert 1. We compare it with the keys in the node and find that it should be inserted in the left subtree of 2. The tree now becomes:

     12
    /  \
   10   18
  /     \
 6      13
/ \

3 15 /
2 1

The key values at the leaf nodes from left to right in the sequence are: 1, 2, 3, 6, 10, 13, 15, 18.

This problem has been solved

Similar Questions

Draw a binary tree for the set of key values {a,b,c,d,e,f,g,h,i,j,k}, and the binary treeshould exactly have the following in-order AND post-order tree walk sequences:- In-order tree walk sequence: d,e,c,b,a,g,k,h,f,j,i- Post-order tree walk sequence: e,d,b,c,k,h,g,j,i,f,a

What is the maximum number of keys that a B+ -tree of order 3 and of height 3 have?

A B-tree of order 4 and of height 3 will have a maximum of _______ keys.

Construct a B+-tree for the following set of values(2, 3, 5, 7, 11, 17, 19, 23, 29, 31)Assume that the tree is initially empty and values are inserted in ascending order.1) Construct B+-trees for the cases where the number m of pointers that will fit a node is as follows:a. Fourb. Seven

A B+ tree of order 3 is generated by inserting 89, 9 and 8. The generated B+ tree is __________

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.