Add splay tree data structure#1041
Open
kuchma19 wants to merge 1 commit into
Open
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 Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.