Skip to content

Commit 1c5ddd0

Browse files
author
Maksim
committed
Readme example refactoring
1 parent 739cbbd commit 1c5ddd0

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@ For now, it supports Insert, HasWord, HasPrefix and WordsByPrefix methods.
77
WordsByPrefix collects all words with given prefix without usage of recursion while search.
88

99
```go
10-
t := NewTrie()
10+
tree := NewTrie()
1111

1212
t.Insert("go", "golang", "gopher", "python", "pythonista", "grow", "gg", "glitch", "glass")
1313

14-
t.HasPrefix("gol") // return true
15-
t.HasPrefix("gole") // return false
14+
hasPrefix := tree.HasPrefix("gol") // return true
15+
hasPrefix = tree.HasPrefix("gene") // return false
1616

17-
t.HasWord("gopher") // return true
18-
t.HasWord("oh") // return false
17+
hasWord := tree.HasWord("gopher") // return true
18+
hasWord = tree.HasWord("foo") // return false
1919

20-
words := t.WordsByPrefix("go") // return []string{"go", "gopher", "golang"}
20+
words := tree.WordsByPrefix("go") // return []string{"go", "gopher", "golang"}
2121
```

0 commit comments

Comments
 (0)