{"id":18039817,"url":"https://github.com/karesti/autocomplete-scala","last_synced_at":"2025-08-15T17:14:32.091Z","repository":{"id":138752562,"uuid":"76859828","full_name":"karesti/autocomplete-scala","owner":"karesti","description":"Autocomplete Scala implemented as a R-Trie","archived":false,"fork":false,"pushed_at":"2016-12-20T09:39:26.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T01:29:02.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karesti.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2016-12-19T12:21:11.000Z","updated_at":"2023-06-25T15:24:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"496b1a4d-2ab5-4996-9283-0bd04b0cd25a","html_url":"https://github.com/karesti/autocomplete-scala","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/karesti/autocomplete-scala","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karesti%2Fautocomplete-scala","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karesti%2Fautocomplete-scala/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karesti%2Fautocomplete-scala/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karesti%2Fautocomplete-scala/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karesti","download_url":"https://codeload.github.com/karesti/autocomplete-scala/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karesti%2Fautocomplete-scala/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270602456,"owners_count":24614260,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-30T14:41:52.191Z","updated_at":"2025-08-15T17:14:32.072Z","avatar_url":"https://github.com/karesti.png","language":"Scala","funding_links":[],"categories":[],"sub_categories":[],"readme":"# autocomplete-scala\nAutocomplete coded in scala implemented as a R-Trie (Ascii extended)\n\nsbt test to run the tests\n\n## Going further\n\nR-Trie are very straightforward, but they consume extra space due to the array allocation.\nA better solution for memory usage will be to use a TST (Ternary Search Trie) which is not\nvery difficult to implement but more complex than R-Trie.\n\n## Additional questions\n\nI'm assuming I can't use Lucene / Elastic Search for the following answers.\n\n##### What would you change if the list of keywords was large (several millions)?\n\nIt depends on the keywords. If indexed keywords have very similar prefixes, maybe using the compressed type of \nTrie can be just fine. \n\nAs a simple solution, I would try to keep in memory only the most suggested words. When suggested values are less than 4, \nwe will try to find on more words in the external system (database, file system).\n\nSuggested words can be tracked in memory with a LRU cache implemented with a DoubleLinkedList.\nThe TrieNode will point to the LinkedListNode that tracks words values. \nDelete method should also be implemented in the Trie.\n\n##### What would you change if the requirements were to match any portion of the keywords \n\nI would start with the brute force solution to implement a \"contains\" method, but there are other algorithms out\nthere I should probably study better in order to implement substring search with regular expressions and \nDFA (Deterministic Finite Automation)(I only know the existence of these algorithms)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaresti%2Fautocomplete-scala","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaresti%2Fautocomplete-scala","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaresti%2Fautocomplete-scala/lists"}