Skip to content

Commit 7b8c69d

Browse files
authored
Merge pull request kodecocodes#803 from RandyTheDev/radix-4.2
[Swift 4.2] Radix Sort Migration
2 parents aaf3bdc + 36ae366 commit 7b8c69d

File tree

3 files changed

+2
-21
lines changed

3 files changed

+2
-21
lines changed
Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,10 @@
11
//: Playground - noun: a place where people can play
22

3-
import Cocoa
4-
5-
// last checked with Xcode 9.0b4
6-
#if swift(>=4.0)
7-
print("Hello, Swift 4!")
8-
#endif
9-
103
// Test Radix Sort with small array of ten values
114
var array: [Int] = [19, 4242, 2, 9, 912, 101, 55, 67, 89, 32]
125
radixSort(&array)
136

147
// Test Radix Sort with large array of 1000 random values
15-
var bigArray = [Int](repeating: 0, count: 1000)
16-
var i = 0
17-
while i < 1000 {
18-
bigArray[i] = Int(arc4random_uniform(1000) + 1)
19-
i += 1
20-
}
8+
var bigArray = (0..<1000).map { _ in Int.random(in: 1...1000) }
9+
bigArray
2110
radixSort(&bigArray)

Radix Sort/RadixSort.playground/Sources/radixSort.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
Sorting Algorithm that sorts an input array of integers digit by digit.
44

55
*/
6-
import Foundation
76

87
// NOTE: This implementation does not handle negative numbers
98
public func radixSort(_ array: inout [Int] ) {

Radix Sort/Tests/RadixSortTests.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@
99
import XCTest
1010

1111
class RadixSortTests: XCTestCase {
12-
func testSwift4() {
13-
// last checked with Xcode 9.0b4
14-
#if swift(>=4.0)
15-
print("Hello, Swift 4!")
16-
#endif
17-
}
18-
1912
func testCombSort() {
2013
let expectedSequence: [Int] = [2, 9, 19, 32, 55, 67, 89, 101, 912, 4242]
2114
var sequence = [19, 4242, 2, 9, 912, 101, 55, 67, 89, 32]

0 commit comments

Comments
 (0)