SlideShare a Scribd company logo
1 of 37
2-3 Trees Lecture 16
Contents ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
INTRODUCTION ,[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
A 2-3 Tree of height 3
 
 
 
 
2-3 Tree vs. Binary Tree ,[object Object],[object Object],[object Object]
Cont. ,[object Object],[object Object],[object Object]
Example of a 2-3 Tree ,[object Object],80 160 50  90 20 70 120  150 10 30  40 60 100  110
Node Representation of 2-3 Trees ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Node Representation of 2-3 Tree (cont.) ,[object Object],[object Object]
 
The Advantages of the 2-3 trees ,[object Object],[object Object]
Consider the two trees contain the same data items. 30 90 10 50 20 40 80 70 100 60 A balanced binary search tree 50 30 40 60 80 100 70  90 10  20 A 2-3 tree
Inserting into a 2-3 Tree ,[object Object],[object Object]
60 30 90 30 50 80 100 40 20 39 38 37 70 36 35 34 1) The binary search tree after a sequence of  insertions
37 34 50 30 35 60 39 38 40 80 100 36 10  20 70  90 2) The 2-3 tree after the same insertions.
Inserting into a 2-3 Tree (cont.) ,[object Object],50 30 60 80 100 70  90 10  20 39 40
Inserting into a 2-3 Tree (cont.) ,[object Object],38 40 30  10  20 39
Inserting into a 2-3 Tree (cont.) ,[object Object],40 30  39 10  20 37 38
The Insertion Algorithm ,[object Object],[object Object],[object Object]
The Insertion Algorithm (cont.) ,[object Object],P S L P S L S  M  L M  P S  M  L P  M a) b)
 
 
 
 
 
 
 
 
Deleting from a 2-3 Tree ,[object Object],[object Object]
Deleting from a 2-3 Tree (cont.) ,[object Object],60 70 100 80  90 Swap with inorder successor 60 - 100 80  90 Delete value from leaf 60 100 90 100 Merge nodes by deleting empty leaf and moving 80 down 80  90 60  80
Deleting from 2-3 Tree (cont.) ,[object Object],50 30 40 100 90 10  20 60  80
Deleting from 2-3 Tree (cont.) ,[object Object],90 -- 60  80 Delete value from leaf 90 60 80 Doesn’t work 80 60 90 Redistribute 60  80

More Related Content

What's hot (20)

Binary trees
Binary treesBinary trees
Binary trees
 
Unit 3 Tree chapter 5
Unit 3  Tree chapter 5Unit 3  Tree chapter 5
Unit 3 Tree chapter 5
 
Binary tree traversal ppt - 02.03.2020
Binary tree traversal   ppt - 02.03.2020Binary tree traversal   ppt - 02.03.2020
Binary tree traversal ppt - 02.03.2020
 
2-3 Tree
2-3 Tree2-3 Tree
2-3 Tree
 
Trees (data structure)
Trees (data structure)Trees (data structure)
Trees (data structure)
 
AVL Tree Data Structure
AVL Tree Data StructureAVL Tree Data Structure
AVL Tree Data Structure
 
Tree (Data Structure & Discrete Mathematics)
Tree (Data Structure & Discrete Mathematics)Tree (Data Structure & Discrete Mathematics)
Tree (Data Structure & Discrete Mathematics)
 
Chapter 8 ds
Chapter 8 dsChapter 8 ds
Chapter 8 ds
 
Inverse functions
Inverse functionsInverse functions
Inverse functions
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Nikhat b+ trees ppt
Nikhat b+ trees pptNikhat b+ trees ppt
Nikhat b+ trees ppt
 
B+tree Data structures presentation
B+tree Data structures presentationB+tree Data structures presentation
B+tree Data structures presentation
 
Binary tree
Binary  treeBinary  tree
Binary tree
 
1.5 binary search tree
1.5 binary search tree1.5 binary search tree
1.5 binary search tree
 
Binary tree
Binary tree Binary tree
Binary tree
 
Tree Traversal
Tree TraversalTree Traversal
Tree Traversal
 
Unit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptxUnit I-Data Structures_Intoduction.pptx
Unit I-Data Structures_Intoduction.pptx
 
Red black trees
Red black treesRed black trees
Red black trees
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 

Viewers also liked

Advanced data structures slide 1 2
Advanced data structures slide 1 2Advanced data structures slide 1 2
Advanced data structures slide 1 2jomerson remorosa
 
