Foundations
Linear Structures
Hashing
Array and String Patterns
Recursion, Search, and Sorting
Problem Solving Patterns
Algorithm Searching
Sorting Algorithms
Array Algorithms
Grid Algorithms
Linear Structure Algorithms
Hashing Algorithms
Recursion and Backtracking
Greedy Algorithms
Tree and Heap Algorithms
Graph Algorithms
Dynamic Programming Algorithms
String Algorithms
Math Algorithms
Keyboard ready
Space plays. Arrow keys step. R restarts.
LAB Trie Insert and Search Lab
Strings
Problem shape
Intermediate
4
8
15
16
23
42
Core idea
Store strings as paths through character nodes.
Step 1 / 5
Problem shape
Strings Intermediate
Trie Insert and Search
Welcome to the Trie Insert and Search algorithm lab. Store strings as paths through character nodes. Use it when: Use for prefixes, autocomplete, dictionaries, and word search. The time complexity is O(length), and the space complexity is O(total characters). The pseudocode is: node = root for char in word if child missing create it node = child mark node as word end As you practice, track the state that changes and the condition that makes the algorithm stop.
Time
O(length)
Space
O(total characters)
Pseudocode
node = root
for char in word
if child missing create it
node = child
mark node as word end 1.0x