Skip to content

Commit

Permalink
Updated Radix Sort to Swift 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
RandyTheDev committed Oct 21, 2018
1 parent 9f5e81e commit 66d0b86
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
15 changes: 2 additions & 13 deletions Radix Sort/RadixSort.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
//: Playground - noun: a place where people can play

import Cocoa

// last checked with Xcode 9.0b4
#if swift(>=4.0)
print("Hello, Swift 4!")
#endif

// Test Radix Sort with small array of ten values
var array: [Int] = [19, 4242, 2, 9, 912, 101, 55, 67, 89, 32]
radixSort(&array)

// Test Radix Sort with large array of 1000 random values
var bigArray = [Int](repeating: 0, count: 1000)
var i = 0
while i < 1000 {
bigArray[i] = Int(arc4random_uniform(1000) + 1)
i += 1
}
var bigArray = (0..<1000).map { _ in Int.random(in: 1...1000) }
bigArray
radixSort(&bigArray)
1 change: 0 additions & 1 deletion Radix Sort/RadixSort.playground/Sources/radixSort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Sorting Algorithm that sorts an input array of integers digit by digit.

*/
import Foundation

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

0 comments on commit 66d0b86

Please sign in to comment.