Returns true if the key is present in the trie
static bool search ( TrieNode root , String key ) { TrieNode pCrawl = root ; for ( int i = 0 ; i < key . Length ; i ++ ) { int index = key [ i ] - ' a ' ; if ( pCrawl . children [ index ] == null ) return false ; pCrawl = pCrawl . children [ index ] ; } return ( pCrawl != null && pCrawl . isEndOfWord ) ; }