Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to find if the set contains a prefix to the key provided #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wwweert123
Copy link

No description provided.

@rklaehn
Copy link
Contributor

rklaehn commented Mar 2, 2024

Hm, there is also has_prefix and scan_prefix.

has_prefix will return true if the tree has values below the given prefix. scan_prefix will iterate over the entire tree below a prefix. What case does this fn enable that isn't possible with the two mentioned methods?

@wwweert123
Copy link
Author

wwweert123 commented Mar 2, 2024

Hi! Instead of checking whether the string provided is a prefix of a key in the set (what is done in has_prefix), the added is_prefix checks whether any keys in the set is a prefix of the string provided.

For example,
radixtree1 = {"www.google.com", "www.youtube.com"}

radixtree1.is_prefix("www.google.com/webhp") will return true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants