I am having null pointer exception for line parent.children .get(cc).
Null pointer exception
@pradeepbansiwal07,
Your Node class should be:
private class Node {
char data;
HashMap<Character, Node> children;
boolean isTerminal;
Node(char data, boolean isTerminal) {
this.data = data;
// HashMap<Character, Node> children = new HashMap<>(); ERROR
this.children = new HashMap<>(); //CORRECTED
this.isTerminal = isTerminal;
}
}
I have mentioned the error line. You have already declared a Hashmap with the name children. Hence the error. Your code is still not giving output though. Try to find the mistake 
Thank you so much. I will find it.