Skip to content

Commit 6f9ef9b

Browse files
author
Thukor
committed
Radix-Sort -> Radix Sort, Got rid of unnecessary ()'s in Trie
1 parent ea555cc commit 6f9ef9b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed
File renamed without changes.
File renamed without changes.

Trie/trie.swift

+5-5
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public class Node {
191191
func printNode(var indent: String, leaf: Bool) {
192192

193193
print(indent, terminator: "")
194-
if(leaf) {
194+
if leaf {
195195
print("\\-", terminator: "")
196196
indent += " "
197197
}
@@ -359,7 +359,7 @@ public class Trie {
359359
length -= 1
360360
index += 1
361361

362-
if(length == 0) {
362+
if length == 0 {
363363
currentNode.isWord()
364364
wordList.append(w)
365365
wordCount += 1
@@ -407,7 +407,7 @@ public class Trie {
407407
func remove(w: String) -> (word: String, removed: Bool){
408408
let word = w.lowercaseString
409409

410-
if(!self.contains(w)) {
410+
if !self.contains(w) {
411411
return (w, false)
412412
}
413413
var currentNode = self.root
@@ -464,10 +464,10 @@ public class Trie {
464464

465465
while let current = q.dequeue() {
466466
for (char, child) in current.getChildren() {
467-
if(!child.visited) {
467+
if !child.visited {
468468
q.enqueue(child)
469469
child.visited = true
470-
if(child.isValidWord()) {
470+
if child.isValidWord() {
471471
var currentNode = child
472472
while currentNode !== n {
473473
tmp += currentNode.char()

0 commit comments

Comments
 (0)