Skip to content

Commit b563b93

Browse files
Kelvin LauKelvin Lau
authored andcommitted
Fixed spacing
1 parent 931e85b commit b563b93

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Trie/ReadMe.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,19 @@ func contains(word: String) -> Bool {
3030
// 1
3131
var currentNode = root
3232

33-
// 2
33+
// 2
3434
var characters = Array(word.lowercased().characters)
3535
var currentIndex = 0
3636

37-
// 3
37+
// 3
3838
while currentIndex < characters.count,
3939
let child = currentNode.children[character[currentIndex]] {
4040

4141
currentNode = child
4242
currentIndex += 1
4343
}
4444

45-
// 4
45+
// 4
4646
if currentIndex == characters.count && currentNode.isTerminating {
4747
return true
4848
} else {
@@ -69,15 +69,15 @@ func insert(word: String) {
6969
// 1
7070
var currentNode = root
7171

72-
// 2
72+
// 2
7373
var characters = Array(word.lowercased().characters)
7474
var currentIndex = 0
7575

76-
// 3
76+
// 3
7777
while currentIndex < characters.count {
7878
let character = characters[currentIndex]
7979

80-
// 4
80+
// 4
8181
if let child = currentNode.children[character] {
8282
currentNode = child
8383
} else {
@@ -87,7 +87,7 @@ func insert(word: String) {
8787

8888
currentIndex += 1
8989

90-
// 5
90+
// 5
9191
if currentIndex == characters.count {
9292
currentNode.isTerminating = true
9393
}
@@ -111,22 +111,22 @@ If you'd like to remove "Apple", you'll need to take care to leave the "App" cha
111111
func remove(word: String) {
112112
guard !word.isEmpty else { return }
113113

114-
// 1
114+
// 1
115115
var currentNode = root
116116

117-
// 2
117+
// 2
118118
var characters = Array(word.lowercased().characters)
119119
var currentIndex = 0
120120

121-
// 3
121+
// 3
122122
while currentIndex < characters.count {
123123
let character = characters[currentIndex]
124124
guard let child = currentNode.children[character] else { return }
125125
currentNode = child
126126
currentIndex += 1
127127
}
128128

129-
// 4
129+
// 4
130130
if currentNode.children.count > 0 {
131131
currentNode.isTerminating = false
132132
} else {

0 commit comments

Comments
 (0)