L7 decision tree & table
L7 decision tree & tableL7 decision tree & table
L7 decision tree & tableNeha Gupta
 
Elasticity of supply
Elasticity of supplyElasticity of supply
Elasticity of supplyRahul Patil
 
Price Elasticity of Supply
Price Elasticity of SupplyPrice Elasticity of Supply
Price Elasticity of Supplytutor2u
 
Elasticity of Supply
Elasticity of SupplyElasticity of Supply
Elasticity of Supplyitutor
 
Elasticity of Supply
Elasticity of SupplyElasticity of Supply
Elasticity of SupplyBrian Coil
 
PRICE ELASTICITY OF SUPPLY WITH EXAMPLES
PRICE ELASTICITY OF SUPPLY WITH EXAMPLESPRICE ELASTICITY OF SUPPLY WITH EXAMPLES
PRICE ELASTICITY OF SUPPLY WITH EXAMPLESShahi Raz Akhtar
 
Elasticity of Demand
Elasticity of DemandElasticity of Demand
Elasticity of Demanditutor
 
Supply and Demand
Supply and DemandSupply and Demand
Supply and DemandLina Nandy
 
Collins listening for_ielts_book
Collins listening for_ielts_bookCollins listening for_ielts_book
Collins listening for_ielts_bookkhimleader
 
17. Trees and Graphs
17. Trees and Graphs17. Trees and Graphs
17. Trees and GraphsIntro C# Book
 
Elasticity Of Supply And Demand
Elasticity Of Supply And DemandElasticity Of Supply And Demand
Elasticity Of Supply And DemandKevin A
 
The theory of demand and supply
The theory of demand and supplyThe theory of demand and supply
The theory of demand and supplyvinetarushad
 

Viewers also liked (20)

2 - 3 Trees
2 - 3 Trees2 - 3 Trees
2 - 3 Trees
 
23 Tree Best Part
23 Tree   Best Part23 Tree   Best Part
23 Tree Best Part
 
Graph theory
Graph theoryGraph theory
Graph theory
 
2-4 tree
2-4 tree2-4 tree
2-4 tree
 
Advanced data structures slide 1 2
Advanced data structures slide 1 2Advanced data structures slide 1 2
Advanced data structures slide 1 2
 
L7 decision tree & table
L7 decision tree & tableL7 decision tree & table
L7 decision tree & table
 
The Benefits of Trees Presentation
The Benefits of Trees PresentationThe Benefits of Trees Presentation
The Benefits of Trees Presentation
 
Elasticity of supply
Elasticity of supplyElasticity of supply
Elasticity of supply
 
Price Elasticity of Supply
Price Elasticity of SupplyPrice Elasticity of Supply
Price Elasticity of Supply
 
Elasticity of Supply
Elasticity of SupplyElasticity of Supply
Elasticity of Supply
 
Elasticity of Supply
Elasticity of SupplyElasticity of Supply
Elasticity of Supply
 
Chapter 20 elasticity of demand and supply
Chapter 20 elasticity of demand and supplyChapter 20 elasticity of demand and supply
Chapter 20 elasticity of demand and supply
 
PRICE ELASTICITY OF SUPPLY WITH EXAMPLES
PRICE ELASTICITY OF SUPPLY WITH EXAMPLESPRICE ELASTICITY OF SUPPLY WITH EXAMPLES
PRICE ELASTICITY OF SUPPLY WITH EXAMPLES
 
Elasticity of Demand
Elasticity of DemandElasticity of Demand
Elasticity of Demand
 
Supply and Demand
Supply and DemandSupply and Demand
Supply and Demand
 
Demand and supply
Demand and supplyDemand and supply
Demand and supply
 
Collins listening for_ielts_book
Collins listening for_ielts_bookCollins listening for_ielts_book
Collins listening for_ielts_book
 
17. Trees and Graphs
17. Trees and Graphs17. Trees and Graphs
17. Trees and Graphs
 
Elasticity Of Supply And Demand
Elasticity Of Supply And DemandElasticity Of Supply And Demand
Elasticity Of Supply And Demand
 
The theory of demand and supply
The theory of demand and supplyThe theory of demand and supply
The theory of demand and supply
 

Similar to 2-3 Tree Data Structure Explained

2-3 tree ujjwal matoliya .pptx
2-3 tree ujjwal matoliya .pptx2-3 tree ujjwal matoliya .pptx
2-3 tree ujjwal matoliya .pptxujjwalmatoliya
 
