Add splay tree data structure - #1041
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1041 +/- ##
==========================================
- Coverage 95.82% 95.82% -0.01%
==========================================
Files 393 394 +1
Lines 29972 30215 +243
==========================================
+ Hits 28722 28954 +232
- Misses 1250 1261 +11 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel. Thank you for your contributions! |
Adds a
SplayTreedata structure.Description
A splay tree is a self-adjusting binary search tree: after an access, the accessed value is moved to the root. If the searched value is absent, the last visited node is moved to the root instead. This implementation uses safe Rust with
Option<Box<Node<T>>>and does not store parent pointers.Implemented operations:
newlenis_emptycontainsinsertremovemergeFromIteratorThe
mergeoperation assumes that every value in the left tree is less than every value in the right tree.Reference:
https://en.wikipedia.org/wiki/Splay_tree
Type of change
Checklist:
cargo clippy --all -- -D warningsjust before my last commit and fixed any issue that was found.cargo fmtjust before my last commit.cargo testjust before my last commit and all tests passed.mod.rsfile within its own folder, and in any parent folder(s).DIRECTORY.mdwith the correct link.COUNTRIBUTING.mdand my code follows its guidelines.Notes:
cargo fmt -- --checkpasses.cargo test splay_tree --libpasses.cargo clippy --all -- -D warningscurrently reports existing warnings in unrelated files:src/string/manacher.rssrc/greedy/job_sequencing.rssrc/string/burrows_wheeler_transform.rscargo testaborted withSIGABRTwhile running the repository-wide test suite, outside the newsplay_treetests.