Skip to content

Commit b4429b9

Browse files
Wesley-Arringtonjiegillet
authored andcommitted
Adding main() for Swift sorting algorithms (#233)
- Changed bubble_sort.md so for swift it would show main() - Added main() to bogo sort
1 parent cec0735 commit b4429b9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

chapters/sorting_searching/bogo/code/swift/bogosort.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,10 @@ func bogoSort(sortArray: inout [Int]) -> [Int] {
3737

3838
return sortArray
3939
}
40+
41+
func main() {
42+
var testArray = [4,5,123,24,34,-5]
43+
print(bogoSort(sortArray: &testArray))
44+
}
45+
46+
main()

chapters/sorting_searching/bubble/bubble_sort.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ This means that we need to go through the vector $$\mathcal{O}(n^2)$$ times with
3535
{% sample lang="racket" %}
3636
[import:5-19, lang:"racket"](code/racket/bubbleSort.rkt)
3737
{% sample lang="swift" %}
38-
[import:1-15, lang:"swift"](code/swift/bubblesort.swift)
38+
[import, lang:"swift"](code/swift/bubblesort.swift)
3939
{% endmethod %}
4040

4141
... And that's it for the simplest bubble sort method.

0 commit comments

Comments
 (0)