SlideShare a Scribd company logo
1 of 83
Submitted By
Ujjwal matoliya
Atal Bihari Vajpayee Vishwavidyalaya
Department of Computer Science and Information
It stand for multi-way search tree
m-WAY Search Trees
It stand for multi-way search tree
Multi-way search trees are a generalized version
of binary trees
m-WAY Search Trees
It stand for multi-way search tree
Multi-way search trees are a generalized version
of binary trees
That allow for efficient data searching and sorting
m-WAY Search Trees
It stand for multi-way search tree
Multi-way search trees are a generalized version
of binary trees
That allow for efficient data searching and sorting
In contrast to binary search trees, which can only
have two children per node
m-WAY Search Trees
It stand for multi-way search tree
Multi-way search trees are a generalized version
of binary trees
That allow for efficient data searching and sorting
In contrast to binary search trees, which can only
have two children per node
Multi-way search trees can have multiple children
per node
m-WAY Search Trees
m-WAY Search Trees
25
20 40
16 22 35 45
m-WAY Search Trees
25
20 40
16 22 35 45
Binary search Tree
m-WAY Search Trees
25
20 40
16 22 35 45
Binary search Tree
10 50 70
30 60
M-way search Tree
P0 K P1
P0 K P1 P0 K P1
P0 K P1 P0 K P1 P0 K P1 P0 K P1
Binary search Tree
P0 K1 P1 K2 P3
P0 K1 P1 K2 P3 P0 K1 P1 K2 P3
P0 K1 P1 K2 P3
M-way search Tree
K=
K= KEY
K= KEY = Element
K= KEY = Element
P=
K= KEY = Element
P= Pointer
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
P0 K1 P1 K2 P3
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
P0 K1 P1 K2 P3 - - - - -
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
P0 K1 P1 K2 P3 - - - - - K m-1
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
P0 K1 P1 K2 P3 - - - - - K m-1 P m
K= KEY = Element
P= Pointer = a variable that stores the memory address of
another variable as its value
P0 K1 P1 K2 P3 - - - - - K m-1 P m-1
Types of Multi-way Search Trees
Types of Multi-way Search Trees
There are several types of multi-way search
trees, each with unique features and use
cases.
The two common types are
Types of Multi-way Search Trees
There are several types of multi-way search
trees, each with unique features and use
cases.
The two common types are
2-3 Tree and B-Tree.
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
2-3 Trees
Properties of 2-3 tree
Nodes with two children are called 2-nodes. The 2-
nodes have one data value and two children
Nodes with three children are called 3-nodes. The 3-
nodes have two data values and three children.
Data is stored in sorted order.
It is a balanced tree.
All the leaf nodes are at same level.
Each node can either be leaf, 2 node, or 3 node.
Always insertion is done at leaf.
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
Leaf node
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
Leaf node 2- node
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
Leaf node 2- node
2- children
And one data element
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
Leaf node 2- node
2- children
And one data element
3- node
2-3 Trees
2-3 trees are the data structure same as trees,
but it has some different properties like any
node can have either single value or double
value. So, there are two types of nodes in 2-3
trees:
It contain 3 different kind of node
Leaf node 2- node
2- children
And one data element
3- node
3- children
And two data element
It contain 3 different kind of node
Leaf node
2- node
2- children
And one data element
3- node
3- children
And two data element
10 50
30
It contain 3 different kind of node
Leaf node
2- node
2- children
And one data element
3- node
3- children
And two data element
10 50
30
It contain 3 different kind of node
Leaf node
2- node
2- children
And one data element
3- node
3- children
And two data element
10 50
30
10 50 70
30 60
Ex – 50, 30 , 10 , 70 , 60
50
Ex – 50, 30 , 10 , 70 , 60
50
30
Ex – 50, 30 , 10 , 70 , 60
50
30
Ex – 50, 30 , 10 , 70 , 60
30 50
Ex – 50, 30 , 10 , 70 , 60
50
10
30 50
Ex – 50, 30 , 10 , 70 , 60
10 30 50
Ex – 50, 30 , 10 , 70 , 60
10 50
30
Ex – 50, 30 , 10 , 70 , 60
10 50
30
Ex – 50, 30 , 10 , 70 , 60
10 50 70
30
Ex – 50, 30 , 10 , 70 , 60
10 50 70
30
60
Ex – 50, 30 , 10 , 70 , 60
10 50 70
30
60
Ex – 50, 30 , 10 , 70 , 60
10 50 60 70
30
Ex – 50, 30 , 10 , 70 , 60
10 50 60 70
30
Ex – 50, 30 , 10 , 70 , 60
10 50 60 70
30
Ex – 50, 30 , 10 , 70 , 60
10 50 60 70
30
Ex – 50, 30 , 10 , 70 , 60
10 50 70
30 60
Ex – 50, 30 , 10 , 70 , 60
10 50 70
30 60
Ex – 50, 30 , 10 , 70 , 60
Search:
If T is empty, return False (key cannot be found in
the tree).
If current node contains data value which is equal
to K, return True.
If we reach the leaf-node and it doesn’t contain the
required key value K, return False.
Recursive Calls:
If K < currentNode.leftVal, we explore the left
subtree of the current node.
Else if currentNode.leftVal < K <
currentNode.rightVal, we explore the middle subtree
of the current node.
Else if K > currentNode.rightVal, we explore the
right subtree of the current node.
Insertion:
Insertion:
There are 3 possible cases in insertion which have
been discussed below:
Insertion:
There are 3 possible cases in insertion which have
been discussed below:
Case 1: Insert in a node with only one data
element
Insertion:
There are 3 possible cases in insertion which have
been discussed below:
Case 1: Insert in a node with only one data element
Case 2: Insert in a node with two data elements
whose parent contains only one data element.
Case 2: Insert in a node with two data elements
whose parent contains only one data element.
10 50 60
30
Case 2: Insert in a node with two data elements
whose parent contains only one data element.
10 50 60 70
30
Case 2: Insert in a node with two data elements
whose parent contains only one data element.
10 50 70
30 60
Insertion:
There are 3 possible cases in insertion which have
been discussed below:
Case 1: Insert in a node with only one data element
Case 2: Insert in a node with two data elements
whose parent contains only one data element.
Case 3: Insert in a node with two data elements
whose parent also contains two data elements.
2 6 10
5 9
2 4 6 10
5 9
1
2 4 6 10
5 9
1
1 4 6 10
2 5 9
1 4 6 10
2 5 9
Move the middle element to the parent and split
the current node
Deletion
To delete a value, it is replaced by its in-order
successor and then removed.
If a node is left with less than one data value then
two nodes must be merged together.
If a node becomes empty after deleting a value, it is
then merged with another node.
Deletion
54
36 69 90
18 27 45 63 72 81 99
Deletion- To delete 69, swap it with its in-order successor, that is, 72. 69 now comes in the
leaf node. Remove the value 69 from the leaf node.
54
36 69 90
18 27 45 63 72 81 99
Deletion- To delete 69, swap it with its in-order successor, that is, 72. 69 now comes in the
leaf node. Remove the value 69 from the leaf node.
54
36 72 90
18 27 45 63 81 99
Delete 72, 72 is an internal node. To delete this value swap 72 with its in-order successor 81 so
that 72 now becomes a leaf node. Remove the value 72 from the leaf node.
node. 54
36 72 90
18 27 45 63 81 99
Delete 72, 72 is an internal node. To delete this value swap 72 with its in-order successor 81 so
that 72 now becomes a leaf node. Remove the value 72 from the leaf node.
node. 54
36 81 90
18 27 45 63 - 99
Now there is a leaf node that has less than 1 data value
thereby violating the property of a 2-3 tree. So the
node must be merged.
To merge the node, pull down the lowest data value in
the parent’s node and merge it with its left sibling.
Delete , 99 is present in a leaf node, so the data value can be easily
removed.
.
54
36 90
18 27 45 63 81 99
Delete , 99 is present in a leaf node, so the data value can be easily
removed.
.
54
36 81
18 27 45 63 90
delete 81, 81 is an internal node. To delete this value
swap 81 with its in-order successor 90 so that 81 now
becomes a leaf node. Remove the value 81 from the
leaf node.
Now there is a leaf node that has less than 1 data
value, thereby violating the property of a 2-3 tree. So
the node must be merged. To merge the node, pull
down the lowest data value in the parent’s node and
merge it with its left sibling.
.
54
36 90
18 27 45 63 -
.
54
36 -
18 27 45 63 90
.
36 54
18 27 45 63 90
As internal node cannot be empty. So now pull down
the lowest data value from the parent’s node and
merge the empty node with its left sibling
2-3 tree ujjwal matoliya .pptx

