Skip to content

Commit c54cf53

Browse files
committed
Clarify complexity of permutations(ofCount:)
1 parent 9872ec2 commit c54cf53

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/Algorithms/Permutations.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,9 @@ extension Collection {
301301
/// If `k` is `nil`, the resulting sequence represents permutations of this
302302
/// entire collection.
303303
///
304-
/// - Complexity: O(1)
304+
/// - Complexity: O(1) for random-access base collections. O(*n*) where *n*
305+
/// is the number of elements in the base collection, since `Permutations`
306+
/// accesses the `count` of the base collection.
305307
@inlinable
306308
public func permutations(ofCount k: Int? = nil) -> Permutations<Self> {
307309
assert(

0 commit comments

Comments
 (0)