private boolean search(Node root,String data,int pos){
        if(pos == data.length()){
            return true;
        }
        if(root == null){
            return false;
        }
        if(root.data == data.charAt(pos)){
            boolean result = search(root.eq,data,pos+1);
            if(pos == data.length() -1){
                return result && root.isLeaf;
            }
            return result;
        }else if(root.data < data.charAt(pos)){
            return search(root.right,data,pos);
        }else{
            return search(root.left,data,pos);
        }
    }
http://www.geeksforgeeks.org/ternary-search-tree/
src/com/interview/suffixprefix/TernaryTree.java