More Related Content

Similar to 2-3 tree ujjwal matoliya .pptx

Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Treesagar yadav
 
Binary Tree - Algorithms
Binary Tree - Algorithms Binary Tree - Algorithms
Binary Tree - Algorithms CourseHunt
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptSeethaDinesh
 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil duttAnil Dutt
 
Final tree.ppt tells about tree presentation
Final tree.ppt tells about tree presentationFinal tree.ppt tells about tree presentation
Final tree.ppt tells about tree presentationnakulvarshney371
 
TREE DATA STRUCTURE SLIDES dsa dsa .pptx
TREE DATA STRUCTURE SLIDES dsa dsa .pptxTREE DATA STRUCTURE SLIDES dsa dsa .pptx
TREE DATA STRUCTURE SLIDES dsa dsa .pptxasimshahzad8611
 
Binary tree and operations
Binary tree and operations Binary tree and operations
Binary tree and operations varagilavanya
 
trees in data structure
trees in data structure trees in data structure
trees in data structure shameen khan
 
Unit III - NON LINEAR DATA STRUCTURES
Unit III -  NON LINEAR DATA STRUCTURESUnit III -  NON LINEAR DATA STRUCTURES
Unit III - NON LINEAR DATA STRUCTURESUsha Mahalingam
 

Similar to 2-3 tree ujjwal matoliya .pptx (20)

TREES.pptx
TREES.pptxTREES.pptx
TREES.pptx
 
2 3 tree
2 3 tree2 3 tree
2 3 tree
 
2-3 trees in c++
2-3 trees in c++2-3 trees in c++
2-3 trees in c++
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Tree.pptx
Tree.pptxTree.pptx
Tree.pptx
 
Binary Trees
Binary TreesBinary Trees
Binary Trees
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Binary Tree - Algorithms
Binary Tree - Algorithms Binary Tree - Algorithms
Binary Tree - Algorithms
 
08 B Trees
08 B Trees08 B Trees
08 B Trees
 
Unit 5 Tree.pptx
Unit 5 Tree.pptxUnit 5 Tree.pptx
Unit 5 Tree.pptx
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
 
Introduction to data structure by anil dutt
Introduction to data structure by anil duttIntroduction to data structure by anil dutt
Introduction to data structure by anil dutt
 
Final tree.ppt tells about tree presentation
Final tree.ppt tells about tree presentationFinal tree.ppt tells about tree presentation
Final tree.ppt tells about tree presentation
 
TREE DATA STRUCTURE SLIDES dsa dsa .pptx
TREE DATA STRUCTURE SLIDES dsa dsa .pptxTREE DATA STRUCTURE SLIDES dsa dsa .pptx
TREE DATA STRUCTURE SLIDES dsa dsa .pptx
 
BINARY SEARCH TREE
BINARY SEARCH TREEBINARY SEARCH TREE
BINARY SEARCH TREE
 
UNIT-4 TREES.ppt
UNIT-4 TREES.pptUNIT-4 TREES.ppt
UNIT-4 TREES.ppt
 
Binary tree and operations
Binary tree and operations Binary tree and operations
Binary tree and operations
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
Unit III - NON LINEAR DATA STRUCTURES
Unit III -  NON LINEAR DATA STRUCTURESUnit III -  NON LINEAR DATA STRUCTURES
Unit III - NON LINEAR DATA STRUCTURES
 

More from ujjwalmatoliya

kisan bill ujjwal matoliya.pptx
kisan bill ujjwal matoliya.pptxkisan bill ujjwal matoliya.pptx
kisan bill ujjwal matoliya.pptxujjwalmatoliya
 
Data Frames and Scatterplots in R language ujjwal matoliya.pptx
Data Frames and Scatterplots in R language ujjwal matoliya.pptxData Frames and Scatterplots in R language ujjwal matoliya.pptx
Data Frames and Scatterplots in R language ujjwal matoliya.pptxujjwalmatoliya
 
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptx
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptxFloyd’s and Warshal’s Algorithm ujjwal matoliya.pptx
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptxujjwalmatoliya
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxujjwalmatoliya
 
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptx
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptxGlobal Attributes Window Event Attributes Form Events Ujjwal matoliya.pptx
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptxujjwalmatoliya
 
Instruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxInstruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxujjwalmatoliya
 
javascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptxjavascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptxujjwalmatoliya
 
string functions in SQL ujjwal matoliya.pptx
string functions in SQL ujjwal matoliya.pptxstring functions in SQL ujjwal matoliya.pptx
string functions in SQL ujjwal matoliya.pptxujjwalmatoliya
 
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
 jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptxujjwalmatoliya
 
