Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ install:
script:

# - xcodebuild test -project ./All-Pairs\ Shortest\ Paths/APSP/APSP.xcodeproj -scheme APSPTests
- xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Array2D/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./AVL\ Tree/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Binary\ Search/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Binary\ Search\ Tree/Solution\ 1/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Bloom\ Filter/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Bounded\ Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
Expand All @@ -29,13 +29,13 @@ script:
# - xcodebuild test -project ./Longest\ Common\ Subsequence/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Minimum\ Spanning\ Tree\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Priority\ Queue/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Queue/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Quicksort/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Run-Length\ Encoding/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Select\ Minimum\ Maximum/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Selection\ Sort/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Shell\ Sort/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Shortest\ Path\ \(Unweighted\)/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Single-Source\ Shortest\ Paths\ \(Weighted\)/SSSP.xcodeproj -scheme SSSPTests
# - xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
- xcodebuild test -project ./Stack/Tests/Tests.xcodeproj -scheme Tests
# - xcodebuild test -project ./Topological\ Sort/Tests/Tests.xcodeproj -scheme Tests
6 changes: 3 additions & 3 deletions Queue/Queue-Optimized.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
Enqueuing and dequeuing are O(1) operations.
*/
public struct Queue<T> {
private var array = [T?]()
private var head = 0
fileprivate var array = [T?]()
fileprivate var head = 0

public var isEmpty: Bool {
return count == 0
Expand All @@ -18,7 +18,7 @@ public struct Queue<T> {
return array.count - head
}

public mutating func enqueue(element: T) {
public mutating func enqueue(_ element: T) {
array.append(element)
}

Expand Down
4 changes: 2 additions & 2 deletions Queue/Queue-Simple.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
implemented with a linked list, then both would be O(1).
*/
public struct Queue<T> {
private var array = [T]()
fileprivate var array = [T]()

public var count: Int {
return array.count
Expand All @@ -18,7 +18,7 @@ public struct Queue<T> {
return array.isEmpty
}

public mutating func enqueue(element: T) {
public mutating func enqueue(_ element: T) {
array.append(element)
}

Expand Down
4 changes: 2 additions & 2 deletions Queue/Queue.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*/

public struct Queue<T> {
private var array = [T]()
fileprivate var array = [T]()

public var isEmpty: Bool {
return array.isEmpty
Expand All @@ -22,7 +22,7 @@ public struct Queue<T> {
return array.count
}

public mutating func enqueue(element: T) {
public mutating func enqueue(_ element: T) {
array.append(element)
}

Expand Down
10 changes: 5 additions & 5 deletions Queue/README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Here is a very simplistic implementation of a queue in Swift. It's just a wrappe

```swift
public struct Queue<T> {
private var array = [T]()
fileprivate var array = [T]()

public var isEmpty: Bool {
return array.isEmpty
Expand All @@ -56,7 +56,7 @@ public struct Queue<T> {
return array.count
}

public mutating func enqueue(element: T) {
public mutating func enqueue(_ element: T) {
array.append(element)
}

Expand Down Expand Up @@ -136,8 +136,8 @@ Here is how you could implement this version of `Queue`:

```swift
public struct Queue<T> {
private var array = [T?]()
private var head = 0
fileprivate var array = [T?]()
fileprivate var head = 0

public var isEmpty: Bool {
return count == 0
Expand All @@ -147,7 +147,7 @@ public struct Queue<T> {
return array.count - head
}

public mutating func enqueue(element: T) {
public mutating func enqueue(_ element: T) {
array.append(element)
}

Expand Down
10 changes: 9 additions & 1 deletion Queue/Tests/Tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,12 @@
isa = PBXProject;
attributes = {
LastSwiftUpdateCheck = 0720;
LastUpgradeCheck = 0720;
LastUpgradeCheck = 0800;
ORGANIZATIONNAME = "Swift Algorithm Club";
TargetAttributes = {
7B2BBC7F1C779D720067B71D = {
CreatedOnToolsVersion = 7.2;
LastSwiftMigration = 0800;
};
};
};
Expand Down Expand Up @@ -145,8 +146,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
Expand Down Expand Up @@ -189,8 +192,10 @@
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
Expand All @@ -209,6 +214,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.11;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
Expand All @@ -220,6 +226,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -231,6 +238,7 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = swift.algorithm.club.Tests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0720"
LastUpgradeVersion = "0800"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down