2-3 Tree, Everything you need to know
2-3 Tree,  Everything you need to know2-3 Tree,  Everything you need to know
2-3 Tree, Everything you need to knowLittbarski Santos
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures treemaamir farooq
 
Trees in Data Structure
Trees in Data StructureTrees in Data Structure
Trees in Data StructureOm Prakash
 
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
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary treeKrish_ver2
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresAmrinder Arora
 
BTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsBTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsAmrinder Arora
 
Unit III - NON LINEAR DATA STRUCTURES
Unit III -  NON LINEAR DATA STRUCTURESUnit III -  NON LINEAR DATA STRUCTURES
Unit III - NON LINEAR DATA STRUCTURESUsha Mahalingam
 
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
 

Similar to 2-3 Tree Data Structure Explained (20)

2-3 tree ujjwal matoliya .pptx
2-3 tree ujjwal matoliya .pptx2-3 tree ujjwal matoliya .pptx
2-3 tree ujjwal matoliya .pptx
 
Ch16
Ch16Ch16
Ch16
 
2-3 Tree, Everything you need to know
2-3 Tree,  Everything you need to know2-3 Tree,  Everything you need to know
2-3 Tree, Everything you need to know
 
Lecture notes data structures tree
Lecture notes data structures   treeLecture notes data structures   tree
Lecture notes data structures tree
 
Trees in Data Structure
Trees in Data StructureTrees in Data Structure
Trees in Data Structure
 
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
 
2-3 trees in c++
2-3 trees in c++2-3 trees in c++
2-3 trees in c++
 
1.1 binary tree
1.1 binary tree1.1 binary tree
1.1 binary tree
 
Unit 3.ppt
Unit 3.pptUnit 3.ppt
Unit 3.ppt
 
Data structures notes
Data structures notesData structures notes
Data structures notes
 
A41001011
A41001011A41001011
A41001011
 
R-Trees and Geospatial Data Structures
R-Trees and Geospatial Data StructuresR-Trees and Geospatial Data Structures
R-Trees and Geospatial Data Structures
 
BTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTsBTrees - Great alternative to Red Black, AVL and other BSTs
BTrees - Great alternative to Red Black, AVL and other BSTs
 
Unit III - NON LINEAR DATA STRUCTURES
Unit III -  NON LINEAR DATA STRUCTURESUnit III -  NON LINEAR DATA STRUCTURES
Unit III - NON LINEAR DATA STRUCTURES
 
Lecture 5 trees
Lecture 5 treesLecture 5 trees
Lecture 5 trees
 
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
 
Module 4.pptx
Module 4.pptxModule 4.pptx
Module 4.pptx
 
Binary tree
Binary treeBinary tree
Binary tree
 
08 B Trees
08 B Trees08 B Trees
08 B Trees
 
B trees
B treesB trees
B trees
 

More from Core Condor

More from Core Condor (6)

Weighted graphs
Weighted graphsWeighted graphs
Weighted graphs
 
Red black 2
Red black 2Red black 2
Red black 2
 
Red black 1
Red black 1Red black 1
Red black 1
 
Graph isomorphism
Graph isomorphismGraph isomorphism
Graph isomorphism
 
Disjoint sets
Disjoint setsDisjoint sets
Disjoint sets
 
Red blacktrees
Red blacktreesRed blacktrees
Red blacktrees
 

Recently uploaded

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 

Recently uploaded (20)

fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 

2-3 Tree Data Structure Explained

  • 2.
  • 3.
  • 4.
  • 5. A 2-3 Tree of height 3
  • 6.  
  • 7.  
  • 8.  
  • 9.  
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.  
  • 16.
  • 17. Consider the two trees contain the same data items. 30 90 10 50 20 40 80 70 100 60 A balanced binary search tree 50 30 40 60 80 100 70 90 10 20 A 2-3 tree
  • 18.
  • 19. 60 30 90 30 50 80 100 40 20 39 38 37 70 36 35 34 1) The binary search tree after a sequence of insertions
  • 20. 37 34 50 30 35 60 39 38 40 80 100 36 10 20 70 90 2) The 2-3 tree after the same insertions.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.  
  • 27.  
  • 28.  
  • 29.  
  • 30.  
  • 31.  
  • 32.  
  • 33.  
  • 34.
  • 35.
  • 36.
  • 37.