naive and non-naive trie-like implementations