Skip to content

[4.2] [stdlib] Update complexity docs for seq/collection algorithms #18247

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

Conversation

natecook1000
Copy link
Member

This is a cherry-pick of #17254.

Explanation: This adds and standardizes complexity annotations for standard library sequence/collection algorithms.
Scope of Issue: Mostly constrained to documentation changes; also includes a renaming of the second parameter name in Collection.index(_:offsetBy:). This doesn't affect usage of the API, only the generated documentation.
Risk: Minimal.
Reviewer: Ben Cohen @airspeedswift
Testing: The standard test and validation suites
Radar: rdar://problem/42610773

…ang#17254)

* [stdlib] Update complexity docs for seq/collection algorithms

This corrects and standardizes the complexity documentation for Sequence
and Collection methods. The use of constants is more consistent, with `n`
equal to the length of the target collection, `m` equal to the length of
a collection passed in as a parameter, and `k` equal to any other passed
or calculated constant.

* Apply notes from @brentdax about complexity nomenclature

* Change `n` to `distance` in `index(_:offsetBy:)`

* Use equivalency language more places; sync across array types

* Use k instead of n for parameter names

* Slight changes to index(_:offsetBy:) discussion.

* Update tests with new parameter names
@natecook1000
Copy link
Member Author

@swift-ci Please test

@natecook1000
Copy link
Member Author

@swift-ci Please nominate

@airspeedswift airspeedswift merged commit 8e02cbc into swiftlang:swift-4.2-branch Jul 26, 2018
@natecook1000 natecook1000 deleted the nc-4.2-complexity branch July 26, 2018 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants