SlideShare une entreprise Scribd logo
1  sur  24
B + TREE
INTRODUCTION
A     B+ tree is a balanced tree in which every path from the
    root of the tree to a leaf is of the same length, and each
    non leaf node of the tree has between [n/2] and [n]
    children, where n is fixed for a particular tree.

    In a B+ tree, in contrast to a B-tree, all records are stored
    at the leaf level of the tree; only keys are stored in internal
    nodes.

 All    the leaf nodes are interconnected for faster access.

 Fill   factor is 50%.
EXAMPLE
   B+ Trees use a "fill factor" to control the growth and the
    shrinkage. A 50% fill factor would be the minimum for any
    B+.

Example : A B+ tree of order 5.

 Number of Keys 4
 Number of Pointers 5

 Fill Factor 50%

 Minimum Keys in each node 2
B+ TREE
                                 INTERNAL NODE / INDEX
                                 nodeS




               LEAF NODES / DATA nodeS


The linked list allows rapid in-order traversal.
OPERATIONS IN B+ TREE
   SEARCH

   INSERTION

   DELETION
B+ TREE- SEARCH OPERATION
TWO CASES:

 Successful   Search

 Unsuccessful   Search
SEARCHING
   Compare the key value with the data in the tree,
    then give the result back.
    For example: find the value 45, and 15 in below
    tree.
B+ TREE- INSERTION OPERATION

Inserting a record when

Case 1:If both leaf node and index node is not full.

Case 2:If leaf node is full and index node is not full.

Case 3:If both leaf node and index node is full.
INSERTION –CASE 1




         Add Record with Key 28
INSERTION –CASE 2

Adding a record when the leaf node is full but the index
node is not full.




   Add Record with Key 70
• This record should go in the leaf node containing
50, 55, 60, and 65.

      Left Leaf node       Right Leaf node
      50 55                60 65 70

    AFTER INSERTING A Record With Key 70.
INSERTION –CASE 3
Adding a record when both the leaf node and the index
node are full.

Add a record containing a key value of 95 to the
following tree.
This record belongs in the node containing 75, 80, 85, and
90. Since this node is full we split it into two nodes:

         Left Leaf Node      Right Leaf node
         75 80               85 90 95


 The middle key, 85, rises to the index node.

 But the index node is also full, so we split the index
 node:

 Left Index node   Right Index node      New Index node
 25 50               75 85                 60
After the record containing 95 is inserted.




Leaf nodes are at same level only.
B+ TREE – DELETION OPERATION

 Deleting a record from B+ tree may result in

 Case 1: If both the leaf node and index node does not
          go below the fill factor.

 Case 2: If the leaf node goes below fill factor and
          index node does not go below the fill factor.

 Case 3: If both the leaf node and index node goes
          below the fill factor.
DELETION –CASE 1
If both the leaf node and index node does not go below the fill
 factor.
Delete 70 from the following B+ Tree
   This node will contain 2 records after the deletion. So,
    simply delete 70 from the leaf node.
Delete 25 from the B+ tree

   when we delete 25 we must replace it with 28 in the index
    node.
DELETE 60 FROM THE B+ TREE

   The leaf node containing 60 will be below the fill factor
    after the deletion. Thus, we must combine leaf nodes.

   With recombined nodes, the index node will be reduced by
    one key. Hence, it will also fall below the fill factor. Thus,
    we must combine index nodes.

   60 appears as the only key in the root index node.
   After deleting 60
B+ TREES AS FILE INDEXES

 B+   Trees are descendants of B Trees.

 Retrieval  of records from large files or databases
  stored in external memory is time consuming.

 To  promote Efficient Retrievals, file indexes are
  used.

 An   index is a <Key , Address> pair.
 The records of the file are sequentially stored and for each
 block of records, the largest key and the block address is
 stored in an index.

 InB+ Tree to retrieve a record given its key, it is essential
 that the search traverses down to a leaf node to retrieve its
 address.

 The
    non leaf nodes only serve to help the process traverse
 downwards towards the appropriate leaf node.
