Блог пользователя asfasdfasd

Автор asfasdfasd, история, 8 лет назад, По-английски

What is ternary search tree ??

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

»
8 лет назад, # |
  Проголосовать: нравится -18 Проголосовать: не нравится

Ternary search tree is a type of trie ( you can get informations about trie from this link ) where nodes are arranged in a manner similar to a binary search tree, but with up to three children rather than the binary tree's limit of two.

Each node of a ternary search tree stores a single character, an object, and pointers to its three children middle_child, lower_child and higher_child. A node may also have a pointer to its parent node as well as an indicator as to whether or not the node marks the end of a word. The lower_child pointer must point to a node whose character value is less than the current node. The higher_child pointer must point to a node whose character is greater than the current node. The equal middle_child points to the next character in the word.

For example : The figure below shows a ternary search tree with the strings "as", "at", "cup", "cute", "he", "i" and "us":


c / | \ a u h | | | \ t t e u / / | / | s p e i s