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

Check if a prefix is present in the trie, and get child keys of prefixes. #1

Closed
wants to merge 4 commits into from

Conversation

ctdk
Copy link

@ctdk ctdk commented Apr 26, 2014

Subject says it all, really. I needed to be able to see if "foo..." was present in the trie, as well as get everything that started with "foo".

@@ -47,6 +48,25 @@ func (n *Node) HasChild(letter rune) bool {
return n.GetChild(letter) != nil
}

func (n *Node) ChildKeys() []string {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems unrelated to your main change. Also, this should probably return a slice of runes since the keys are runes.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part that gets the child keys of a certain prefix, but I may have worded it badly. The rune thing's totally reasonable though.

@ctdk ctdk closed this Apr 27, 2014
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.

None yet

2 participants