compiler design ujjwal matoliya 2nd sem MCA.pptx
compiler design ujjwal matoliya 2nd sem MCA.pptxcompiler design ujjwal matoliya 2nd sem MCA.pptx
compiler design ujjwal matoliya 2nd sem MCA.pptxujjwalmatoliya
 
3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptx3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptxujjwalmatoliya
 
Graph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptxGraph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptxujjwalmatoliya
 
Quick Sort in data structure.pptx
Quick Sort in data structure.pptxQuick Sort in data structure.pptx
Quick Sort in data structure.pptxujjwalmatoliya
 
Hadoop With R language.pptx
Hadoop With R language.pptxHadoop With R language.pptx
Hadoop With R language.pptxujjwalmatoliya
 
cyclomatic complecity.pptx
cyclomatic complecity.pptxcyclomatic complecity.pptx
cyclomatic complecity.pptxujjwalmatoliya
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptxujjwalmatoliya
 
Game playing With AI.pptx
Game playing With AI.pptxGame playing With AI.pptx
Game playing With AI.pptxujjwalmatoliya
 

More from ujjwalmatoliya (20)

kisan bill ujjwal matoliya.pptx
kisan bill ujjwal matoliya.pptxkisan bill ujjwal matoliya.pptx
kisan bill ujjwal matoliya.pptx
 
Data Frames and Scatterplots in R language ujjwal matoliya.pptx
Data Frames and Scatterplots in R language ujjwal matoliya.pptxData Frames and Scatterplots in R language ujjwal matoliya.pptx
Data Frames and Scatterplots in R language ujjwal matoliya.pptx
 
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptx
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptxFloyd’s and Warshal’s Algorithm ujjwal matoliya.pptx
Floyd’s and Warshal’s Algorithm ujjwal matoliya.pptx
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
 
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptx
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptxGlobal Attributes Window Event Attributes Form Events Ujjwal matoliya.pptx
Global Attributes Window Event Attributes Form Events Ujjwal matoliya.pptx
 
Instruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxInstruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptx
 
javascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptxjavascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptx
 
string functions in SQL ujjwal matoliya.pptx
string functions in SQL ujjwal matoliya.pptxstring functions in SQL ujjwal matoliya.pptx
string functions in SQL ujjwal matoliya.pptx
 
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
 jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
jdbc Java Database Connectivity ujjwal matoliya jdbc.pptx
 
compiler design ujjwal matoliya 2nd sem MCA.pptx
compiler design ujjwal matoliya 2nd sem MCA.pptxcompiler design ujjwal matoliya 2nd sem MCA.pptx
compiler design ujjwal matoliya 2nd sem MCA.pptx
 
3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptx3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptx
 
Graph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptxGraph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptx
 
Quick Sort in data structure.pptx
Quick Sort in data structure.pptxQuick Sort in data structure.pptx
Quick Sort in data structure.pptx
 
Hadoop With R language.pptx
Hadoop With R language.pptxHadoop With R language.pptx
Hadoop With R language.pptx
 
LOGIC FAMILY.pptx
LOGIC FAMILY.pptxLOGIC FAMILY.pptx
LOGIC FAMILY.pptx
 
Transaction.pptx
Transaction.pptxTransaction.pptx
Transaction.pptx
 
cyclomatic complecity.pptx
cyclomatic complecity.pptxcyclomatic complecity.pptx
cyclomatic complecity.pptx
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
 
computer graphic.pptx
computer graphic.pptxcomputer graphic.pptx
computer graphic.pptx
 
Game playing With AI.pptx
Game playing With AI.pptxGame playing With AI.pptx
Game playing With AI.pptx
 

Recently uploaded

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
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
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 