ADVANTAGE OF B+ TREE
 B+   Trees are much easier and higher performing to
  do a full scan, since the terminal nodes form a linked
  list.
 But to do a full scan in B tree, a complete inorder
  traversal is to be made.

DISADVANTAGE OF B+ TREE
 Any  search will end at leaf node only.
 Time complexity for every search results in O(h).

              H-height of the B+ tree.
 Waste of Memory.

 In comparing to B+ trees, B trees are efficient.
THANK YOU

Contenu connexe

Tendances (20)

Bubble sort
Bubble sortBubble sort
Bubble sort
 
Red black tree
Red black treeRed black tree
Red black tree
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Binary Search Tree in Data Structure
Binary Search Tree in Data StructureBinary Search Tree in Data Structure
Binary Search Tree in Data Structure
 
Tree and graph
Tree and graphTree and graph
Tree and graph
 
Searching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And AlgorithmSearching techniques in Data Structure And Algorithm
Searching techniques in Data Structure And Algorithm
 
linear search and binary search
linear search and binary searchlinear search and binary search
linear search and binary search
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)Balanced Tree (AVL Tree & Red-Black Tree)
Balanced Tree (AVL Tree & Red-Black Tree)
 
B+ Tree
B+ TreeB+ Tree
B+ Tree
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
 
B+ tree
B+ treeB+ tree
B+ tree
 
Quick sort-Data Structure
Quick sort-Data StructureQuick sort-Data Structure
Quick sort-Data Structure
 
AVL Tree in Data Structure
AVL Tree in Data Structure AVL Tree in Data Structure
AVL Tree in Data Structure
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
Algorithm analysis
Algorithm analysisAlgorithm analysis
Algorithm analysis
 
AVL Tree Data Structure
AVL Tree Data StructureAVL Tree Data Structure
AVL Tree Data Structure
 
Digital Search Tree
Digital Search TreeDigital Search Tree
Digital Search Tree
 
b+ tree
b+ treeb+ tree
b+ tree
 
Binary tree
Binary  treeBinary  tree
Binary tree
 

Similaire à B tree

Best for b trees
Best for b treesBest for b trees
Best for b treesDineshRaaja
 
109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.pptssuser19bb13
 
Furnish an Index Using the Works of Tree Structures
Furnish an Index Using the Works of Tree StructuresFurnish an Index Using the Works of Tree Structures
Furnish an Index Using the Works of Tree Structuresijceronline
 
B TREE ( a to z concept ) in data structure or DBMS
B TREE ( a to z concept ) in data structure  or DBMSB TREE ( a to z concept ) in data structure  or DBMS
B TREE ( a to z concept ) in data structure or DBMSMathkeBhoot
 
Free video lectures for mba
Free video lectures for mbaFree video lectures for mba
Free video lectures for mbaEdhole.com
 
B-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structureB-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structuressuser19bb13
 
Data structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxData structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxMalligaarjunanN
 
Multiway Trees.ppt
Multiway Trees.pptMultiway Trees.ppt
Multiway Trees.pptAseemBhube1
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsAakash deep Singhal
 
NON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptxNON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptxRajitha Reddy Alugati
 

Similaire à B tree (20)

Nikhat b+ trees ppt
Nikhat b+ trees pptNikhat b+ trees ppt
Nikhat b+ trees ppt
 
Jamal ppt b+tree dbms
Jamal ppt b+tree dbmsJamal ppt b+tree dbms
Jamal ppt b+tree dbms
 
B+tree
B+treeB+tree
B+tree
 
Best for b trees
Best for b treesBest for b trees
Best for b trees
 
109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt109885098-B-Trees-And-B-Trees in data structure.ppt
109885098-B-Trees-And-B-Trees in data structure.ppt
 
B+ trees and height balance tree
B+ trees and height balance treeB+ trees and height balance tree
B+ trees and height balance tree
 
Furnish an Index Using the Works of Tree Structures
Furnish an Index Using the Works of Tree StructuresFurnish an Index Using the Works of Tree Structures
Furnish an Index Using the Works of Tree Structures
 
B TREE ( a to z concept ) in data structure or DBMS
B TREE ( a to z concept ) in data structure  or DBMSB TREE ( a to z concept ) in data structure  or DBMS
B TREE ( a to z concept ) in data structure or DBMS
 
Free video lectures for mba
Free video lectures for mbaFree video lectures for mba
Free video lectures for mba
 
B+ tree.pptx
B+ tree.pptxB+ tree.pptx
B+ tree.pptx
 
B-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structureB-and-B-Tree-ppt presentation in data structure
B-and-B-Tree-ppt presentation in data structure
 
Data structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptxData structures trees - B Tree & B+Tree.pptx
Data structures trees - B Tree & B+Tree.pptx
 
A41001011
A41001011A41001011
A41001011
 
Trees
TreesTrees
Trees
 
Multiway Trees.ppt
Multiway Trees.pptMultiway Trees.ppt
Multiway Trees.ppt
 
Data structure tree- advance
Data structure tree- advanceData structure tree- advance
Data structure tree- advance
 
Lecture 8 data structures and algorithms
Lecture 8 data structures and algorithmsLecture 8 data structures and algorithms
Lecture 8 data structures and algorithms
 
Unit 3.ppt
Unit 3.pptUnit 3.ppt
Unit 3.ppt
 
NON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptxNON-LINEAR DATA STRUCTURE-TREES.pptx
NON-LINEAR DATA STRUCTURE-TREES.pptx
 
Indexing.ppt
Indexing.pptIndexing.ppt
Indexing.ppt
 

Plus de Tech_MX

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimationTech_MX
 
Templates in C++
Templates in C++Templates in C++
Templates in C++Tech_MX
 
String & its application
String & its applicationString & its application
String & its applicationTech_MX
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2Tech_MX
 
Stack data structure
Stack data structureStack data structure
Stack data structureTech_MX
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application Tech_MX
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applicationsTech_MX
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2Tech_MX
 
Set data structure
Set data structure Set data structure
Set data structure Tech_MX
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Tech_MX
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pcTech_MX
 
More on Lex
More on LexMore on Lex
More on LexTech_MX
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbmsTech_MX
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)Tech_MX
 
Memory dbms
Memory dbmsMemory dbms
Memory dbmsTech_MX
 

Plus de Tech_MX (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Uid
UidUid
Uid
 
Theory of estimation
Theory of estimationTheory of estimation
Theory of estimation
 
Templates in C++
Templates in C++Templates in C++
Templates in C++
 
String & its application
String & its applicationString & its application
String & its application
 
Statistical quality__control_2
Statistical  quality__control_2Statistical  quality__control_2
Statistical quality__control_2
 
Stack data structure
Stack data structureStack data structure
Stack data structure
 
Stack Data Structure & It's Application
Stack Data Structure & It's Application Stack Data Structure & It's Application
Stack Data Structure & It's Application
 
Spss
SpssSpss
Spss
 
Spanning trees & applications
Spanning trees & applicationsSpanning trees & applications
Spanning trees & applications
 
Set data structure 2
Set data structure 2Set data structure 2
Set data structure 2
 
Set data structure
Set data structure Set data structure
Set data structure
 
Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Parsing
ParsingParsing
Parsing
 
Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)Mouse interrupts (Assembly Language & C)
Mouse interrupts (Assembly Language & C)
 
Motherboard of a pc
Motherboard of a pcMotherboard of a pc
Motherboard of a pc
 
More on Lex
More on LexMore on Lex
More on Lex
 
MultiMedia dbms
MultiMedia dbmsMultiMedia dbms
MultiMedia dbms
 
Merging files (Data Structure)
Merging files (Data Structure)Merging files (Data Structure)
Merging files (Data Structure)
 
Memory dbms
Memory dbmsMemory dbms
Memory dbms
 

Dernier

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 

Dernier (20)

"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 

