File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 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 {
122122// MARK: Bucket
123123//////////////////////////////////////
124124
125- public struct Bucket < T: Sortable > {
125+ public struct Bucket < T: Sortable > {
126126 var elements : [ T ]
127127 let capacity : Int
128128
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ public struct InsertionSorter: Sorter {
173173// MARK: Bucket
174174//////////////////////////////////////
175175
176- public struct Bucket < T: Sortable > {
176+ public struct Bucket < T: Sortable > {
177177 var elements : [ T ]
178178 let capacity : Int
179179
Original file line number Diff line number Diff line change @@ -150,7 +150,7 @@ class View: UIView {
150150 let context = UIGraphicsGetCurrentContext ( )
151151
152152 // Draw hull
153- let lineWidth : CGFloat = 2.0
153+ let lineWidth : CGFloat = 2.0
154154
155155 context!. setFillColor ( UIColor . black. cgColor)
156156 context!. setLineWidth ( lineWidth)
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ public struct Deque<T> {
77 private var array : [ T ? ]
88 private var head : Int
99 private var capacity : Int
10- private let originalCapacity : Int
10+ private let originalCapacity : Int
1111
1212 public init ( _ capacity: Int = 10 ) {
1313 self . capacity = max ( capacity, 1 )
Original file line number Diff line number Diff line change @@ -177,7 +177,7 @@ public final class LinkedList<T> {
177177 if list. isEmpty { return }
178178 var ( prev, next) = nodesBeforeAndAfter ( index: index)
179179 var nodeToCopy = list. head
180- var newNode : Node ?
180+ var newNode : Node ?
181181 while let node = nodeToCopy {
182182 newNode = Node ( value: node. value)
183183 newNode? . previous = prev
Original file line number Diff line number Diff line change @@ -129,7 +129,7 @@ public final class LinkedList<T> {
129129 if list. isEmpty { return }
130130 var ( prev, next) = nodesBeforeAndAfter ( index: index)
131131 var nodeToCopy = list. head
132- var newNode : Node ?
132+ var newNode : Node ?
133133 while let node = nodeToCopy {
134134 newNode = Node ( value: node. value)
135135 newNode? . previous = prev
Original file line number Diff line number Diff line change @@ -7,9 +7,9 @@ private enum RBTColor {
77public class RBTNode < T: Comparable > : CustomStringConvertible {
88 fileprivate var color : RBTColor = . red
99 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 > !
1313
1414 public var description : String {
1515 if self . value == nil {
@@ -435,7 +435,7 @@ public class RBTree<T: Comparable>: CustomStringConvertible {
435435 private func property3( ) {
436436 let bDepth = blackDepth ( root: self . root)
437437
438- let leaves : [ RBTNode < T > ] = getLeaves ( n: self . root)
438+ let leaves : [ RBTNode < T > ] = getLeaves ( n: self . root)
439439
440440 for leaflet in leaves {
441441 var leaf = leaflet
Original file line number Diff line number Diff line change @@ -283,7 +283,7 @@ extension SkipList {
283283
284284extension SkipList {
285285
286- public func get( key: Key ) -> Payload ? {
286+ public func get( key: Key ) -> Payload ? {
287287 return search ( key: key)
288288 }
289289}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public class Graph: CustomStringConvertible {
44 private( set) public var adjacencyLists : [ Node : [ Node ] ]
55
66 public init ( ) {
7- adjacencyLists = [ Node : [ Node] ] ( )
7+ adjacencyLists = [ Node: [ Node] ] ( )
88 }
99
1010 public func addNode( _ value: Node ) -> Node {
@@ -35,7 +35,7 @@ extension Graph {
3535 typealias InDegree = Int
3636
3737 func calculateInDegreeOfNodes( ) -> [ Node : InDegree ] {
38- var inDegrees = [ Node : InDegree] ( )
38+ var inDegrees = [ Node: InDegree] ( )
3939
4040 for (node, _) in adjacencyLists {
4141 inDegrees [ node] = 0
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ public class Graph: CustomStringConvertible {
44 private( set) public var adjacencyLists : [ Node : [ Node ] ]
55
66 public init ( ) {
7- adjacencyLists = [ Node : [ Node] ] ( )
7+ adjacencyLists = [ Node: [ Node] ] ( )
88 }
99
1010 public func addNode( _ value: Node ) -> Node {
@@ -35,7 +35,7 @@ extension Graph {
3535 typealias InDegree = Int
3636
3737 func calculateInDegreeOfNodes( ) -> [ Node : InDegree ] {
38- var inDegrees = [ Node : InDegree] ( )
38+ var inDegrees = [ Node: InDegree] ( )
3939
4040 for (node, _) in adjacencyLists {
4141 inDegrees [ node] = 0
You can’t perform that action at this time.
0 commit comments