Skip to content

Commit 0f08fa9

Browse files
committed
[Swift 4.2] Updated Selection Sort
1 parent a31bd41 commit 0f08fa9

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

Selection Sort/SelectionSort.playground/Contents.swift

-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
//: Playground - noun: a place where people can play
22

3-
// last checked with Xcode 9.0b4
4-
#if swift(>=4.0)
5-
print("Hello, Swift 4!")
6-
#endif
7-
83
let list = [ 10, -1, 3, 9, 2, 27, 8, 5, 1, 3, 0, 26 ]
94
selectionSort(list)
105
selectionSort(list, <)

Selection Sort/SelectionSort.playground/Sources/SelectionSort.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// - Parameter array: array of elements that conform to the Comparable protocol
44
/// - Returns: an array in ascending order
55
public func selectionSort<T: Comparable>(_ array: [T]) -> [T] {
6-
return insertionSort(array, <)
6+
return selectionSort(array, <)
77
}
88

99
/// Performs the Selection sort algorithm on a array using the provided comparisson method

0 commit comments

Comments
 (0)