SlideShare a Scribd company logo
Presented By: M.Shahbaz
The Islamia University of Bahawalpur
Presented By: M.Shahbaz
Topic:
Splay Tree
Presented By:
Muhammad Shahbaz
The splay tree was invented by Daniel
Sleator and Robert Tarjan in 1985.[1]
A splay tree is a self-adjusting binary search tree with the
additional property that recently accessed elements are
quick to access again. ., splay trees perform better than
other search trees, even when the specific pattern of the
sequence is unknown
All normal operations on a binary search tree are combined
with one basic operation, called splaying.
oSplaying the tree for a certain element rearranges the
tree so that the element is placed at the root of the tree.
Presented By: M.Shahbaz
Presented By: M.Shahbaz
Splaying
When a node x is accessed, a splay operation is performed on x to move
it to the root. To perform a splay operation we carry out a sequence
of splay steps, each of which movesx closer to the root. By performing a
splay operation on the node of interest after every access, the recently
accessed nodes are kept near the root and the tree remains roughly
balanced, so that we achieve the desired amortized time bounds.
Each particular step depends on three factors:
Whether x is the left or right child of its parent node, p,
whether p is the root or not, and if not
whether p is the left or right child of its parent, g (the grandparent of x)..
Presented By: M.Shahbaz
Presented By: M.Shahbaz
Zig rotation:
this step is done when p is the root. The tree is rotated
on the edge between x and p. Zig steps exist to deal
with the parity issue and will be done only as the last
step in a splay operation and only when x has odd depth
at the beginning of the operation.
Presented By: M.Shahbaz
this step is done when p is not the root and x and p are either both right
children or are both left children. The picture below shows the case
where x and p are both left children. The tree is rotated on the edge
joining p with its parent g, then rotated on the edge joining x with p.
Note that zig-zig steps are the only thing that differentiate splay trees
from the rotate to root method introduced by Allen and Munro prior to
the introduction of splay trees.
Presented By: M.Shahbaz
this step is done when p is not the root and x is a right child
and p is a left child or vice versa. The tree is rotated on the edge
between p and x, and then rotated on the resulting edge
between x and g.
Presented By: M.Shahbaz
Starts the same as a BST with the new node
created at the a leaf. The new leaf node is
splayed until it becomes the root.
Splaying also occurs on
unsuccessful searches. The last
item on the access path is splayed
in this case.
Presented By: M.Shahbaz
Presented By: M.Shahbaz
• First access the node to force it to percolate
to the root.
• Remove the root.
• Determine the largest item in the left subtree
and rotate it to the root of the left subtree
which results in the left subtree new root
having no right child.
• The right subtree is then added as the right
child of the new root.
Presented By: M.Shahbaz
Presented By: M.Shahbaz
Good performance for a splay tree depends on the fact
that it is self-optimizing, in that frequently accessed nodes
will move nearer to the root where they can be accessed
more quickly. The worst-case height—though unlikely—is
O(n), with the average being O(log n).
Having frequently used nodes near the root is an
advantage for many practical applications (also see Locality
of reference), and is particularly useful for
implementing caches and garbage collection algorithms
Small memory footprint: Splay trees do not need to store
any bookkeeping data.
Presented By: M.Shahbaz
The most significant disadvantage of splay trees is that the
height of a splay tree can be linear.
The representation of splay trees can change even when
they are accessed in a 'read-only' manner (i.e.
by find operations). This complicates the use of such splay
trees in a multi-threaded environment.
Specifically, extra management is needed if multiple threads
are allowed to perform find operations concurrently. This
also makes them unsuitable for general use in purely
functional programming, although even there they can be
used in limited ways to implement priority queues.
Presented By: M.Shahbaz
 50,60,30,45,35,48,70,90,80,85,95
Presented By: M.Shahbaz
Presented By: M.Shahbaz

More Related Content

What's hot

Dijkstra
DijkstraDijkstra
Dijkstra
jagdeeparora86
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
Ashish Arun
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
United International University
 
