splay trees l.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Splay Trees PowerPoint Presentation
Download Presentation
Splay Trees

Loading in 2 Seconds...

play fullscreen
1 / 18

Splay Trees - PowerPoint PPT Presentation


  • 252 Views
  • Uploaded on

Splay Trees. Sean Lyn April 3, 2008. What is it?. A binary tree structure that is very similar to other trees but with additional properties. Has the potential for speeds faster than O(logn).

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Splay Trees' - jack


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
splay trees

Splay Trees

Sean Lyn

April 3, 2008

what is it
What is it?
  • A binary tree structure that is very similar to other trees but with additional properties.
  • Has the potential for speeds faster than O(logn).
  • Its bounds are amortized – even though individual operations may be expensive, any sequence of operations is guaranteed to behave as though each operation had logarithmic behavior.
  • Self adjusting.
differences
Differences
  • Balanced trees require an extra piece of balancing information.
  • Balanced trees have expensive insertion and deletion.
  • Splay trees take advantage of the 90-10 rule.
splaying
Splaying
  • Splaying is the process of rotating the most currently used node to the root.
  • Two types of trees: Bottom Up and Top Down.
bottom up splay trees
Bottom Up Splay Trees
  • Three Cases: Zig, Zig-Zag, and Zig-Zig
  • Zig occurs when X is a non-root and P is the root. In this case we rotate X to the root.
  • Zig-Zag occurs when X has a parent P and a grandparent G where X is a right child and P is a left child or vice versa.
  • Zig-Zig occurs when X and its parent P are both left or right children.
slide6
Zig
  • Single rotation involving X and P
zig zag
Zig-Zag
  • Double rotation similar to an AVL tree. First we rotate X and P, then X and G to bring X to the root.
zig zig
Zig-Zig
  • Uses a double rotation by first rotating P and G then rotating X and P
splay tree operations
Splay Tree Operations
  • A splay operation is performed after every access to a node.
  • Find – splay the tree after finding it
  • DeleteMin is simple, perform FindMin which will bring it to the top then the right child becomes the new root.
  • Removal – Access the node which makes it the root then delete it which gives two trees. Find the max of the left tree and that is the new root.
top down splay trees
Top Down Splay Trees
  • Works by starting at the top and working down to produce a similar result.
  • All of the nodes lower than the target are put into one tree and all of the nodes greater than the target are put into another tree then it is recombined.
conclusion
Conclusion
  • Are Splay Trees better to use? The answer has no been resolved completely.
  • They situationally perform better than other balanced trees, usually determined by the access patterns.
questions
Questions
  • What is one unique property of a splay tree?
  • What are the three cases for rotating a node to the root?
sources
Sources
  • Weiss, Mark. Data Structures and Problem Solving Using Java. Boston: Pearson Education, Inc, 2006.