You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description:
Proposal: Trie Data Structure
I'd like to contribute a Trie (Prefix Tree) implementation to PyDataStructs - a powerful and efficient data structure that is currently missing from the collection.
What is a Trie?
A Trie is a specialized tree-based data structure that excels at storing and retrieving strings with common prefixes. It offers O(L) lookup time where L is the length of the string, making it significantly faster than hash tables for certain operations.
Why add it to PyDataStructs?
Completes the collection - Tries are fundamental data structures taught in CS curricula
Practical applications - Used in autocomplete, spell-checkers, IP routing, etc.
Educational value - Demonstrates tree-based prefix storage concepts
Proposed Implementation:
pythonCopyclass Trie:
def init(self)
def insert(self, word) # Add a word to the trie
def search(self, word) # Check if word exists in trie
def starts_with(self, prefix) # Find words with a given prefix
def delete(self, word) # Remove a word from the trie
Testing Strategy:
Unit tests covering all operations
Edge cases (empty strings, non-existing words)
Performance benchmarking against alternative methods
Real-world Use Cases:
Autocomplete systems - Quickly find all words with a given prefix
Spell checkers - Efficient dictionary implementation
IP routing tables - Longest prefix matching
Word games - Fast word validation
I'm excited to work on this implementation and would appreciate any feedback on the proposed API or implementation details!
I'm following the project's contribution guidelines and plan to thoroughly test the implementation. I'd be happy to take on this task if approved.
Description:
Proposal: Trie Data Structure
I'd like to contribute a Trie (Prefix Tree) implementation to PyDataStructs - a powerful and efficient data structure that is currently missing from the collection.
What is a Trie?
A Trie is a specialized tree-based data structure that excels at storing and retrieving strings with common prefixes. It offers O(L) lookup time where L is the length of the string, making it significantly faster than hash tables for certain operations.
Why add it to PyDataStructs?
Completes the collection - Tries are fundamental data structures taught in CS curricula
Practical applications - Used in autocomplete, spell-checkers, IP routing, etc.
Educational value - Demonstrates tree-based prefix storage concepts
Proposed Implementation:
pythonCopyclass Trie:
def init(self)
def insert(self, word) # Add a word to the trie
def search(self, word) # Check if word exists in trie
def starts_with(self, prefix) # Find words with a given prefix
def delete(self, word) # Remove a word from the trie
Testing Strategy:
Unit tests covering all operations
Edge cases (empty strings, non-existing words)
Performance benchmarking against alternative methods
Real-world Use Cases:
Autocomplete systems - Quickly find all words with a given prefix
Spell checkers - Efficient dictionary implementation
IP routing tables - Longest prefix matching
Word games - Fast word validation
I'm excited to work on this implementation and would appreciate any feedback on the proposed API or implementation details!
I'm following the project's contribution guidelines and plan to thoroughly test the implementation. I'd be happy to take on this task if approved.
@Kishan-Ved
The text was updated successfully, but these errors were encountered: