feat(trees): longest common suffix queries#112
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughIntroduces a new Suffix Tree data structure that stores reversed words in a Trie and tracks best word information per node. Implements a longest common suffix queries function leveraging this structure. Adds comprehensive documentation and test coverage with nine test cases. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant LCS as longest_common_suffix_queries()
participant ST as SuffixTree
participant STN as SuffixTreeNode
participant Trie as Trie (reversed paths)
Client->>LCS: words_container, words_query
activate LCS
LCS->>ST: create()
activate ST
loop for each word in words_container
LCS->>ST: insert(word, index)
activate ST
ST->>ST: reverse word
ST->>Trie: traverse/insert reversed chars
activate Trie
Trie->>STN: update best_info at each node
activate STN
STN->>STN: compare & update via _update_best_info()
deactivate STN
deactivate Trie
deactivate ST
end
deactivate ST
loop for each query_word in words_query
LCS->>ST: search_best_index(query_word)
activate ST
ST->>ST: reverse query_word
ST->>Trie: traverse existing children
activate Trie
Trie->>STN: collect best_info from deepest node
deactivate Trie
ST-->>LCS: return original_index from best_info
deactivate ST
end
LCS-->>Client: List[int] of best indices
deactivate LCS
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Suggested labels
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (10)
Tip 📝 Customizable high-level summaries are now available in beta!You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.
Example instruction:
Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Describe your change:
Checklist:
Fixes: #{$ISSUE_NO}.Summary by CodeRabbit
New Features
Documentation
Tests
✏️ Tip: You can customize this high-level summary in your review settings.