public boolean startsWith(String prefix) {
        TrieNode ptr = root;
        for (char c : prefix.toCharArray()) {
            if (ptr.children[c - 'a'] == null)
                return false;
            ptr = ptr.children[c - 'a'];
        }
        return true;

    }