We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8159640 commit 07435adCopy full SHA for 07435ad
README.md
@@ -45,3 +45,25 @@ You are welcome to fork and submit pull requests.
45
## License
46
47
`SortAlgorithm` is open-sourced software, licensed under the `MIT` license.
48
+
49
+## Sample
50
51
+```swift
52
+// Randome Array
53
+let original = [Int].init(repeating: 0, count: 5000).map { 0ドル + Int(arc4random_uniform(5000)) }
54
+let closure: Array<Int>.SortingCompareClosure = { (l, r) -> Bool in
55
+ return l < r
56
+}
57
+// Now sort
58
+print("Bubble: \n\(original.bubbleSort(by: closure))")
59
+print("\n\n======\n\n")
60
+print("Insertion: \n\(original.insertionSort(by: closure))")
61
62
+print("Merge: \n\(original.mergeSort(by: closure))")
63
64
+print("Quick: \n\(original.quickSort(by: closure))")
65
66
+print("Counting: \n\(original.countingSort())")
67
68
+print("Heap: \n\(original.heapSort(by: closure))")
69
+```
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments