File tree 12 files changed +17
-17
lines changed
BucketSort.playground/Sources
Red-Black Tree/Red-Black Tree 2.playground/Sources
Topological Sort.playground/Sources
12 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ public struct InsertionSorter: Sorter {
122
122
// MARK: Bucket
123
123
//////////////////////////////////////
124
124
125
- public struct Bucket < T: Sortable > {
125
+ public struct Bucket < T: Sortable > {
126
126
var elements : [ T ]
127
127
let capacity : Int
128
128
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ public struct InsertionSorter: Sorter {
173
173
// MARK: Bucket
174
174
//////////////////////////////////////
175
175
176
- public struct Bucket < T: Sortable > {
176
+ public struct Bucket < T: Sortable > {
177
177
var elements : [ T ]
178
178
let capacity : Int
179
179
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ class View: UIView {
150
150
let context = UIGraphicsGetCurrentContext ( )
151
151
152
152
// Draw hull
153
- let lineWidth : CGFloat = 2.0
153
+ let lineWidth : CGFloat = 2.0
154
154
155
155
context!. setFillColor ( UIColor . black. cgColor)
156
156
context!. setLineWidth ( lineWidth)
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ public struct Deque<T> {
7
7
private var array : [ T ? ]
8
8
private var head : Int
9
9
private var capacity : Int
10
- private let originalCapacity : Int
10
+ private let originalCapacity : Int
11
11
12
12
public init ( _ capacity: Int = 10 ) {
13
13
self . capacity = max ( capacity, 1 )
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ public final class LinkedList<T> {
177
177
if list. isEmpty { return }
178
178
var ( prev, next) = nodesBeforeAndAfter ( index: index)
179
179
var nodeToCopy = list. head
180
- var newNode : Node ?
180
+ var newNode : Node ?
181
181
while let node = nodeToCopy {
182
182
newNode = Node ( value: node. value)
183
183
newNode? . previous = prev
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public final class LinkedList<T> {
129
129
if list. isEmpty { return }
130
130
var ( prev, next) = nodesBeforeAndAfter ( index: index)
131
131
var nodeToCopy = list. head
132
- var newNode : Node ?
132
+ var newNode : Node ?
133
133
while let node = nodeToCopy {
134
134
newNode = Node ( value: node. value)
135
135
newNode? . previous = prev
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ private enum RBTColor {
7
7
public class RBTNode < T: Comparable > : CustomStringConvertible {
8
8
fileprivate var color : RBTColor = . red
9
9
public var value : T ! = nil
10
- public var right : RBTNode < T > !
11
- public var left : RBTNode < T > !
12
- public var parent : RBTNode < T > !
10
+ public var right : RBTNode < T > !
11
+ public var left : RBTNode < T > !
12
+ public var parent : RBTNode < T > !
13
13
14
14
public var description : String {
15
15
if self . value == nil {
@@ -435,7 +435,7 @@ public class RBTree<T: Comparable>: CustomStringConvertible {
435
435
private func property3( ) {
436
436
let bDepth = blackDepth ( root: self . root)
437
437
438
- let leaves : [ RBTNode < T > ] = getLeaves ( n: self . root)
438
+ let leaves : [ RBTNode < T > ] = getLeaves ( n: self . root)
439
439
440
440
for leaflet in leaves {
441
441
var leaf = leaflet
Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ extension SkipList {
283
283
284
284
extension SkipList {
285
285
286
- public func get( key: Key ) -> Payload ? {
286
+ public func get( key: Key ) -> Payload ? {
287
287
return search ( key: key)
288
288
}
289
289
}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public class Graph: CustomStringConvertible {
4
4
private( set) public var adjacencyLists : [ Node : [ Node ] ]
5
5
6
6
public init ( ) {
7
- adjacencyLists = [ Node : [ Node] ] ( )
7
+ adjacencyLists = [ Node: [ Node] ] ( )
8
8
}
9
9
10
10
public func addNode( _ value: Node ) -> Node {
@@ -35,7 +35,7 @@ extension Graph {
35
35
typealias InDegree = Int
36
36
37
37
func calculateInDegreeOfNodes( ) -> [ Node : InDegree ] {
38
- var inDegrees = [ Node : InDegree] ( )
38
+ var inDegrees = [ Node: InDegree] ( )
39
39
40
40
for (node, _) in adjacencyLists {
41
41
inDegrees [ node] = 0
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public class Graph: CustomStringConvertible {
4
4
private( set) public var adjacencyLists : [ Node : [ Node ] ]
5
5
6
6
public init ( ) {
7
- adjacencyLists = [ Node : [ Node] ] ( )
7
+ adjacencyLists = [ Node: [ Node] ] ( )
8
8
}
9
9
10
10
public func addNode( _ value: Node ) -> Node {
@@ -35,7 +35,7 @@ extension Graph {
35
35
typealias InDegree = Int
36
36
37
37
func calculateInDegreeOfNodes( ) -> [ Node : InDegree ] {
38
- var inDegrees = [ Node : InDegree] ( )
38
+ var inDegrees = [ Node: InDegree] ( )
39
39
40
40
for (node, _) in adjacencyLists {
41
41
inDegrees [ node] = 0
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ extension Graph {
23
23
return node
24
24
} )
25
25
26
- var visited = [ Node : Bool] ( )
26
+ var visited = [ Node: Bool] ( )
27
27
for (node, _) in adjacencyLists {
28
28
visited [ node] = false
29
29
}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ extension Graph {
23
23
return node
24
24
} )
25
25
26
- var visited = [ Node : Bool] ( )
26
+ var visited = [ Node: Bool] ( )
27
27
for (node, _) in adjacencyLists {
28
28
visited [ node] = false
29
29
}
You can’t perform that action at this time.
0 commit comments