codezonediitj / pydatastructs

A python package for data structures and algorithms
https://pydatastructs.readthedocs.io/en/stable/
Other
201 stars 267 forks source link

Adding Trie/Prefix Tree #371

Closed ManavArora26 closed 3 years ago

ManavArora26 commented 3 years ago

Description of the problem

A Trie/Prefix Tree is a kind of search tree used to provide quick lookup of words/patterns in a set of words. A basic Trie however has O(n^2) space complexity making it impractical in practice. It however provides O(max(search_string, length of longest word)) lookup time making it an optimal approach when space is not an issue.

Example of the problem

References/Other comments

https://en.wikipedia.org/wiki/Trie