Null pointer exception

I am having null pointer exception for line parent.children .get(cc).

@pradeepbansiwal07,
Please share your code as well. Use https://ide.codingblocks.com/ for that.

I saved the code to the server under name trieDS https://ide.codingblocks.com/s/278651

@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 :smile:

Thank you so much. I will find it.