Skip to content
Snippets Groups Projects
Commit 8d1f0569 authored by Marek Vavrusa's avatar Marek Vavrusa Committed by Gerrit Code Review
Browse files

Implemented HAT trie longest prefix match + tests.

General idea is regular search with keeping node stack.
If node is found, then return current node.
If node is htable, search for suffixes in htable.
If anything fails, walk up the visited nodes and check if
any visited node has value. If yes, then it is a prefix.

f.e. searching for 'abcd'
visited nodes: root -a-> {1:trie} -b-> {2:htable}
1. search htable for 'cd', 'c'
2. retrace to node {1}, does it have value?
3. yes, node1 is prefix 'ab' for 'abcd'

Change-Id: I622adbe9a127d8317b933af4bf56e1411e2d915f
parent 6c00e514
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment