Skip to content

Main content

Literal Word Trie Node Table

Construct a literal UTF-16-code-unit trie with stable insertion IDs and at most 128 nodes; repeated words share one terminal, empty words terminate the root.

Loading tool…

Description

Construct a literal UTF-16-code-unit trie with stable insertion IDs and at most 128 nodes; repeated words share one terminal, empty words terminate the root.

A trie stores literal words as root-to-node character paths, with terminal flags marking complete words. A terminal can also have children, and an existing prefix path need not be a stored word. This family uses one UTF-16 code unit per ordinary edge, so code-unit length differs from a displayed character or Unicode code-point count.

Construct a literal UTF-16-code-unit trie with stable insertion IDs and at most 128 nodes; repeated words share one terminal, empty words terminate the root.

When to use this tool

Use this tool to construct a literal UTF-16-code-unit trie with stable insertion IDs and at most 128 nodes; repeated words share one terminal, empty words terminate the root.

How to use the tool and how it works

  1. Enter words using the definitions below.
  2. Run the operation. Resolve input-format errors before interpreting an output.
  3. Read result.nodes, using the stated boundary, ordering, sign and absence conventions.

Start at root {id:0,parent:null,character:"",terminal:false}. Insert words in input order one UTF-16 code unit at a time, reuse matching parent/character edges and mark each endpoint terminal. Assign IDs in creation order.1

Input fieldMeaning and unitsAccepted input
wordsExplicit literal word strings in caller order; construction limits each word to 127 code units.Dense list of at most 128 literal strings, each at most 8,192 UTF-16 units.
Output fieldInterpretation
resultObject containing the fields below.
result.nodesCreation-order root-zero trie node records {id,parent,character,terminal}.
json
{
  "input": {
    "words": [
      "a",
      "ab",
      "b"
    ]
  },
  "output": {
    "result": {
      "nodes": [
        {
          "id": 0,
          "parent": null,
          "character": "",
          "terminal": false
        },
        {
          "id": 1,
          "parent": 0,
          "character": "a",
          "terminal": true
        },
        {
          "id": 2,
          "parent": 1,
          "character": "b",
          "terminal": true
        },
        {
          "id": 3,
          "parent": 0,
          "character": "b",
          "terminal": true
        }
      ]
    }
  }
}

Limitations and assumptions

  • Each word is at most 127 code units and the complete trie at most 128 nodes. Duplicate words do not add terminals; an empty word marks the root terminal.
  • Ordinary node tables have at most 128 nodes with distinct IDs 0–127, one root ID 0 with empty character and null parent, unique parent/character edges, complete acyclic parent links and a boolean terminal flag. Every nonroot character is exactly one UTF-16 code unit.
  • Every declared outer field is required and unknown outer fields are rejected. Strings and JSON text have size limits, lists are bounded to 128 entries, and JSON nesting/node counts are bounded. Tighter operation-specific bounds stated above take precedence.
  • Ordinary numeric outputs must be finite and within safe-integer magnitude. Exact large lengths/counts use decimal strings. Original record indexes and code-unit positions are zero-based; span ends are exclusive unless stated otherwise.

Alternative or Complementary methods

Choose word membership, prefix existence, completion or ranking according to the question. Normalize text separately if needed; these operations preserve exact code units and caller order.

References

  1. Tool behavior and example: Literal Word Trie Node Table — tool.io

Similar or alternative tools

  • Prefix Trie Literal Prefix Completion Count

    Bounded explicit prefix trie with root ID 0, unique sibling UTF-16 code-unit edges and terminal flags; count distinct terminal completions, not duplicate original word observations or inferred dictionary frequencies.

  • Prefix Trie Literal Prefix Completion List

    Bounded explicit prefix trie with root ID 0, unique sibling UTF-16 code-unit edges and terminal flags; select terminal word completions in source-node order, including the prefix itself if terminal.