Lesson 5.2
Inserting a route - the longest common prefix and the split
The four cases of inserting a label under a node, the edge split at the longest common prefix, and the RouteRecord whose property layout is fixed at creation. Then you write route and the recursive insert.
What you will build
- Walk the four insert cases - new leaf, exact match, descend, and the partial-match split.
- Handle the split sub-case where the incoming label is entirely a prefix of an existing edge.
- Build a RouteRecord with all seven lifetime fields declared at creation, and store it in a null-prototype method map.