Skip to content

Commit

Permalink
[Swift 4.2] Updated Selection Sort
Browse files Browse the repository at this point in the history
  • Loading branch information
heyrahulrs committed Oct 23, 2018
1 parent a31bd41 commit 0f08fa9
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 6 deletions.
5 changes: 0 additions & 5 deletions Selection Sort/SelectionSort.playground/Contents.swift
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
//: Playground - noun: a place where people can play

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

let list = [ 10, -1, 3, 9, 2, 27, 8, 5, 1, 3, 0, 26 ]
selectionSort(list)
selectionSort(list, <)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/// - Parameter array: array of elements that conform to the Comparable protocol
/// - Returns: an array in ascending order
public func selectionSort<T: Comparable>(_ array: [T]) -> [T] {
return insertionSort(array, <)
return selectionSort(array, <)
}

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

0 comments on commit 0f08fa9

Please sign in to comment.