Skip to content

Commit c1c4cd5

Browse files
authored
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.
2 parents a552b5b + 85e4177 commit c1c4cd5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/iter/traits/iterator.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1849,6 +1849,12 @@ pub trait Iterator {
18491849
///
18501850
/// The relative order of partitioned items is not maintained.
18511851
///
1852+
/// # Current implementation
1853+
/// Current algorithms tries finding the first element for which the predicate evaluates
1854+
/// to false, and the last element for which it evaluates to true and repeatedly swaps them.
1855+
///
1856+
/// Time Complexity: *O*(*N*)
1857+
///
18521858
/// See also [`is_partitioned()`] and [`partition()`].
18531859
///
18541860
/// [`is_partitioned()`]: Iterator::is_partitioned

0 commit comments

Comments
 (0)