Skip to content

Add Splay Trees implantation ( Self Adjusting BST) #13760

Description

@Prigoistic

What would you like to share?

I was going through the repo, and i didnt find any implementation for Splay Trees, which is a very practical algorithm used in real world cases.

Current Status

The repository has AVL Tree, Red-Black Tree, and other balanced BSTs, but is missing Splay Tree which offers unique advantages for access locality.

Proposed Implementation

  • Complete Splay Tree class with all rotations (zig, zig-zig, zig-zag)
  • Standard BST operations (insert, delete, search, min, max)
  • Tree traversals (inorder, preorder)
  • Helper methods (size, height, display)
  • Comprehensive doctests
  • Performance demonstration

Benefits

  • Simpler implementation than other self-balancing trees
  • Excellent for scenarios with locality of reference
  • Amortized O(log n) performance
  • Educational value for algorithm learners

File Location

data_structures/binary_tree/splay_tree.py

Additional information

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting triageAwaiting triage from a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions