{"id":32122025,"url":"https://github.com/distributed-ledger-technology/tries","last_synced_at":"2026-02-19T08:01:19.757Z","repository":{"id":62422420,"uuid":"427100233","full_name":"distributed-ledger-technology/tries","owner":"distributed-ledger-technology","description":"Tries and PATRICIA Tries Data Structures ","archived":false,"fork":false,"pushed_at":"2022-01-07T10:11:02.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-05T20:28:19.544Z","etag":null,"topics":["data-structures","patricia-trie","tries"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/distributed-ledger-technology.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}},"created_at":"2021-11-11T18:17:20.000Z","updated_at":"2024-04-19T07:39:12.000Z","dependencies_parsed_at":"2022-11-01T17:31:20.019Z","dependency_job_id":null,"html_url":"https://github.com/distributed-ledger-technology/tries","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/distributed-ledger-technology/tries","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-ledger-technology%2Ftries","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-ledger-technology%2Ftries/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-ledger-technology%2Ftries/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-ledger-technology%2Ftries/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/distributed-ledger-technology","download_url":"https://codeload.github.com/distributed-ledger-technology/tries/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/distributed-ledger-technology%2Ftries/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29608152,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-19T06:47:36.664Z","status":"ssl_error","status_checked_at":"2026-02-19T06:45:47.551Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["data-structures","patricia-trie","tries"],"created_at":"2025-10-20T20:06:38.963Z","updated_at":"2026-02-19T08:01:19.746Z","avatar_url":"https://github.com/distributed-ledger-technology.png","language":"TypeScript","readme":"# Tries\n[Tries](https://www.youtube.com/watch?v=3CbFFVHQrk4) are data structures that can be used to store sequences - e.g. words as sequences of letters.  \nTries support faster and more precise query executions related to those sequences.  \n\n## Classical Tries \n### Usage Examples\n\n```ts  \n\nimport { Trie } from \"https://deno.land/x/tries/mod.ts\"\n\nconst trie = new Trie()\n\nconst exampleSequence1 = \"be\"\nconst exampleSequence2 = \"bet\"\nconst exampleSequence3 = \"bed\"\nconst exampleSequence4 = \"bed and breakfast\"\nconst exampleSequence5 = \"justice\"\n\ntrie.insert(exampleSequence1)\ntrie.insert(exampleSequence3)\ntrie.insert(exampleSequence2)\ntrie.insert(exampleSequence5)\ntrie.insert(exampleSequence4)\n\nconsole.log(trie.hasSequence(exampleSequence3)) // true\nconsole.log(trie.hasSequence(exampleSequence4)) // true\nconsole.log(trie.hasSequence(\"breakfast\")) // false because it is not added as a discrete sequence\nconsole.log(trie.hasSequence(\"missing\")) // false \n\n```\n\n## Letters and Words Prediction Tries\n\n```ts\n\nimport { LettersWordsPredictionTrie } from \"https://deno.land/x/tries/mod-letters-and-word-prediction.ts\"\n\nconst lettersWordsPredictionTrie = new LettersWordsPredictionTrie()\n\nlettersWordsPredictionTrie.learn(['ether', 'eth', 'ethereum', 'super'])\n\nconst brain = lettersWordsPredictionTrie.getBrain()\n\nconsole.log(JSON.stringify(brain, undefined, 2))\n\n\n```\n\n## Radix Tree\nA Radix Tree is a compressed version of a trie - see [this introduction](https://www.youtube.com/watch?v=E8ZGt2i3xkw)\n\u003cimg width=\"947\" alt=\"Screenshot 2022-01-07 at 08 50 31\" src=\"https://user-images.githubusercontent.com/43786652/148510487-e0868c68-409e-4d58-9e52-b7c7324ae041.png\"\u003e\n\nThere are several variations of Radix Trees. In some cases there is no consistent naming / definition to be found (yet?).  \nA rather famous variation of a Radix Tree is the PATRICIA Trie:  \n**P** Practical  \n**A** Algorithm  \n**T** To   \n**R** Retrieve   \n**I** Information  \n**C** Coded  \n**I** In   \n**A** Alphanumeric  \n\nPATRICIA Tries are Radix Trees with the [radix 2](https://cs.stackexchange.com/questions/63048/what-is-the-difference-between-radix-trees-and-patricia-tries).  \n[Merkle PATRICIA Tries aka Merkle PATRICIA Trees](https://www.skypack.dev/view/merkle-patricia-tree) became especially famous as in the Ethereum Blockchain pretty much everything (state trie, transaction trie, receipt trie, ...) is stored in those kinds of data structures. For details I can recommend [this video](https://www.youtube.com/watch?v=OxofT39TJgg). Keep in mind that (currently) some people use different words for the same thing and some people use the same word for different things in these contexts.\n\n## Merkle PATRICIA Trie / Tree\n\n```ts\nimport merklePatriciaTree from 'https://cdn.skypack.dev/merkle-patricia-tree'\n\n// For specific usage examples you might check https://www.skypack.dev/view/merkle-patricia-tree\n```\n\n\n### Usage Examples\n... Under Construction ...\n\n## Unit Tests\nFor further usage examples etc. please check the [unit tests](https://github.com/distributed-ledger-technology/tries/blob/main/src/trie.spec.ts).\n\n## Contribute\nContributions / Pull Requests are welcome.\n\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-ledger-technology%2Ftries","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistributed-ledger-technology%2Ftries","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistributed-ledger-technology%2Ftries/lists"}