Question

Given is the B+-tree shown below (n = 3). Execute the following operations and write down the resulting B+-tree after each op

The rules are:
• Leaf Split: In case a leaf node needs to be split during insertion and n is even, the left node should get the extra key. E.g, if n = 2 and we insert a key 4 into a node [1,5], then the resulting nodes should be [1,4] and [5]. For odd values of n we can always evenly split the keys between the two nodes. In both cases the value inserted into the parent is the smallest value of the right node.

• Non-Leaf Split: In case a non-leaf node needs to be split and n is odd, we cannot split the node evenly (one of the new nodes will have one more key). In this case the “middle” value inserted into the parent should be taken from the right node. E.g., if n = 3 and we have to split a non-leaf node [1,3,4,5], the resulting nodes would be [1,3] and [5]. The value inserted into the parent would be 4.

• Node Underflow: In case of a node underflow you should first try to redistribute values from a sibling and only if this fails merge the node with one of its siblings. Both approaches should prefer the left sibling. E.g., if we can borrow values from both the left and right sibling, you should borrow from the left one.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Given B+ Tree is

109 DE25 |U011 ལགས་ཀྱི་ ༼UDD2 JZ2 » JUu5 JUue JUU7 • Up11 Up17 » JU1 JU23 • up2 Up31 །

Insert 9:

·002 - - DC15 ) 2011 | 0002 0003 + ac05 006 0007 + 0011 0047 + s01e 0023 + 0029 0031 ||

ܕ101 0113ܘ ܙ ܘܘܘܘ | ܗ 02a _ poz1 ܘ ܝ023_015ܩ ܝ 0011 _ oe17 occ2 _ dona , nona _ ness _ ooo7 |

0019 00050011 000200030005 0008 00070011 00170019002300290031

Found Leaf Node now Insert 9

- 00050011 0002 0003 +0005 2006 2007 00000011 0017 0019 00230029 0031

Above Node Contains too many keys so Perform Splitting

0005 0007 0011 0002 0003 0005 0008 +0007 0009 0011 0017 0019 0023 00290031

Delete 5:

0019 0005 0007 0011 0002 0003 0005 0008 +0007 0009 0011 0017 0019 0023 00290031

1800 8200 + szoo 0100 21001L00 2000 2000 2000 2000 2000 2000 0011 0005, 0007

ܓܙܘܢ ܕܗܘ tot ܢ 7007 ,0005- [dos1_028ܘ ܝ cons _ o023 ܝ oo11 _ o017 ܝ ܗ00 oops _ code = ooo7 nos2 _ cons

Found Leaf Node now Delete 5

1800 8200 + szoo 0100 21001L00 2000 2000 2000 2000 2000 0011 - 00050007

| 1SDU szun + ecug stup + ZLUD JIUn + spun ZUuz | ZUn – SUUg zucz བ DUDe/DDD7 ༽ UD1 1 07

Insert 10:

0019 - 0006 0007 0011 0002 0003+ 00087 0007 00090011 00170019 00230029 00310019 - 0006 0007 0011 0002 0003+ 00087 000700090011 00170019 00230029 0031

1800 6200 - Ezoo 0100 21001100 0000 2000 2000 2000 2000 0011 0007 0006 0019

Found Leaf Node now Insert 10

LEDO 8.00 8700 8100 21001100 0100 0000 2000 2000 2000 2000 0029 0006 00070011

Insert 8:

LEDO 8.00 8700 8100 21001100 0100 0000 2000 2000 2000 2000 0029 000600070011 0019

0019 000800070011 0029 00020003 +0008 +0007000900100011 00170019 0023 +00290031

0006 00070011 0029 0002000300080007 0009 00100011 00170019 002300290031

Found Leaf Node now Insert 8

0006 00070011 0002 00030008 +0007 2008 2009 0010 0011 00170019 00230029 0031

Above Node Contains too many keys so Perform Splitting

0019 0006 0007 0009 0011 0029 0002 0003000800070008 +0000 00100011 00170019 0023 +00290031

Above Node Contains too many keys so Perform Splitting

- UDDg ༽DD19 J017 0029 u002 JUs • J017 Up11 J017 + 001 J023 • J02 J031 །

Delete 23:

1800 8200 + E200 6100 2100 1100 +0100 8000 8000 2000 2000 2000 2000 6200 2000 9000 BLOD 6000

| Lego ਸੁਣ00 4 ਣop 500 * 20p up t op 5000 - 800D LOOD + 9੦੦੦ 4 coun zoop | 3 ਚ BਟOD ZDVDDBDXJQ Blop BDDD -

[ 1SDE szun Eczun sun + ZLOn EIUE + 0LUg spun + BUDD ZUJU + BZug + SDUD zupn ཐZ00 ། ་་་་ L ZUDE BUDD BLOp\ DJD -

Now Delete 23

DUDg ༽DD19 LUDE BUD0+ ༼0711 E :༈ TT [upp2 JUn + once + DE07 JUs upu c010 + 0011 J017 ; 001 + 002 DE31 །

Delete 19:

- 0029 ༽ 2013 LUDE BUD0+ ། Updf 0029 [upp2 JUn + once + DE07 JUs upu c010 + 0011 J017 ; 001 + 002 DE31 །

ཐLop\ 3ZUJ་ LUDE BUD0+ ༼0711 E :༈ JU29 ཐ JUn + once + DE07 c010 + 0011 J017 001 + 002 DE31 །

DUDg ༽DD19 052e0707 ༼0711 E :༈ 2g [upp2 JUn + once + DE07 JUs upu c010 + 0011 J017 001 002 DE31 །

Now delete 19

བ པ JU2 ༼0711 :༈ E LUDE BUD0+ ཐLop\ 3ZUJ་

Stealing from Right sibling

[ 1SUn + szun + ZLUE EIUE + 0LUE spun + BUDD ZUJU + BZug + Sun zupp བ བ བ བ བ བ བ བ པ » 2017 19070 scop་ UDD +

Delete 11:

1800 - 6200 +2100 1100 +01000000 3000 2000 2000 2000 2000 0031 0006, 0007 -B700 6000

- 0009 0029 0006, 0007 0011 0031 000200030008 +000700080009 00100011 001700290031

- 0009 0029 0006, 0007 0011 0031 000200030008 +000700080009 00100011 001700290031

Now Delete 11

8000+ + B200 9000 2000 0017 0031 0002 0003 + 0008 + 00070008 + 0000 0010 0 017 0 029 + 0031

Which is Required B+ Tree after performing all Operations

Add a comment
Know the answer?
Add Answer to:
The rules are: • Leaf Split: In case a leaf node needs to be split during...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using the following implementation of Tree class Node   {   public int iData;              // data item (key)   public...

    Using the following implementation of Tree class Node   {   public int iData;              // data item (key)   public double dData;           // data item   public Node leftChild;         // this node's left child   public Node rightChild;        // this node's right child   public void displayNode()      // display ourself      {      System.out.print('{');      System.out.print(iData);      System.out.print(", ");      System.out.print(dData);      System.out.print("} ");      }   }  // end class Node //------------------------------------------------------------------ import java.io.IOException; import java.util.Stack; public class Tree { private Node root; // first node of tree // ------------------------------------------------------------- public Tree() // constructor { root = null; }...

  • Q. write the algorithm for each function in this code: void insert(int x, node*&p) { //cheak...

    Q. write the algorithm for each function in this code: void insert(int x, node*&p) { //cheak if the pointer is pointing to null. if (p==NULL) {     p = new node;     p->key=x;     p->left=NULL;     p->right=NULL; } else {     //Cheak if the element to be inserted is smaller than the root.     if (x < p->key)     {       //call the function itself with new parameters.       insert(x,p->left);     }     //cheak if the alement to be inserted...

  • Question 3. (25 points) Consider the B+ tree index shown below. Each intermediate node can hold up to five pointers and four key values. Each leaf can hold up to four records, and leaf nodes are doub...

    Question 3. (25 points) Consider the B+ tree index shown below. Each intermediate node can hold up to five pointers and four key values. Each leaf can hold up to four records, and leaf nodes are doubly linked as usual, although these links are not shown in the figure. If you can borrow from or merge with both siblings, choose the right sibling. Answer the following questions 3080 I1 35425065 9098 12 68 69 70 79 98 99 1001105 30...

  • (true/false) All nodes in the right subtree of a node must be smaller in value than...

    (true/false) All nodes in the right subtree of a node must be smaller in value than their parent (true/false) Each node in a binary search tree may contain zero, one, or two children nodes. (true/false) It is possible to recursively process a binary search tree to print all the data in a binary search tree in sorted order. (true/false) The value of a parent must be less than all its children. (true/false) All nodes in the right subtree of a...

  • C++: PLEASE HELP~!!! ~~~~~~~~ Implement bool AVLTree::deleteNode(string ss) method. Function deleteNode() tries to delete the node...

    C++: PLEASE HELP~!!! ~~~~~~~~ Implement bool AVLTree::deleteNode(string ss) method. Function deleteNode() tries to delete the node containing value ss. If there is no such node, it returns false. Otherwise, it deletes the node, check the balance of the tree, rebalance the tree if it is necessary. When you delete a node, consider three different scenarios: -The node is a leaf -The node has only ONE child subtree -The node has two child subtrees Important: When you implement this project, do...

  • Write a method that determines the key of the successor of the root node in a...

    Write a method that determines the key of the successor of the root node in a binary search tree. For any input binary search tree, find the key of successor of the root node.Note: Successor is the node with the next highest key,  should work for any binary search tree - not just the given example input. #include <iostream> using namespace std; class Node { private: int key; string val; Node* left; Node* right; friend class BinarySearchTree; }; class BinarySearchTree {...

  • must be coded in c++ without any STL libraries sadly :( so im struggling on this...

    must be coded in c++ without any STL libraries sadly :( so im struggling on this problem, any help would be greatly appreciated, thanks in advance! :) assignment is due tomorrow and im really struggling on this last question :( a. Begin by implementing a BST for integers. The underlying structure is a linked list. You need these methods: i. BST(); -- Constructor ii. void put (int) – Inserts a value into the BST. iii. Void put(int[] a) – Inserts...

  • Consider the B+ tree index shown in Figure 1. Each intermediate node can hold up to...

    Consider the B+ tree index shown in Figure 1. Each intermediate node can hold up to five pointers and four key values. Each leaf can hold up to four records, and leaf nodes are doubly linked as usual, although these links are not shown in the figure. Answer the following questions. Show every step of the insertion and explain the process. 34.21-4 ostas 704 94 986 99-100-105 944954964974 LS Figure 1. (1). Insert a record with search key 109 into...

  • Need help in the below question. Answer in java Start with the tree.java program (Listing 8.1)...

    Need help in the below question. Answer in java Start with the tree.java program (Listing 8.1) and modify it to create a binary tree from a string of letters (like A, B, and so on) entered by the user. Each letter will be displayed in its own node. Construct the tree so that all the nodes that contain letters are leaves. Parent nodes can contain some non-letter symbol like +. Make sure that every parent node has exactly two children....

  • A balanced binary tree is a binary tree structure in which the left and right subtrees of every node differ

    Data structures C++1- A balanced binary tree is a binary tree structure in which the left and right subtrees of every node differ in height by no more than 1 Out of the following choices, which is the minimum set of nodes, if removed, will make the BST balanced?2- Which of the following is true for Red-Black Trees ? Select all choices that apply! Select one or more: a. For each node in the tree, all paths from that node to any leaf nodes contain...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT