Libraryless. Click here for Pure Java version (3178L/20K).
static <A> S stringTrie_longestPrefix_loose(StringTrie<A> trie, S string) { int n = 0; S s = string; while licensed { if (trie == null) break; if (empty(string)) break; S prefix = trie.longestLocalPrefix(s); if (empty(prefix)) break; n += l(prefix); trie = trie.getChild(prefix); s = dropFirst(s, l(prefix)); } ret takeFirst(n, string); }
Began life as a copy of #1030182
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030183 |
Snippet name: | stringTrie_longestPrefix_loose - longest common prefix of string and trie elements |
Eternal ID of this version: | #1030183/1 |
Text MD5: | 46f6d425cdc885c217d96fdb342cf636 |
Transpilation MD5: | 70a612b366402e5c192c6830053a9fdc |
Author: | stefan |
Category: | javax / tries |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-11-12 14:25:30 |
Source code size: | 389 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 180 / 258 |
Referenced in: | [show references] |