Java Solution using HashMap
//class WordDictionary {\n\n    public class WordDictionary {\n        Map> mp=new HashMap>();\n    public void addWord(String word) {\n        int idx=word.len
//class WordDictionary {\n\n    public class WordDictionary {\n        Map<Integer, List<String>> mp=new HashMap<Integer, List<String>>();\n    public void addWord(String word) {\n        int idx=word.length();\n        if(!mp.containsKey(idx)){\n            List<String> lst=new ArrayList<String>();\n            lst.add(word);\n            mp.put(idx,lst);\n        }\n        else{\n            mp.get(idx).add(word);\n        }\n    }   \n    \n    /** Returns if the word is in the data structure. A word could contain the dot character \'.\' to represent any one letter. */\n    public boolean search(String word) {\n        int idx=word.length();\n        if(!mp.containsKey(idx)){\n            return false;\n        }\n        List<String> lst=mp.get(idx);\n    if(iswrds(word)){\n        return lst.contains(word);\n    }\n        for(String s: lst)\n        {\n            if(same(s,word)){\n                return true;\n            }\n        }\n        return false;\n}\n\nboolean iswrds(String s){\n        for(int e=0;e<s.length();e++)\n        {\n            if(!Character.isLetter(s.charAt(e)))\n            {\n                return false;\n            }\n        }\n        return true;\n    }\n    boolean same(String s, String b)\n    {\n        if(s.length()!=b.length()){\n         return false;   \n        }\n        \n        for(int e=0;e<s.length();e++)\n        {\n            if(b.charAt(e)!=\'.\' && s.charAt(e)!=b.charAt(e)){\n                return false;\n            }\n        }\n        return true;\n    }\n    }\n/**\n * Your WordDictionary object will be instantiated and called as such:\n * WordDictionary obj = new WordDictionary();\n * obj.addWord(word);\n * boolean param_2 = obj.search(word);\n */
['Depth-First Search', 'Breadth-First Search', 'Java']