{"id":16775188,"url":"https://github.com/arunkumar9t2/trie","last_synced_at":"2025-04-10T20:07:52.051Z","repository":{"id":102600507,"uuid":"86421416","full_name":"arunkumar9t2/trie","owner":"arunkumar9t2","description":"A Java implementation of the Trie data structure","archived":false,"fork":false,"pushed_at":"2018-05-13T07:10:57.000Z","size":72,"stargazers_count":22,"open_issues_count":2,"forks_count":6,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-24T17:52:42.606Z","etag":null,"topics":["java","java-library","search","search-trees","trie","tries"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arunkumar9t2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-03-28T06:07:38.000Z","updated_at":"2025-03-18T11:15:32.000Z","dependencies_parsed_at":"2023-06-30T01:45:56.487Z","dependency_job_id":null,"html_url":"https://github.com/arunkumar9t2/trie","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arunkumar9t2%2Ftrie","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arunkumar9t2%2Ftrie/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arunkumar9t2%2Ftrie/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arunkumar9t2%2Ftrie/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arunkumar9t2","download_url":"https://codeload.github.com/arunkumar9t2/trie/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248288347,"owners_count":21078903,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java-library","search","search-trees","trie","tries"],"created_at":"2024-10-13T06:51:15.934Z","updated_at":"2025-04-10T20:07:52.043Z","avatar_url":"https://github.com/arunkumar9t2.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trie\nA java implementation of the Prefix Trie data structure.\n\n# Introduction\nTries are map like ordered tree based data structures that provide fast searching of the order `O(k)` where `k` is the length of key. Read more about trie [here](https://en.wikipedia.org/wiki/Trie).\n\n# Motivation\nThis was initially built to use in my Android app, **T9 App Launcher** to quickly search through list of installed applications and launch them.\n\n# Public APIs\nCurrently there are 3 public implementations that can be chosen from.\n\n - **`MapTrie`:** `HashMap` backed trie implementation. \n - **`SortedTrie`:** `TreeMap` backed trie implementation which returns suggestions and value is ascending sort order.\n - **`T9Trie`:** Helper implementation to store and retrieve suggestions for T9 sequence.\n\n## Example usage\nCreating a simple trie and getting suggestions.\n\n    final MapTrie\u003cString\u003e trie = new MapTrie\u003c\u003e();\n\n    trie.insert(\"Hello\", \"Hello\");\n    trie.insert(\"Help\", \"Help\");\n    trie.insert(\"Has\", \"Has\");\n    trie.insert(\"Have\", \"Have\");\n    trie.insert(\"Had\", \"Had\");\n    trie.insert(\"Hadn't\", \"Hadn't\");\n        \n    // Print to stdout\n    trie.print();\n\nThe above `print()` call would print the tree structure like this.\n\n    └── h\n        ├── e\n        │   └── l\n        │       ├── l\n        │       │   └── o'Hello\n        │       └── p'Help\n        └── a\n            ├── s'Has\n            ├── v\n            │   └── e'Have\n            └── d'Had\n                └── n\n                    └── '\n                        └── t'Hadn't\nNow let's try to find all the words starting with `ha`. Remember that, by default the keys are **case insensitive.**\n\n    List\u003cString\u003e suggestions = trie.getValueSuggestions(\"ha\");\n    System.out.print(suggestions.toString());\nThis will print `[Has, Have, Had, Hadn't]` to the console. **The value is left untouched.**\n\n# Contribution\nIf you are a developer and would like to contribute please consider making a pull request. I would appreciate any criticisms with regards to code or implementation in general.\n\n# License\nThis project is licensed under Apache 2.0 license.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farunkumar9t2%2Ftrie","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farunkumar9t2%2Ftrie","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farunkumar9t2%2Ftrie/lists"}