Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
3
Task/JortSort/Swift/jortsort-1.swift
Normal file
3
Task/JortSort/Swift/jortsort-1.swift
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
func jortSort<T:Comparable>(array: [T]) -> Bool {
|
||||
return array == sorted(array)
|
||||
}
|
||||
13
Task/JortSort/Swift/jortsort-2.swift
Normal file
13
Task/JortSort/Swift/jortsort-2.swift
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
func jortSort<T:Comparable>(inout array: [T]) -> Bool {
|
||||
|
||||
// sort the array
|
||||
let originalArray = array
|
||||
array.sort({$0 < $1})
|
||||
|
||||
// compare to see if it was originally sorted
|
||||
for var i = 0; i < originalArray.count; ++i {
|
||||
if originalArray[i] != array[i] { return false }
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue