Chapter 11 · SimulationTrie, Suffix Array and Suffix Trie? ← Chapter 11 Trie Suffix Build / Search Prefix Text Build Suffix StructuresSuffix array (click a row)rankSAsuffixLCPTrieend of wordsearch pathReady. CloseTrie, Suffix Array and Suffix TrieBuild a trie from words, explore prefix queries, and compare how a suffix array orders suffixes with how a suffix trie stores them.How to useTrie: enter comma-separated words (up to 10 words of up to 12 letters each) and a prefix, then press Build / Search Prefix. The search path is highlighted; filled nodes mark the end of a word.Suffix: enter a text of up to 16 characters and press Build Suffix Structures. The suffix array is listed on the left and the brute-force suffix trie is drawn on the right.Clicking a row of the suffix array highlights that suffix's path in the suffix trie. Pressing Enter in an input field also rebuilds.TrieEach edge stores one character; all words with a common prefix share the same path from the root. A prefix query descends at most |p| edges, so it takes O(|p|) time regardless of how many words are stored.Suffix array and LCPThe suffix array keeps the starting positions of the suffixes in sorted order. The LCP column gives the length of the longest common prefix between a suffix and the one before it in the order. Suffixes are compared character by character (in code point order).Suffix trieA suffix trie stores every suffix as a path starting at the root; the brute-force suffix trie can need O(n²) memory. A filled node marks the end of a suffix. Suffix trees compress chains of single-child nodes and get down to O(n) memory.ComplexityStructureBuildMemoryQueryTrieO(total length)O(total length)O(|p|)Suffix array (brute-force sorting)O(n² log n)O(n)O(|p| log n)Suffix trie (brute force)O(n²)O(n²)O(|p|)