Skip to content

Commit 9979f58

Browse files
author
Deepak Malik
committed
Trie Cleanup
1 parent 986414b commit 9979f58

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/com/deepak/data/structures/Trie/TrieImplementation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
*/

test/com/deepak/data/structures/Trie/TrieTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Data-Structures-in-Java
2+
* Data-Structures-In-Java
33
* TrieTest.java
44
*/
55
package com.deepak.data.structures.Trie;

0 commit comments

Comments
 (0)