Singly link list
Singly link listSingly link list
Singly link list
Rojin Khadka
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
Ninad Mankar
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
Gokul Hari
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
Masud Parvaze
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
Madhu Bala
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
SeethaDinesh
 
Red Black Trees
Red Black TreesRed Black Trees
Red Black Trees
Varun Mahajan
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operations
Kamran Zafar
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
Zaid Shabbir
 
1.8 splay tree
1.8 splay tree 1.8 splay tree
1.8 splay tree
Krish_ver2
 
Red black trees
Red black treesRed black trees
Red black trees
Maira Shahnawaz
 
Red black tree
Red black treeRed black tree
Red black tree
Rajendran
 
Selection sort
Selection sortSelection sort
Selection sort
smlagustin
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
Fahd Allebdi
 
BINARY SEARCH TREE
BINARY SEARCH TREE BINARY SEARCH TREE
BINARY SEARCH TREE
Usha Mahalingam
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
Siddhi Viradiya
 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
ForwardBlog Enewzletter
 

What's hot (20)

Dijkstra
DijkstraDijkstra
Dijkstra
 
B and B+ tree
B and B+ treeB and B+ tree
B and B+ tree
 
Tree-In Data Structure
Tree-In Data StructureTree-In Data Structure
Tree-In Data Structure
 
Singly link list
Singly link listSingly link list
Singly link list
 
Doubly Linked List
Doubly Linked ListDoubly Linked List
Doubly Linked List
 
SEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMSSEARCHING AND SORTING ALGORITHMS
SEARCHING AND SORTING ALGORITHMS
 
Bfs and Dfs
Bfs and DfsBfs and Dfs
Bfs and Dfs
 
Data structure - Graph
Data structure - GraphData structure - Graph
Data structure - Graph
 
BINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.pptBINARY TREE REPRESENTATION.ppt
BINARY TREE REPRESENTATION.ppt
 
Red Black Trees
Red Black TreesRed Black Trees
Red Black Trees
 
Binary search tree operations
Binary search tree operationsBinary search tree operations
Binary search tree operations
 
Tree and binary tree
Tree and binary treeTree and binary tree
Tree and binary tree
 
1.8 splay tree
1.8 splay tree 1.8 splay tree
1.8 splay tree
 
Red black trees
Red black treesRed black trees
Red black trees
 
Red black tree
Red black treeRed black tree
Red black tree
 
Selection sort
Selection sortSelection sort
Selection sort
 
Doubly linked list
Doubly linked listDoubly linked list
Doubly linked list
 
BINARY SEARCH TREE
BINARY SEARCH TREE BINARY SEARCH TREE
BINARY SEARCH TREE
 
non linear data structure -introduction of tree
non linear data structure -introduction of treenon linear data structure -introduction of tree
non linear data structure -introduction of tree
 
Stack a Data Structure
Stack a Data StructureStack a Data Structure
Stack a Data Structure
 

Similar to Splay Tree Presentation Slides

Lecture 14 splay tree
Lecture 14 splay treeLecture 14 splay tree
Lecture 14 splay tree
Abirami A
 
Tree data structure
Tree data structureTree data structure
Tree data structure
Lovely Professional University
 
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNNsplaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
ratnapatil14
 
Splay tree
Splay treeSplay tree
Splay tree
hina firdaus
 
Splay trees
Splay treesSplay trees
Splay trees
Amaan Shaikh
 
B Tree, Introduction ,example,Splay tree
B Tree, Introduction ,example,Splay treeB Tree, Introduction ,example,Splay tree
B Tree, Introduction ,example,Splay tree
VikasNirgude2
 
Discrete Mathematics Tree
Discrete Mathematics  TreeDiscrete Mathematics  Tree
Discrete Mathematics Tree
Masud Parvaze
 
Trees in data structure
Trees in data structureTrees in data structure
Trees in data structure
Anusruti Mitra
 
