package com.dw.algorithmlib;

public class Trie {
	
	static final int ALPHABET_SIZE = 26; 
	
	static class TrieNode 
    { 
        TrieNode[] children = new TrieNode[ALPHABET_SIZE]; 
       
        // isEndOfWord is true if the node represents 
        // end of a word 
        boolean isEndOfWord; 
          
        TrieNode(){ 
            isEndOfWord = false; 
            for (int i = 0; i < ALPHABET_SIZE; i++) 
                children[i] = null; 
        } 
    }; 

	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}

@@ -23,16 +23,68 @@
 hmlib;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 public c
@@ -96,519 +96,723 @@
 Trie
+Node
  %7B%0A%09%0A%09
-static final int ALPHABET_SIZE = 26; %0A%09%0A%09static class TrieNode %0A    %7B %0A        TrieNode%5B%5D children = new TrieNode%5BALPHABET_SIZE%5D; %0A       %0A        // isEndOfWord is true if the node represents %0A        // end of a word %0A        boolean isEndOfWord; %0A          %0A        TrieNode()%7B %0A            isEndOfWord = false; %0A            
+public char val;%0A%09public TrieNode%5B%5D hash;%0A%09public boolean isWord;%0A%09%0A%09public TrieNode(char c) %7B%0A%09%09this.val = c;%0A%09%09this.hash = new TrieNode%5B26%5D;%0A%09%09this.isWord = false;%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A%09%09TrieNode root=new TrieNode(' ');%0A%09%09%0A%09%09List%3CString%3E words = new ArrayList%3CString%3E();%0A%09%09words.add(%22%22);%0A%09%09%0A%09%09for(String word : words) %7B%0A%09%09%09TrieNode current = root;%0A%09%09%09
 for
- 
 (int i
- = 0; i %3C ALPHABET_SIZE; i++) %0A                children%5Bi
+=0;i%3Cword.length();i++) %7B%0A%09%09%09%09char c = word.charAt(i);%0A%09%09%09%09%0A%09%09%09%09if(current.hash%5Bc-'a'
 %5D =
+=
  null
-; %0A        %7D %0A    %7D; %0A%0A%09public static void main(String%5B%5D args) %7B%0A%09%09// TODO Auto-generated method stub%0A
+) %7B%0A%09%09%09%09%09current.hash%5Bc-'a'%5D = new TrieNode(c);%0A%09%09%09%09%7D%0A%09%09%09%09%0A%09%09%09%09current = current.hash%5Bword.charAt(i)-'a'%5D;%0A%09%09%09%09%0A%09%09%09%09if(i == word.length() - 1) %7B%0A%09%09%09%09%09current.isWord = true;%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D
 %0A%09%7D%0A

add TrieNode