mirror of
https://github.com/redis/redis.git
synced 2026-02-03 20:39:54 -05:00
fix: correct comments in rax.h
- The characters in the node should be sorted in ascending order, so [t b] should be changed to [b t]. - "foo" is not a key node, so it should be represented using ().
This commit is contained in:
parent
15a048d4f0
commit
2f06bd41c8
1 changed files with 11 additions and 11 deletions
22
src/rax.h
22
src/rax.h
|
|
@ -46,13 +46,13 @@
|
|||
* \
|
||||
* (o) "fo"
|
||||
* \
|
||||
* [t b] "foo"
|
||||
* [b t] "foo"
|
||||
* / \
|
||||
* "foot" (e) (a) "foob"
|
||||
* "foob" (a) (e) "foot"
|
||||
* / \
|
||||
* "foote" (r) (r) "fooba"
|
||||
* "fooba" (r) (r) "foote"
|
||||
* / \
|
||||
* "footer" [] [] "foobar"
|
||||
* "foobar" [] [] "footer"
|
||||
*
|
||||
* However, this implementation implements a very common optimization where
|
||||
* successive nodes having a single child are "compressed" into the node
|
||||
|
|
@ -61,13 +61,13 @@
|
|||
* provided inside the representation. So the above representation is turned
|
||||
* into:
|
||||
*
|
||||
* ["foo"] ""
|
||||
* ("foo") ""
|
||||
* |
|
||||
* [t b] "foo"
|
||||
* [b t] "foo"
|
||||
* / \
|
||||
* "foot" ("er") ("ar") "foob"
|
||||
* "foob" ("ar") ("er") "foot"
|
||||
* / \
|
||||
* "footer" [] [] "foobar"
|
||||
* "foobar" [] [] "footer"
|
||||
*
|
||||
* However this optimization makes the implementation a bit more complex.
|
||||
* For instance if a key "first" is added in the above radix tree, a
|
||||
|
|
@ -82,11 +82,11 @@
|
|||
* / \
|
||||
* "firs" ("rst") (o) "fo"
|
||||
* / \
|
||||
* "first" [] [t b] "foo"
|
||||
* "first" [] [b t] "foo"
|
||||
* / \
|
||||
* "foot" ("er") ("ar") "foob"
|
||||
* "foob" ("ar") ("er") "foot"
|
||||
* / \
|
||||
* "footer" [] [] "foobar"
|
||||
* "foobar" [] [] "footer"
|
||||
*
|
||||
* Similarly after deletion, if a new chain of nodes having a single child
|
||||
* is created (the chain must also not include nodes that represent keys),
|
||||
|
|
|
|||
Loading…
Reference in a new issue