File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
src/com/deepak/data/structures/Trie
test/com/deepak/data/structures/Trie Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -28,9 +28,11 @@ public TrieImplementation() {
2828
2929 /**
3030 * Method to insert a word in Trie
31+ *
3132 * @param word
3233 */
3334 public void insert (String word ) {
35+ /* Find the children of root node */
3436 HashMap <Character , TrieNode > children = root .children ;
3537 for (int i = 0 ; i < word .length (); i ++) {
3638 char character = word .charAt (i );
@@ -50,6 +52,7 @@ public void insert(String word) {
5052
5153 /**
5254 * Method to check if a word in Trie starts with the given prefix
55+ *
5356 * @param prefix
5457 * @return {@link boolean}
5558 */
@@ -62,6 +65,7 @@ public boolean startsWith(String prefix) {
6265
6366 /**
6467 * Method to search TrieNode based on the word
68+ *
6569 * @param word
6670 * @return {@link TrieNode}
6771 */
@@ -82,6 +86,7 @@ public TrieNode searchNode(String word) {
8286
8387 /**
8488 * Method to search the given word in the Trie
89+ *
8590 * @param word
8691 * @return {@link boolean}
8792 */
Original file line number Diff line number Diff line change 11/**
2- * Data-Structures-in -Java
2+ * Data-Structures-In -Java
33 * TrieTest.java
44 */
55package com .deepak .data .structures .Trie ;
You can’t perform that action at this time.
0 commit comments