Skip to content

feat: add Splay Tree implementation in data_structures/binary_tree#13799

Open
krrish175-byte wants to merge 2 commits intoTheAlgorithms:masterfrom
krrish175-byte:feat/splay-tree
Open

feat: add Splay Tree implementation in data_structures/binary_tree#13799
krrish175-byte wants to merge 2 commits intoTheAlgorithms:masterfrom
krrish175-byte:feat/splay-tree

Conversation

@krrish175-byte
Copy link

@krrish175-byte krrish175-byte commented Oct 29, 2025

Addressing #13760

Summary:
Added a Splay Tree implementation in Python under data_structures/binary_tree/splay_tree.py.

Features:

  • - Insert, search, delete operations with splay adjustments (zig, zig-zig, zig-zag)
  • - Inorder and preorder traversals
  • - Example usage in __main__ demonstrating basic behavior

]Rationale:
The repository contains several balanced BSTs (AVL, Red-Black). Splay trees are a useful self-adjusting BST with amortized O(log n) complexity and are valuable for teaching and practical use-cases with access locality.

Tests:
Manual test via python data_structures/binary_tree/splay_tree.py demonstrates expected traversal and operations.

If the maintainers want doctests or additional unit tests, I can add them in a following commit.

@algorithms-keeper algorithms-keeper bot added awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant