You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 매칭 시, Trie 활용 팁 두가지
1. 각 Trie node에 `length` 변수 추가 후 Trie 구축중에 계산 (`length`: 해당 노드 이후 매칭되는 단어의 총 개수)
2. prefix 단어(e.g. `???ord`) matching 에는 단어를 거꾸로 해서 넣은 Trie 사용,
postfix 단어(e.g. `ord???`) matching 에는 일반 Trie 사용
3. 만약 매칭해야되는 단어의 길이가 다양할 경우, 길이에 따른 여러개의 Trie를 구성하는 것이 좋다.
postfix가 겹치는 단어는 지워질 수 있으므로, 모든 단어들을 뒤집어서 Trie 구조에 집어넣으면 된다.
모든 단어들을 넣은 다음, Trie의 root node부터 각 leaf node까지의 길이(단어 길이)를 모두 더하고, leaf node의 총 개수(# 개수)를 더해주면 된다.