Rollup merge of #85315 - satylogin:master, r=yaahc

adding time complexity for partition_in_place iter method

I feel that one thing missing from rust docs compared to cpp references is existence of time complexity for all methods and functions. While it would be humongous task to include it for everything in single go, it is still doable if we as community keep on adding it in relevant places as and when we find them.

This PR adds the time complexity for partition_in_place method in iter.
This commit is contained in:
Ralf Jung 2021-05-20 00:19:02 +02:00 committed by GitHub
commit c1c4cd57b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1849,6 +1849,12 @@ pub trait Iterator {
///
/// The relative order of partitioned items is not maintained.
///
/// # Current implementation
/// Current algorithms tries finding the first element for which the predicate evaluates
/// to false, and the last element for which it evaluates to true and repeatedly swaps them.
///
/// Time Complexity: *O*(*N*)
///
/// See also [`is_partitioned()`] and [`partition()`].
///
/// [`is_partitioned()`]: Iterator::is_partitioned