Skip to content

[stdlib] Document stable sort guarantee #60936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions stdlib/public/core/Sort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ extension Sequence where Element: Comparable {
/// print(descendingStudents)
/// // Prints "["Peter", "Kweku", "Kofi", "Akosua", "Abena"]"
///
/// The sorting algorithm is not guaranteed to be stable. A stable sort
/// preserves the relative order of elements that compare equal.
/// The sorting algorithm is guaranteed to be stable. A stable sort
/// preserves the relative order of elements that compare as equal.
///
/// - Returns: A sorted array of the sequence's elements.
///
Expand Down Expand Up @@ -117,7 +117,7 @@ extension Sequence {
/// and `c` are incomparable, then `a` and `c` are also incomparable.
/// (Transitive incomparability)
///
/// The sorting algorithm is not guaranteed to be stable. A stable sort
/// The sorting algorithm is guaranteed to be stable. A stable sort
/// preserves the relative order of elements for which
/// `areInIncreasingOrder` does not establish an order.
///
Expand Down Expand Up @@ -162,8 +162,8 @@ where Self: RandomAccessCollection, Element: Comparable {
/// print(students)
/// // Prints "["Peter", "Kweku", "Kofi", "Akosua", "Abena"]"
///
/// The sorting algorithm is not guaranteed to be stable. A stable sort
/// preserves the relative order of elements that compare equal.
/// The sorting algorithm is guaranteed to be stable. A stable sort
/// preserves the relative order of elements that compare as equal.
///
/// - Complexity: O(*n* log *n*), where *n* is the length of the collection.
@inlinable
Expand Down Expand Up @@ -231,7 +231,7 @@ extension MutableCollection where Self: RandomAccessCollection {
/// and `c` are incomparable, then `a` and `c` are also incomparable.
/// (Transitive incomparability)
///
/// The sorting algorithm is not guaranteed to be stable. A stable sort
/// The sorting algorithm is guaranteed to be stable. A stable sort
/// preserves the relative order of elements for which
/// `areInIncreasingOrder` does not establish an order.
///
Expand Down