SlideShare a Scribd company logo
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

TREES.pptx
TREES.pptxTREES.pptx
2 3 tree
2 3 tree2 3 tree
2-3 trees in c++
2-3 trees in c++2-3 trees in c++
2-3 trees in c++
Faisal Hayat
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
sagar yadav
 
Tree.pptx
Tree.pptxTree.pptx
Tree.pptx
worldchannel
 
Binary Trees
Binary TreesBinary Trees
Binary Trees
Sadaf Ismail
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
Ashish Arun
 
Binary Tree - Algorithms
Binary Tree - Algorithms Binary Tree - Algorithms
Binary Tree - Algorithms
CourseHunt
 
08 B Trees
08 B Trees08 B Trees
08 B Trees
guestf7d226
 
Unit 5 Tree.pptx
Unit 5 Tree.pptxUnit 5 Tree.pptx
Unit 5 Tree.pptx
SurajSharma266169
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
SeethaDinesh
 
Binary Search Tree
Binary Search TreeBinary Search Tree
Binary Search Tree
VijayaLakshmi506
 
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
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
nakulvarshney371
 
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
asimshahzad8611
 
BINARY SEARCH TREE
BINARY SEARCH TREEBINARY SEARCH TREE
BINARY SEARCH TREE
ER Punit Jain
 
UNIT-4 TREES.ppt
UNIT-4 TREES.pptUNIT-4 TREES.ppt
UNIT-4 TREES.ppt
SIVAKUMARM603675
 
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 STRUCTURES
Usha 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.pptx
ujjwalmatoliya
 
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
ujjwalmatoliya
 
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
ujjwalmatoliya
 
congestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptxcongestion ujjwal matoliya.pptx
congestion ujjwal matoliya.pptx
ujjwalmatoliya
 
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
ujjwalmatoliya
 
Instruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptxInstruction format UJJWAL MATOLIYA.pptx
Instruction format UJJWAL MATOLIYA.pptx
ujjwalmatoliya
 
javascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptxjavascript function ujjwal matoliya.pptx
javascript function ujjwal matoliya.pptx
ujjwalmatoliya
 
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
ujjwalmatoliya
 
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
ujjwalmatoliya
 
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
ujjwalmatoliya
 
3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptx3 address code ujjwal matoliya.pptx
3 address code ujjwal matoliya.pptx
ujjwalmatoliya
 
Graph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptxGraph in Discrete mathemaetics.pptx
Graph in Discrete mathemaetics.pptx
ujjwalmatoliya
 
Quick Sort in data structure.pptx
Quick Sort in data structure.pptxQuick Sort in data structure.pptx
Quick Sort in data structure.pptx
ujjwalmatoliya
 
Hadoop With R language.pptx
Hadoop With R language.pptxHadoop With R language.pptx
Hadoop With R language.pptx
ujjwalmatoliya
 
LOGIC FAMILY.pptx
LOGIC FAMILY.pptxLOGIC FAMILY.pptx
LOGIC FAMILY.pptx
ujjwalmatoliya
 
Transaction.pptx
Transaction.pptxTransaction.pptx
Transaction.pptx
ujjwalmatoliya
 
cyclomatic complecity.pptx
cyclomatic complecity.pptxcyclomatic complecity.pptx
cyclomatic complecity.pptx
ujjwalmatoliya
 
Congestion control algorithms.pptx
Congestion control algorithms.pptxCongestion control algorithms.pptx
Congestion control algorithms.pptx
ujjwalmatoliya
 
computer graphic.pptx
computer graphic.pptxcomputer graphic.pptx
computer graphic.pptx
ujjwalmatoliya
 
Game playing With AI.pptx
Game playing With AI.pptxGame playing With AI.pptx
Game playing With AI.pptx
ujjwalmatoliya
 

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

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
Dr. Shivangi Singh Parihar
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
Nicholas Montgomery
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 

Recently uploaded (20)

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.PCOS corelations and management through Ayurveda.
PCOS corelations and management through Ayurveda.
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
Film vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movieFilm vocab for eal 3 students: Australia the movie
Film vocab for eal 3 students: Australia the movie
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 

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