@@ -370,6 +370,20 @@ struct InsertionSortAlg <: Algorithm end
370370struct QuickSortAlg <: Algorithm end
371371struct MergeSortAlg <: Algorithm end
372372
373+ """
374+ PartialQuickSort{T <: Union{Int,OrdinalRange}}
375+
376+ Indicate that a sorting function should use the partial quick sort
377+ algorithm. Partial quick sort returns the smallest `k` elements sorted from smallest
378+ to largest, finding them and sorting them using [`QuickSort`](@ref).
379+
380+ Characteristics:
381+ * *not stable*: does not preserve the ordering of elements which
382+ compare equal (e.g. "a" and "A" in a sort of letters which
383+ ignores case).
384+ * *in-place* in memory.
385+ * *divide-and-conquer*: sort strategy similar to [`MergeSort`](@ref).
386+ """
373387struct PartialQuickSort{T <: Union{Int,OrdinalRange} } <: Algorithm
374388 k:: T
375389end
@@ -379,8 +393,54 @@ Base.last(a::PartialQuickSort{Int}) = a.k
379393Base. first (a:: PartialQuickSort ) = first (a. k)
380394Base. last (a:: PartialQuickSort ) = last (a. k)
381395
396+ """
397+ InsertionSort
398+
399+ Indicate that a sorting function should use the insertion sort
400+ algorithm. Insertion sort traverses the collection one element
401+ at a time, inserting each element into its correct, sorted position in
402+ the output list.
403+
404+ Characteristics:
405+ * *stable*: preserves the ordering of elements which
406+ compare equal (e.g. "a" and "A" in a sort of letters
407+ which ignores case).
408+ * *in-place* in memory.
409+ * *quadratic performance* in the number of elements to be sorted:
410+ it is well-suited to small collections but should not be used for large ones.
411+ """
382412const InsertionSort = InsertionSortAlg ()
413+ """
414+ QuickSort
415+
416+ Indicate that a sorting function should use the quick sort
417+ algorithm, which is *not* stable.
418+
419+ Characteristics:
420+ * *not stable*: does not preserve the ordering of elements which
421+ compare equal (e.g. "a" and "A" in a sort of letters which
422+ ignores case).
423+ * *in-place* in memory.
424+ * *divide-and-conquer*: sort strategy similar to [`MergeSort`](@ref).
425+ * *good performance* for large collections.
426+ """
383427const QuickSort = QuickSortAlg ()
428+ """
429+ MergeSort
430+
431+ Indicate that a sorting function should use the merge sort
432+ algorithm. Merge sort divides the collection into
433+ subcollections and repeatedly merges them, sorting each
434+ subcollection at each step, until the entire
435+ collection has been recombined in sorted form.
436+
437+ Characteristics:
438+ * *stable*: preserves the ordering of elements which compare
439+ equal (e.g. "a" and "A" in a sort of letters which ignores
440+ case).
441+ * *not in-place* in memory.
442+ * *divide-and-conquer* sort strategy.
443+ """
384444const MergeSort = MergeSortAlg ()
385445
386446const DEFAULT_UNSTABLE = QuickSort
0 commit comments