From 0f08fa9ddb315a55cca92d1fbabecb48a406cee8 Mon Sep 17 00:00:00 2001 From: Rahul Date: Tue, 23 Oct 2018 19:02:39 +0530 Subject: [PATCH] [Swift 4.2] Updated Selection Sort --- Selection Sort/SelectionSort.playground/Contents.swift | 5 ----- .../SelectionSort.playground/Sources/SelectionSort.swift | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Selection Sort/SelectionSort.playground/Contents.swift b/Selection Sort/SelectionSort.playground/Contents.swift index b16dadb8d..a552c9edb 100644 --- a/Selection Sort/SelectionSort.playground/Contents.swift +++ b/Selection Sort/SelectionSort.playground/Contents.swift @@ -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, <) diff --git a/Selection Sort/SelectionSort.playground/Sources/SelectionSort.swift b/Selection Sort/SelectionSort.playground/Sources/SelectionSort.swift index e7c66481d..e157319b4 100644 --- a/Selection Sort/SelectionSort.playground/Sources/SelectionSort.swift +++ b/Selection Sort/SelectionSort.playground/Sources/SelectionSort.swift @@ -3,7 +3,7 @@ /// - Parameter array: array of elements that conform to the Comparable protocol /// - Returns: an array in ascending order public func selectionSort(_ array: [T]) -> [T] { - return insertionSort(array, <) + return selectionSort(array, <) } /// Performs the Selection sort algorithm on a array using the provided comparisson method