mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-25 22:46:20 +08:00
Update Trie image.
This commit is contained in:
parent
ad2f49af38
commit
28109b4f41
@ -5,22 +5,24 @@ _Read this in other languages:_
|
||||
[_Русский_](README.ru-RU.md),
|
||||
[_Português_](README.pt-BR.md)
|
||||
|
||||
In computer science, a **trie**, also called digital tree and sometimes
|
||||
radix tree or prefix tree (as they can be searched by prefixes),
|
||||
is a kind of search tree—an ordered tree data structure that is
|
||||
used to store a dynamic set or associative array where the keys
|
||||
are usually strings. Unlike a binary search tree, no node in the
|
||||
tree stores the key associated with that node; instead, its
|
||||
In computer science, a **trie**, also called digital tree and sometimes
|
||||
radix tree or prefix tree (as they can be searched by prefixes),
|
||||
is a kind of search tree—an ordered tree data structure that is
|
||||
used to store a dynamic set or associative array where the keys
|
||||
are usually strings. Unlike a binary search tree, no node in the
|
||||
tree stores the key associated with that node; instead, its
|
||||
position in the tree defines the key with which it is associated.
|
||||
All the descendants of a node have a common prefix of the string
|
||||
associated with that node, and the root is associated with the
|
||||
empty string. Values are not necessarily associated with every
|
||||
node. Rather, values tend only to be associated with leaves,
|
||||
and with some inner nodes that correspond to keys of interest.
|
||||
For the space-optimized presentation of prefix tree, see compact
|
||||
associated with that node, and the root is associated with the
|
||||
empty string. Values are not necessarily associated with every
|
||||
node. Rather, values tend only to be associated with leaves,
|
||||
and with some inner nodes that correspond to keys of interest.
|
||||
For the space-optimized presentation of prefix tree, see compact
|
||||
prefix tree.
|
||||
|
||||
![Trie](https://upload.wikimedia.org/wikipedia/commons/b/be/Trie_example.svg)
|
||||
![Trie](./images/trie.jpg)
|
||||
|
||||
*Made with [okso.app](https://okso.app)*
|
||||
|
||||
## References
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
Na ciência da computação, uma **trie**, também chamada de árvore digital (digital tree)
|
||||
e algumas vezes de _radix tree_ ou _prefix tree_ (tendo em vista que eles
|
||||
podem ser pesquisados por prefixos), é um tipo de árvore de pesquisa, uma
|
||||
uma estrutura de dados de árvore ordenada que é usado para armazenar um
|
||||
uma estrutura de dados de árvore ordenada que é usado para armazenar um
|
||||
conjunto dinâmico ou matriz associativa onde as chaves são geralmente _strings_.
|
||||
Ao contrário de uma árvore de pesquisa binária (binary search tree),
|
||||
nenhum nó na árvore armazena a chave associada a esse nó; em vez disso,
|
||||
@ -17,7 +17,9 @@ internos que correspondem a chaves de interesse.
|
||||
Para a apresentação otimizada do espaço da árvore de prefixo (_prefix tree_),
|
||||
veja árvore de prefixo compacto.
|
||||
|
||||
![Trie](https://upload.wikimedia.org/wikipedia/commons/b/be/Trie_example.svg)
|
||||
![Trie](./images/trie.jpg)
|
||||
|
||||
*Made with [okso.app](https://okso.app)*
|
||||
|
||||
## Referências
|
||||
|
||||
|
@ -16,7 +16,9 @@
|
||||
дополнительную информацию, связанную с ключом, и обычно выделенными являются только листья и, возможно, некоторые
|
||||
внутренние узлы.
|
||||
|
||||
![Префиксное дерево](https://upload.wikimedia.org/wikipedia/commons/b/be/Trie_example.svg)
|
||||
![Префиксное дерево](./images/trie.jpg)
|
||||
|
||||
*Made with [okso.app](https://okso.app)*
|
||||
|
||||
На рисунке представлено префиксное дерево, содержащее ключи «A», «to», «tea», «ted», «ten», «i», «in», «inn».
|
||||
|
||||
|
@ -2,13 +2,15 @@
|
||||
|
||||
在计算机科学中, **字典树(trie,中文又被称为”单词查找树“或 ”键树“)**, 也称为数字树,有时候也被称为基数树或前缀树(因为它们可以通过前缀搜索),它是一种搜索树--一种已排序的数据结构,通常用于存储动态集或键为字符串的关联数组。
|
||||
|
||||
与二叉搜索树不同, 树上没有节点存储与该节点关联的键; 相反,节点在树上的位置定义了与之关联的键。一个节点的全部后代节点都有一个与该节点关联的通用的字符串前缀, 与根节点关联的是空字符串。
|
||||
与二叉搜索树不同, 树上没有节点存储与该节点关联的键; 相反,节点在树上的位置定义了与之关联的键。一个节点的全部后代节点都有一个与该节点关联的通用的字符串前缀, 与根节点关联的是空字符串。
|
||||
|
||||
值对于字典树中关联的节点来说,不是必需的,相反,值往往和相关的叶子相关,以及与一些键相关的内部节点相关。
|
||||
|
||||
有关字典树的空间优化示意,请参阅紧凑前缀树
|
||||
|
||||
![Trie](https://upload.wikimedia.org/wikipedia/commons/b/be/Trie_example.svg)
|
||||
![Trie](./images/trie.jpg)
|
||||
|
||||
*Made with [okso.app](https://okso.app)*
|
||||
|
||||
## 参考
|
||||
|
||||
|
BIN
src/data-structures/trie/images/trie.jpg
Normal file
BIN
src/data-structures/trie/images/trie.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 131 KiB |
Loading…
Reference in New Issue
Block a user