Recently uploaded (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
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
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
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
 
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
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
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
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 

2-3 tree ujjwal matoliya .pptx

  • 1. Submitted By Ujjwal matoliya Atal Bihari Vajpayee Vishwavidyalaya Department of Computer Science and Information
  • 2. It stand for multi-way search tree m-WAY Search Trees
  • 3. It stand for multi-way search tree Multi-way search trees are a generalized version of binary trees m-WAY Search Trees
  • 4. It stand for multi-way search tree Multi-way search trees are a generalized version of binary trees That allow for efficient data searching and sorting m-WAY Search Trees
  • 5. It stand for multi-way search tree Multi-way search trees are a generalized version of binary trees That allow for efficient data searching and sorting In contrast to binary search trees, which can only have two children per node m-WAY Search Trees
  • 6. It stand for multi-way search tree Multi-way search trees are a generalized version of binary trees That allow for efficient data searching and sorting In contrast to binary search trees, which can only have two children per node Multi-way search trees can have multiple children per node m-WAY Search Trees
  • 7. m-WAY Search Trees 25 20 40 16 22 35 45
  • 8. m-WAY Search Trees 25 20 40 16 22 35 45 Binary search Tree
  • 9. m-WAY Search Trees 25 20 40 16 22 35 45 Binary search Tree 10 50 70 30 60 M-way search Tree
  • 10. P0 K P1 P0 K P1 P0 K P1 P0 K P1 P0 K P1 P0 K P1 P0 K P1 Binary search Tree
  • 11. P0 K1 P1 K2 P3 P0 K1 P1 K2 P3 P0 K1 P1 K2 P3 P0 K1 P1 K2 P3 M-way search Tree
  • 12. K=
  • 14. K= KEY = Element
  • 15. K= KEY = Element P=
  • 16. K= KEY = Element P= Pointer
  • 17. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value
  • 18. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value P0 K1 P1 K2 P3
  • 19. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value P0 K1 P1 K2 P3 - - - - -
  • 20. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value P0 K1 P1 K2 P3 - - - - - K m-1
  • 21. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value P0 K1 P1 K2 P3 - - - - - K m-1 P m
  • 22. K= KEY = Element P= Pointer = a variable that stores the memory address of another variable as its value P0 K1 P1 K2 P3 - - - - - K m-1 P m-1
  • 23. Types of Multi-way Search Trees
  • 24. Types of Multi-way Search Trees There are several types of multi-way search trees, each with unique features and use cases. The two common types are
  • 25. Types of Multi-way Search Trees There are several types of multi-way search trees, each with unique features and use cases. The two common types are 2-3 Tree and B-Tree.
  • 26. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees:
  • 27. 2-3 Trees Properties of 2-3 tree Nodes with two children are called 2-nodes. The 2- nodes have one data value and two children Nodes with three children are called 3-nodes. The 3- nodes have two data values and three children. Data is stored in sorted order. It is a balanced tree. All the leaf nodes are at same level. Each node can either be leaf, 2 node, or 3 node. Always insertion is done at leaf.
  • 28. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node
  • 29. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node Leaf node
  • 30. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node Leaf node 2- node
  • 31. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node Leaf node 2- node 2- children And one data element
  • 32. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node Leaf node 2- node 2- children And one data element 3- node
  • 33. 2-3 Trees 2-3 trees are the data structure same as trees, but it has some different properties like any node can have either single value or double value. So, there are two types of nodes in 2-3 trees: It contain 3 different kind of node Leaf node 2- node 2- children And one data element 3- node 3- children And two data element
  • 34. It contain 3 different kind of node Leaf node 2- node 2- children And one data element 3- node 3- children And two data element 10 50 30
  • 35. It contain 3 different kind of node Leaf node 2- node 2- children And one data element 3- node 3- children And two data element 10 50 30
  • 36. It contain 3 different kind of node Leaf node 2- node 2- children And one data element 3- node 3- children And two data element 10 50 30 10 50 70 30 60
  • 37.
  • 38. Ex – 50, 30 , 10 , 70 , 60
  • 39. 50 Ex – 50, 30 , 10 , 70 , 60
  • 40. 50 30 Ex – 50, 30 , 10 , 70 , 60
  • 41. 50 30 Ex – 50, 30 , 10 , 70 , 60
  • 42. 30 50 Ex – 50, 30 , 10 , 70 , 60
  • 43. 50 10 30 50 Ex – 50, 30 , 10 , 70 , 60
  • 44. 10 30 50 Ex – 50, 30 , 10 , 70 , 60
  • 45. 10 50 30 Ex – 50, 30 , 10 , 70 , 60
  • 46. 10 50 30 Ex – 50, 30 , 10 , 70 , 60
  • 47. 10 50 70 30 Ex – 50, 30 , 10 , 70 , 60
  • 48. 10 50 70 30 60 Ex – 50, 30 , 10 , 70 , 60
  • 49. 10 50 70 30 60 Ex – 50, 30 , 10 , 70 , 60
  • 50. 10 50 60 70 30 Ex – 50, 30 , 10 , 70 , 60
  • 51. 10 50 60 70 30 Ex – 50, 30 , 10 , 70 , 60
  • 52. 10 50 60 70 30 Ex – 50, 30 , 10 , 70 , 60
  • 53. 10 50 60 70 30 Ex – 50, 30 , 10 , 70 , 60
  • 54. 10 50 70 30 60 Ex – 50, 30 , 10 , 70 , 60
  • 55. 10 50 70 30 60 Ex – 50, 30 , 10 , 70 , 60
  • 56. Search: If T is empty, return False (key cannot be found in the tree). If current node contains data value which is equal to K, return True. If we reach the leaf-node and it doesn’t contain the required key value K, return False. Recursive Calls: If K < currentNode.leftVal, we explore the left subtree of the current node. Else if currentNode.leftVal < K < currentNode.rightVal, we explore the middle subtree of the current node. Else if K > currentNode.rightVal, we explore the right subtree of the current node.
  • 58. Insertion: There are 3 possible cases in insertion which have been discussed below:
  • 59. Insertion: There are 3 possible cases in insertion which have been discussed below: Case 1: Insert in a node with only one data element
  • 60. Insertion: There are 3 possible cases in insertion which have been discussed below: Case 1: Insert in a node with only one data element Case 2: Insert in a node with two data elements whose parent contains only one data element.
  • 61. Case 2: Insert in a node with two data elements whose parent contains only one data element. 10 50 60 30
  • 62. Case 2: Insert in a node with two data elements whose parent contains only one data element. 10 50 60 70 30
  • 63. Case 2: Insert in a node with two data elements whose parent contains only one data element. 10 50 70 30 60
  • 64. Insertion: There are 3 possible cases in insertion which have been discussed below: Case 1: Insert in a node with only one data element Case 2: Insert in a node with two data elements whose parent contains only one data element. Case 3: Insert in a node with two data elements whose parent also contains two data elements.
  • 65. 2 6 10 5 9
  • 66. 2 4 6 10 5 9 1
  • 67. 2 4 6 10 5 9 1
  • 68. 1 4 6 10 2 5 9
  • 69. 1 4 6 10 2 5 9 Move the middle element to the parent and split the current node
  • 70. Deletion To delete a value, it is replaced by its in-order successor and then removed. If a node is left with less than one data value then two nodes must be merged together. If a node becomes empty after deleting a value, it is then merged with another node.
  • 71. Deletion 54 36 69 90 18 27 45 63 72 81 99
  • 72. Deletion- To delete 69, swap it with its in-order successor, that is, 72. 69 now comes in the leaf node. Remove the value 69 from the leaf node. 54 36 69 90 18 27 45 63 72 81 99
  • 73. Deletion- To delete 69, swap it with its in-order successor, that is, 72. 69 now comes in the leaf node. Remove the value 69 from the leaf node. 54 36 72 90 18 27 45 63 81 99
  • 74. Delete 72, 72 is an internal node. To delete this value swap 72 with its in-order successor 81 so that 72 now becomes a leaf node. Remove the value 72 from the leaf node. node. 54 36 72 90 18 27 45 63 81 99
  • 75. Delete 72, 72 is an internal node. To delete this value swap 72 with its in-order successor 81 so that 72 now becomes a leaf node. Remove the value 72 from the leaf node. node. 54 36 81 90 18 27 45 63 - 99
  • 76. Now there is a leaf node that has less than 1 data value thereby violating the property of a 2-3 tree. So the node must be merged. To merge the node, pull down the lowest data value in the parent’s node and merge it with its left sibling.
  • 77. Delete , 99 is present in a leaf node, so the data value can be easily removed. . 54 36 90 18 27 45 63 81 99
  • 78. Delete , 99 is present in a leaf node, so the data value can be easily removed. . 54 36 81 18 27 45 63 90
  • 79. delete 81, 81 is an internal node. To delete this value swap 81 with its in-order successor 90 so that 81 now becomes a leaf node. Remove the value 81 from the leaf node. Now there is a leaf node that has less than 1 data value, thereby violating the property of a 2-3 tree. So the node must be merged. To merge the node, pull down the lowest data value in the parent’s node and merge it with its left sibling.
  • 80. . 54 36 90 18 27 45 63 -
  • 81. . 54 36 - 18 27 45 63 90
  • 82. . 36 54 18 27 45 63 90 As internal node cannot be empty. So now pull down the lowest data value from the parent’s node and merge the empty node with its left sibling