B tree

  • 2. INTRODUCTION A B+ tree is a balanced tree in which every path from the root of the tree to a leaf is of the same length, and each non leaf node of the tree has between [n/2] and [n] children, where n is fixed for a particular tree.  In a B+ tree, in contrast to a B-tree, all records are stored at the leaf level of the tree; only keys are stored in internal nodes.  All the leaf nodes are interconnected for faster access.  Fill factor is 50%.
  • 3. EXAMPLE  B+ Trees use a "fill factor" to control the growth and the shrinkage. A 50% fill factor would be the minimum for any B+. Example : A B+ tree of order 5.  Number of Keys 4  Number of Pointers 5  Fill Factor 50%  Minimum Keys in each node 2
  • 4. B+ TREE INTERNAL NODE / INDEX nodeS LEAF NODES / DATA nodeS The linked list allows rapid in-order traversal.
  • 5. OPERATIONS IN B+ TREE  SEARCH  INSERTION  DELETION
  • 6. B+ TREE- SEARCH OPERATION TWO CASES:  Successful Search  Unsuccessful Search
  • 7. SEARCHING  Compare the key value with the data in the tree, then give the result back. For example: find the value 45, and 15 in below tree.
  • 8. B+ TREE- INSERTION OPERATION Inserting a record when Case 1:If both leaf node and index node is not full. Case 2:If leaf node is full and index node is not full. Case 3:If both leaf node and index node is full.
  • 9. INSERTION –CASE 1 Add Record with Key 28
  • 10. INSERTION –CASE 2 Adding a record when the leaf node is full but the index node is not full. Add Record with Key 70
  • 11. • This record should go in the leaf node containing 50, 55, 60, and 65. Left Leaf node Right Leaf node 50 55 60 65 70 AFTER INSERTING A Record With Key 70.
  • 12. INSERTION –CASE 3 Adding a record when both the leaf node and the index node are full. Add a record containing a key value of 95 to the following tree.
  • 13. This record belongs in the node containing 75, 80, 85, and 90. Since this node is full we split it into two nodes: Left Leaf Node Right Leaf node 75 80 85 90 95 The middle key, 85, rises to the index node. But the index node is also full, so we split the index node: Left Index node Right Index node New Index node 25 50 75 85 60
  • 14. After the record containing 95 is inserted. Leaf nodes are at same level only.
  • 15. B+ TREE – DELETION OPERATION Deleting a record from B+ tree may result in Case 1: If both the leaf node and index node does not go below the fill factor. Case 2: If the leaf node goes below fill factor and index node does not go below the fill factor. Case 3: If both the leaf node and index node goes below the fill factor.
  • 16. DELETION –CASE 1 If both the leaf node and index node does not go below the fill factor. Delete 70 from the following B+ Tree
  • 17. This node will contain 2 records after the deletion. So, simply delete 70 from the leaf node.
  • 18. Delete 25 from the B+ tree  when we delete 25 we must replace it with 28 in the index node.
  • 19. DELETE 60 FROM THE B+ TREE  The leaf node containing 60 will be below the fill factor after the deletion. Thus, we must combine leaf nodes.  With recombined nodes, the index node will be reduced by one key. Hence, it will also fall below the fill factor. Thus, we must combine index nodes.  60 appears as the only key in the root index node.
  • 20. After deleting 60
  • 21. B+ TREES AS FILE INDEXES  B+ Trees are descendants of B Trees.  Retrieval of records from large files or databases stored in external memory is time consuming.  To promote Efficient Retrievals, file indexes are used.  An index is a <Key , Address> pair.
  • 22.  The records of the file are sequentially stored and for each block of records, the largest key and the block address is stored in an index.  InB+ Tree to retrieve a record given its key, it is essential that the search traverses down to a leaf node to retrieve its address.  The non leaf nodes only serve to help the process traverse downwards towards the appropriate leaf node.
  • 23. ADVANTAGE OF B+ TREE  B+ Trees are much easier and higher performing to do a full scan, since the terminal nodes form a linked list.  But to do a full scan in B tree, a complete inorder traversal is to be made. DISADVANTAGE OF B+ TREE  Any search will end at leaf node only.  Time complexity for every search results in O(h). H-height of the B+ tree.  Waste of Memory.  In comparing to B+ trees, B trees are efficient.