Skip to content

Commit b5d0580

Browse files
authored
Merge pull request kodecocodes#476 from ph1ps/fix-workspace
Clean workspace
2 parents b9875ca + f5a25d1 commit b5d0580

File tree

71 files changed

+683
-371
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+683
-371
lines changed

AVL Tree/AVLTree.playground/Sources/AVLTree.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ extension AVLTree {
341341
}
342342
} else {
343343
// Handle stem cases
344-
if let replacement = node.leftChild?.maximum() , replacement !== node {
344+
if let replacement = node.leftChild?.maximum(), replacement !== node {
345345
node.key = replacement.key
346346
node.payload = replacement.payload
347347
delete(node: replacement)
348-
} else if let replacement = node.rightChild?.minimum() , replacement !== node {
348+
} else if let replacement = node.rightChild?.minimum(), replacement !== node {
349349
node.key = replacement.key
350350
node.payload = replacement.payload
351351
delete(node: replacement)
@@ -354,7 +354,6 @@ extension AVLTree {
354354
}
355355
}
356356

357-
358357
// MARK: - Debugging
359358

360359
extension TreeNode: CustomDebugStringConvertible {

AVL Tree/AVLTree.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ extension AVLTree {
341341
}
342342
} else {
343343
// Handle stem cases
344-
if let replacement = node.leftChild?.maximum() , replacement !== node {
344+
if let replacement = node.leftChild?.maximum(), replacement !== node {
345345
node.key = replacement.key
346346
node.payload = replacement.payload
347347
delete(node: replacement)
348-
} else if let replacement = node.rightChild?.minimum() , replacement !== node {
348+
} else if let replacement = node.rightChild?.minimum(), replacement !== node {
349349
node.key = replacement.key
350350
node.payload = replacement.payload
351351
delete(node: replacement)
@@ -354,7 +354,6 @@ extension AVLTree {
354354
}
355355
}
356356

357-
358357
// MARK: - Debugging
359358

360359
extension TreeNode: CustomDebugStringConvertible {

AVL Tree/Tests/TreeNodeTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class TreeNodeTests: XCTestCase {
2727
super.tearDown()
2828
}
2929

30-
3130
func testSingleNodeCreationNOPayload() {
3231
let treeNode = TreeNode<String, String>(key: "Building")
3332
XCTAssertNil(treeNode.payload, "Payload for this case should be nil")

All-Pairs Shortest Paths/APSP/APSP/Helpers.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import Foundation
99

10-
1110
/**
1211
Print a matrix, optionally specifying only the cells to display with the triplet (i, j, k) -> matrix[i][j], matrix[i][k], matrix[k][j]
1312
*/

Array2D/Array2D.playground/Contents.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public struct Array2D<T> {
2828
}
2929
}
3030

31-
3231
// initialization
3332
var matrix = Array2D(columns: 3, rows: 5, initialValue: 0)
3433

Binary Tree/BinaryTree.playground/Contents.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ extension BinaryTree: CustomStringConvertible {
2525
}
2626
}
2727

28-
29-
3028
// leaf nodes
3129
let node5 = BinaryTree.node(.empty, "5", .empty)
3230
let nodeA = BinaryTree.node(.empty, "a", .empty)
@@ -50,8 +48,6 @@ let tree = BinaryTree.node(timesLeft, "+", timesRight)
5048
print(tree)
5149
tree.count // 12
5250

53-
54-
5551
extension BinaryTree {
5652
public func traverseInOrder(process: (T) -> Void) {
5753
if case let .node(left, value, right) = self {

Bit Set/BitSet.playground/Contents.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ print(bits)
2929

3030
print("")
3131

32-
33-
34-
3532
// Bitwise operations
3633

3734
var a = BitSet(size: 4)
@@ -69,9 +66,6 @@ print(~c) // 0101110000000000000000000000000000000000000000000000000000000000
6966
(~b).cardinality // 5
7067
(~c).cardinality // 4
7168

72-
73-
74-
7569
var z = BitSet(size: 66)
7670
z.all0() // true
7771
z.all1() // false
@@ -93,8 +87,5 @@ z.all1() // true
9387
z[65] = false
9488
z.all1() // false
9589

96-
97-
98-
9990
//var bigBits = BitSet(size: 10000)
10091
//print(bigBits)

Bloom Filter/BloomFilter.playground/Contents.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ public class BloomFilter<T> {
4747
}
4848
}
4949

50-
51-
5250
/* Two hash functions, adapted from http://www.cse.yorku.ca/~oz/hash.html */
5351

5452
func djb2(x: String) -> Int {
@@ -67,8 +65,6 @@ func sdbm(x: String) -> Int {
6765
return Int(hash)
6866
}
6967

70-
71-
7268
/* A simple test */
7369

7470
let bloom = BloomFilter<String>(size: 17, hashFunctions: [djb2, sdbm])

Bloom Filter/Tests/BloomFilterTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ func sdbm(_ x: String) -> Int {
2323
return Int(hash)
2424
}
2525

26-
2726
class BloomFilterTests: XCTestCase {
2827

2928
func testSingleHashFunction() {

Bounded Priority Queue/BoundedPriorityQueue.playground/Contents.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ func < (m1: Message, m2: Message) -> Bool {
1515
return m1.priority < m2.priority
1616
}
1717

18-
19-
2018
let queue = BoundedPriorityQueue<Message>(maxElements: 5)
2119
queue.count
2220

@@ -48,8 +46,6 @@ print(queue)
4846
// At this point, the queue is:
4947
// <world:150, swift:110, hello:100, there:99, is:30, >
5048

51-
52-
5349
// Try to insert an item with a really low priority. This should not get added.
5450
queue.enqueue(Message(name: "very", priority: -1))
5551
queue.count // 5
@@ -70,8 +66,6 @@ queue.count
7066
queue.peek()
7167
print(queue)
7268

73-
74-
7569
// Test dequeuing
7670
queue.dequeue()
7771
queue.count

0 commit comments

Comments
 (0)