You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Trie/trie.swift
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,19 +4,19 @@
4
4
publicstructQueue<T>{
5
5
privatevararray=[T?]()
6
6
privatevarhead=0
7
-
7
+
8
8
publicvarisEmpty:Bool{
9
9
return count ==0
10
10
}
11
11
12
12
publicvarcount:Int{
13
13
return array.count - head
14
14
}
15
-
15
+
16
16
publicmutatingfunc enqueue(element:T){
17
17
array.append(element)
18
18
}
19
-
19
+
20
20
publicmutatingfunc dequeue()->T?{
21
21
guard head < array.count,let element =array[head]else{returnnil}
22
22
@@ -28,7 +28,7 @@ public struct Queue<T> {
28
28
array.removeFirst(head)
29
29
head =0
30
30
}
31
-
31
+
32
32
return element
33
33
}
34
34
}
@@ -388,11 +388,11 @@ public class Trie {
388
388
Functionality: attempts to insert all words from input array. returns a tuple containing the input array and true if some of the words were succesffuly added, false if none were added
0 commit comments