Heaptree
HeaptreeHeaptree
Heaptree
Rajapriya82
 
Splay trees
Splay treesSplay trees
Splay trees
beenish24
 
Tree
TreeTree
Tree
sbkbca
 
Splay trees by NIKHIL ARORA (www.internetnotes.in)
Splay trees by NIKHIL ARORA (www.internetnotes.in)Splay trees by NIKHIL ARORA (www.internetnotes.in)
Splay trees by NIKHIL ARORA (www.internetnotes.in)
nikhilarora2211
 
C++ UNIT4.pptx
C++ UNIT4.pptxC++ UNIT4.pptx
(5) collections algorithms
(5) collections algorithms(5) collections algorithms
(5) collections algorithms
Nico Ludwig
 
Splay tree && euler tour tree
Splay tree && euler tour treeSplay tree && euler tour tree
Splay tree && euler tour tree
Rezwanul Haque
 
Search tree,Tree and binary tree and heap tree
Search tree,Tree  and binary tree and heap treeSearch tree,Tree  and binary tree and heap tree
Search tree,Tree and binary tree and heap tree
zia eagle
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal Khan
Daniyal Khan
 
Tree data structure.pptx
Tree data structure.pptxTree data structure.pptx
Tree data structure.pptx
ssuser039bf6
 

Similar to Splay Tree Presentation Slides (18)

Lecture 14 splay tree
Lecture 14 splay treeLecture 14 splay tree
Lecture 14 splay tree
 
Tree data structure
Tree data structureTree data structure
Tree data structure
 
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNNsplaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
splaytree-171227043127.pptx NNNNNNNNNNNNNNNNNNNNNNN
 
Splay tree
Splay treeSplay tree
Splay tree
 
Splay trees
Splay treesSplay trees
Splay trees
 
B Tree, Introduction ,example,Splay tree
B Tree, Introduction ,example,Splay treeB Tree, Introduction ,example,Splay tree
B Tree, Introduction ,example,Splay tree
 
Discrete Mathematics Tree
Discrete Mathematics  TreeDiscrete Mathematics  Tree
Discrete Mathematics Tree
 
Trees in data structure
Trees in data structureTrees in data structure
Trees in data structure
 
Heaptree
HeaptreeHeaptree
Heaptree
 
Splay trees
Splay treesSplay trees
Splay trees
 
Tree
TreeTree
Tree
 
Splay trees by NIKHIL ARORA (www.internetnotes.in)
Splay trees by NIKHIL ARORA (www.internetnotes.in)Splay trees by NIKHIL ARORA (www.internetnotes.in)
Splay trees by NIKHIL ARORA (www.internetnotes.in)
 
C++ UNIT4.pptx
C++ UNIT4.pptxC++ UNIT4.pptx
C++ UNIT4.pptx
 
(5) collections algorithms
(5) collections algorithms(5) collections algorithms
(5) collections algorithms
 
Splay tree && euler tour tree
Splay tree && euler tour treeSplay tree && euler tour tree
Splay tree && euler tour tree
 
Search tree,Tree and binary tree and heap tree
Search tree,Tree  and binary tree and heap treeSearch tree,Tree  and binary tree and heap tree
Search tree,Tree and binary tree and heap tree
 
Tree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal KhanTree Data Structure by Daniyal Khan
Tree Data Structure by Daniyal Khan
 
Tree data structure.pptx
Tree data structure.pptxTree data structure.pptx
Tree data structure.pptx
 

Recently uploaded

Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
TechSoup
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
Jyoti Chand
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
giancarloi8888
 
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
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
danielkiash986
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
ssuser13ffe4
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
imrankhan141184
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 

Recently uploaded (20)

Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
 
Leveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit InnovationLeveraging Generative AI to Drive Nonprofit Innovation
Leveraging Generative AI to Drive Nonprofit Innovation
 
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
Wound healing PPT
Wound healing PPTWound healing PPT
Wound healing PPT
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdfREASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
REASIGNACION 2024 UGEL CHUPACA 2024 UGEL CHUPACA.pdf
 
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
 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
 
Pharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brubPharmaceutics Pharmaceuticals best of brub
Pharmaceutics Pharmaceuticals best of brub
 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
 
math operations ued in python and all used
math operations ued in python and all usedmath operations ued in python and all used
math operations ued in python and all used
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
Traditional Musical Instruments of Arunachal Pradesh and Uttar Pradesh - RAYH...
 
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 

Splay Tree Presentation Slides

  • 1. Presented By: M.Shahbaz The Islamia University of Bahawalpur
  • 2. Presented By: M.Shahbaz Topic: Splay Tree Presented By: Muhammad Shahbaz
  • 3. The splay tree was invented by Daniel Sleator and Robert Tarjan in 1985.[1] A splay tree is a self-adjusting binary search tree with the additional property that recently accessed elements are quick to access again. ., splay trees perform better than other search trees, even when the specific pattern of the sequence is unknown All normal operations on a binary search tree are combined with one basic operation, called splaying. oSplaying the tree for a certain element rearranges the tree so that the element is placed at the root of the tree. Presented By: M.Shahbaz
  • 5. Splaying When a node x is accessed, a splay operation is performed on x to move it to the root. To perform a splay operation we carry out a sequence of splay steps, each of which movesx closer to the root. By performing a splay operation on the node of interest after every access, the recently accessed nodes are kept near the root and the tree remains roughly balanced, so that we achieve the desired amortized time bounds. Each particular step depends on three factors: Whether x is the left or right child of its parent node, p, whether p is the root or not, and if not whether p is the left or right child of its parent, g (the grandparent of x).. Presented By: M.Shahbaz
  • 7. Zig rotation: this step is done when p is the root. The tree is rotated on the edge between x and p. Zig steps exist to deal with the parity issue and will be done only as the last step in a splay operation and only when x has odd depth at the beginning of the operation. Presented By: M.Shahbaz
  • 8. this step is done when p is not the root and x and p are either both right children or are both left children. The picture below shows the case where x and p are both left children. The tree is rotated on the edge joining p with its parent g, then rotated on the edge joining x with p. Note that zig-zig steps are the only thing that differentiate splay trees from the rotate to root method introduced by Allen and Munro prior to the introduction of splay trees. Presented By: M.Shahbaz
  • 9. this step is done when p is not the root and x is a right child and p is a left child or vice versa. The tree is rotated on the edge between p and x, and then rotated on the resulting edge between x and g. Presented By: M.Shahbaz
  • 10. Starts the same as a BST with the new node created at the a leaf. The new leaf node is splayed until it becomes the root. Splaying also occurs on unsuccessful searches. The last item on the access path is splayed in this case. Presented By: M.Shahbaz
  • 12. • First access the node to force it to percolate to the root. • Remove the root. • Determine the largest item in the left subtree and rotate it to the root of the left subtree which results in the left subtree new root having no right child. • The right subtree is then added as the right child of the new root. Presented By: M.Shahbaz
  • 14. Good performance for a splay tree depends on the fact that it is self-optimizing, in that frequently accessed nodes will move nearer to the root where they can be accessed more quickly. The worst-case height—though unlikely—is O(n), with the average being O(log n). Having frequently used nodes near the root is an advantage for many practical applications (also see Locality of reference), and is particularly useful for implementing caches and garbage collection algorithms Small memory footprint: Splay trees do not need to store any bookkeeping data. Presented By: M.Shahbaz
  • 15. The most significant disadvantage of splay trees is that the height of a splay tree can be linear. The representation of splay trees can change even when they are accessed in a 'read-only' manner (i.e. by find operations). This complicates the use of such splay trees in a multi-threaded environment. Specifically, extra management is needed if multiple threads are allowed to perform find operations concurrently. This also makes them unsuitable for general use in purely functional programming, although even there they can be used in limited ways to implement priority queues. Presented By: M.Shahbaz