diff --git a/docs/release-notes/.FSharp.Core/10.0.200.md b/docs/release-notes/.FSharp.Core/10.0.200.md
index 729add7c4be..64590620bad 100644
--- a/docs/release-notes/.FSharp.Core/10.0.200.md
+++ b/docs/release-notes/.FSharp.Core/10.0.200.md
@@ -5,4 +5,5 @@
### Changed
* Added `not null` constraints to `IDelegateEvent<'Delegate>`, `IEvent<'Delegate,'Args>`, `DelegateEvent<'Delegate>`, and `Event<'Delegate,'Args>` types to prevent spurious nullness warnings when implementing CLIEvent properties. ([Issue #18361](https://github.com/dotnet/fsharp/issues/18361), [Issue #18349](https://github.com/dotnet/fsharp/issues/18349), [PR #19221](https://github.com/dotnet/fsharp/pull/19221))
-* Renamed deprecated `or` and `&` operators, but keeping the original compiled names for binary compatibility. ([PR #19143](https://github.com/dotnet/fsharp/pull/19143))
\ No newline at end of file
+* Renamed deprecated `or` and `&` operators, but keeping the original compiled names for binary compatibility. ([PR #19143](https://github.com/dotnet/fsharp/pull/19143))
+* Added complexity documentation (Big-O notation) to all 462 functions across Array, List, Seq, Map, and Set collection modules. ([PR #19240](https://github.com/dotnet/fsharp/pull/19240))
\ No newline at end of file
diff --git a/src/FSharp.Core/array.fsi b/src/FSharp.Core/array.fsi
index 65def57f048..9db69d8eb89 100644
--- a/src/FSharp.Core/array.fsi
+++ b/src/FSharp.Core/array.fsi
@@ -33,6 +33,8 @@ module Array =
/// [| (1, 3); (1, 4); (2, 3); (2, 4) |]
///
///
+ ///
+ /// This is an O(n*m) operation, where n and m are the lengths of the arrays.
[]
val allPairs: array1: 'T1 array -> array2: 'T2 array -> ('T1 * 'T2) array
@@ -51,6 +53,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 3; 4 |].
///
+ ///
+ /// This is an O(n+m) operation, where n and m are the lengths of the arrays.
[]
val append: array1: 'T array -> array2: 'T array -> 'T array
@@ -76,6 +80,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline average:
array: ^T array -> ^T
@@ -115,6 +121,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline averageBy:
projection: ('T -> ^U) -> array: 'T array -> ^U
@@ -137,7 +145,7 @@ module Array =
/// let target = [| 0; 1; 2; 3; 4; 5 |]
/// target[3..4] <- source[1..2]
///
- ///
+ /// This is an O(count) operation.
///
/// Thrown when either of the input arrays is null.
/// Thrown when any of sourceIndex, targetIndex or count are negative,
@@ -183,6 +191,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 3; 4 |]
///
+ ///
+ /// This is an O(n) operation, where n is the total output length.
[]
val collect: mapping: ('T -> 'U array) -> array: 'T array -> 'U array
@@ -266,6 +276,8 @@ module Array =
///
/// Evaluates to -1
///
+ ///
+ /// This is an O(min(n,m)) operation, where n and m are the lengths of the arrays.
[]
val inline compareWith: comparer: ('T -> 'T -> int) -> array1: 'T array -> array2: 'T array -> int
@@ -285,6 +297,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 3; 4; 5 |]
///
+ ///
+ /// This is an O(n) operation, where n is the total number of elements across all arrays.
[]
val concat: arrays: seq<'T array> -> 'T array
@@ -303,6 +317,8 @@ module Array =
/// [| 1; 2 |] |> Array.contains 5 // evaluates to false
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline contains: value: 'T -> array: 'T array -> bool when 'T: equality
@@ -322,6 +338,8 @@ module Array =
///
/// Evaluates to a new array containing[| 12; 13; 14 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val copy: array: 'T array -> 'T array
@@ -346,6 +364,8 @@ module Array =
///
/// Evaluates to [| ("a", 2); ("b", 1) |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val countBy: projection: ('T -> 'Key) -> array: 'T array -> ('Key * int) array when 'Key: equality
@@ -376,6 +396,8 @@ module Array =
/// After evaluation of the last line array contains[| { contents = "b"}; { contents = "b"} |].
/// Note each entry in the array is the same mutable cell object.
///
+ ///
+ /// This is an O(n) operation, where n is the count.
[]
val create: count: int -> value: 'T -> 'T array
@@ -405,6 +427,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(1) operation.
[]
val tryHead: array: 'T array -> 'T option
@@ -437,6 +461,8 @@ module Array =
/// Evaluates to None.
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryPick: chooser: ('T -> 'U option) -> array: 'T array -> 'U option
@@ -458,6 +484,8 @@ module Array =
///
/// After evaluation target contains [| 0; 1; 2; 100; 100; 5 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val fill: target: 'T array -> targetIndex: int -> count: int -> value: 'T -> unit
@@ -492,6 +520,8 @@ module Array =
/// Throws KeyNotFoundException.
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val pick: chooser: ('T -> 'U option) -> array: 'T array -> 'U
@@ -523,6 +553,8 @@ module Array =
///
/// Evaluates to [| 2 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val choose: chooser: ('T -> 'U option) -> array: 'T array -> 'U array
@@ -553,6 +585,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val chunkBySize: chunkSize: int -> array: 'T array -> 'T array array
@@ -574,6 +608,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 3 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val distinct: array: 'T array -> 'T array when 'T: equality
@@ -596,6 +632,8 @@ module Array =
///
/// Evaluates to [| { Bar = 1 }; { Bar = 2 }; { Bar = 3 } |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val distinctBy: projection: ('T -> 'Key) -> array: 'T array -> 'T array when 'Key: equality
@@ -626,6 +664,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val splitInto: count: int -> array: 'T array -> 'T array array
@@ -637,6 +677,8 @@ module Array =
/// Array.empty // Evaluates to [| |]
///
///
+ ///
+ /// This is an O(1) operation.
[]
[]
val empty<'T> : 'T array
@@ -676,6 +718,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(1) operation.
[]
val exactlyOne: array: 'T array -> 'T
@@ -713,6 +757,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(1) operation.
[]
val tryExactlyOne: array: 'T array -> 'T option
@@ -736,6 +782,8 @@ module Array =
///
/// Evaluates to [| 2; 4 |]
///
+ ///
+ /// This is an O(n+m) operation using hash-based exclusion.
[]
val except: itemsToExclude: seq<'T> -> array: 'T array -> 'T array when 'T: equality
@@ -743,7 +791,7 @@ module Array =
///
/// The predicate is applied to the elements of the input array. If any application
/// returns true then the overall result is true and no further elements are tested.
- /// Otherwise, false is returned.
+ /// Otherwise, false is returned. This is an O(n) operation in the worst case, where n is the length of the array.
///
/// The function to test the input elements.
/// The input array.
@@ -778,7 +826,7 @@ module Array =
/// two lengths of the collections. If any application returns true then the overall result is
/// true and no further elements are tested. Otherwise, if one collections is longer
/// than the other then the ArgumentException exception is raised.
- /// Otherwise, false is returned.
+ /// Otherwise, false is returned. This is an O(n) operation in the worst case, where n is the length of the arrays.
///
/// The function to test the input elements.
/// The first input array.
@@ -829,6 +877,8 @@ module Array =
///
/// Evaluates to [| 2; 4 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val filter: predicate: ('T -> bool) -> array: 'T array -> 'T array
@@ -861,6 +911,8 @@ module Array =
///
/// Throws KeyNotFoundException
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val find: predicate: ('T -> bool) -> array: 'T array -> 'T
@@ -893,6 +945,8 @@ module Array =
///
/// Throws KeyNotFoundException
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val findBack: predicate: ('T -> bool) -> array: 'T array -> 'T
@@ -925,6 +979,8 @@ module Array =
///
/// Throws KeyNotFoundException
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val findIndex: predicate: ('T -> bool) -> array: 'T array -> int
@@ -958,6 +1014,8 @@ module Array =
///
/// Throws KeyNotFoundException
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val findIndexBack: predicate: ('T -> bool) -> array: 'T array -> int
@@ -965,7 +1023,7 @@ module Array =
///
/// The predicate is applied to the elements of the input collection. If any application
/// returns false then the overall result is false and no further elements are tested.
- /// Otherwise, true is returned.
+ /// Otherwise, true is returned. This is an O(n) operation in the worst case, where n is the length of the array.
///
/// The function to test the input elements.
/// The input array.
@@ -992,7 +1050,7 @@ module Array =
/// two lengths of the collections. If any application returns false then the overall result is
/// false and no further elements are tested. Otherwise, if one collection is longer
/// than the other then the ArgumentException exception is raised.
- /// Otherwise, true is returned.
+ /// Otherwise, true is returned. This is an O(n) operation in the worst case, where n is the length of the arrays.
///
/// The function to test the input elements.
/// The first input array.
@@ -1062,6 +1120,8 @@ module Array =
///
/// Evaluates to 2
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val fold<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> array: 'T array -> 'State
@@ -1105,6 +1165,8 @@ module Array =
/// Text = " 3 -2 -1 0 1" }
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val foldBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> array: 'T array -> state: 'State -> 'State
@@ -1139,6 +1201,8 @@ module Array =
///
/// Evaluates to 1
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val fold2<'T1, 'T2, 'State> :
folder: ('State -> 'T1 -> 'T2 -> 'State) -> state: 'State -> array1: 'T1 array -> array2: 'T2 array -> 'State
@@ -1188,6 +1252,8 @@ module Array =
/// Text = "(-3,1) (-2,2) (-1,3) " }
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val foldBack2<'T1, 'T2, 'State> :
folder: ('T1 -> 'T2 -> 'State -> 'State) -> array1: 'T1 array -> array2: 'T2 array -> state: 'State -> 'State
@@ -1197,7 +1263,7 @@ module Array =
/// The input array.
/// The input index.
///
- /// Normally the syntax array[index] is preferred.
+ /// Normally the syntax array[index] is preferred. This is an O(1) operation.
///
/// The value of the array at the given index.
///
@@ -1248,6 +1314,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(1) operation.
[]
val head: array: 'T array -> 'T
@@ -1270,6 +1338,8 @@ module Array =
///
/// Evaluates to [| (1, [| 1; 3; 5 |]); (0, [| 2; 4 |]) |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val groupBy: projection: ('T -> 'Key) -> array: 'T array -> ('Key * 'T array) array when 'Key: equality
@@ -1290,6 +1360,8 @@ module Array =
///
/// Evaluates to [| (0, "a"); (1, "b"); (2, "c") |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val indexed: array: 'T array -> (int * 'T) array
@@ -1315,6 +1387,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the count.
[]
val inline init: count: int -> initializer: (int -> 'T) -> 'T array
@@ -1332,6 +1406,8 @@ module Array =
///
/// Evaluates to [| 0; 0; 0; 0 |]
///
+ ///
+ /// This is an O(n) operation, where n is the count.
[]
val zeroCreate: count: int -> 'T array
@@ -1356,6 +1432,8 @@ module Array =
///
/// Evaluates to false
///
+ ///
+ /// This is an O(1) operation.
[]
val isEmpty: array: 'T array -> bool
@@ -1380,6 +1458,8 @@ module Array =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline iter: action: ('T -> unit) -> array: 'T array -> unit
@@ -1409,6 +1489,8 @@ module Array =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val iter2: action: ('T1 -> 'T2 -> unit) -> array1: 'T1 array -> array2: 'T2 array -> unit
@@ -1434,6 +1516,8 @@ module Array =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val iteri: action: (int -> 'T -> unit) -> array: 'T array -> unit
@@ -1463,6 +1547,8 @@ module Array =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val iteri2: action: (int -> 'T1 -> 'T2 -> unit) -> array1: 'T1 array -> array2: 'T2 array -> unit
@@ -1488,6 +1574,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(1) operation.
[]
val inline last: array: 'T array -> 'T
@@ -1498,7 +1586,7 @@ module Array =
///
/// The value of the array at the given index.
///
- /// Normally the syntax array[index] is preferred.
+ /// Normally the syntax array[index] is preferred. This is an O(1) operation.
///
/// Thrown when the input array is null.
/// Thrown when the index is negative or the input array does not contain enough elements.
@@ -1529,7 +1617,7 @@ module Array =
///
/// The length of the array.
///
- /// The notation array.Length is preferred.
+ /// The notation array.Length is preferred. This is an O(1) operation.
///
/// Thrown when the input array is null.
///
@@ -1566,6 +1654,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(1) operation.
[]
val tryLast: array: 'T array -> 'T option
@@ -1587,6 +1677,8 @@ module Array =
///
/// Evaluates to [| 1; 3; 2 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline map: mapping: ('T -> 'U) -> array: 'T array -> 'U array
@@ -1613,6 +1705,8 @@ module Array =
///
/// Evaluates to [| 'a'; 'd'; 'o' |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val map2: mapping: ('T1 -> 'T2 -> 'U) -> array1: 'T1 array -> array2: 'T2 array -> 'U array
@@ -1643,6 +1737,8 @@ module Array =
///
/// Evaluates newCharges to [|In 2; Out 4; In 6|] and balance to 2.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val mapFold<'T, 'State, 'Result> :
mapping: ('State -> 'T -> 'Result * 'State) -> state: 'State -> array: 'T array -> 'Result array * 'State
@@ -1674,6 +1770,8 @@ module Array =
///
/// Evaluates newCharges to [|In 2; Out 4; In 6|] and balance to 2.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val mapFoldBack<'T, 'State, 'Result> :
mapping: ('T -> 'State -> 'Result * 'State) -> array: 'T array -> state: 'State -> 'Result array * 'State
@@ -1704,6 +1802,8 @@ module Array =
/// Evaluates to [| "all"; "the"; "time" |]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val map3:
mapping: ('T1 -> 'T2 -> 'T3 -> 'U) -> array1: 'T1 array -> array2: 'T2 array -> array3: 'T3 array -> 'U array
@@ -1731,6 +1831,8 @@ module Array =
///
/// Evaluates to [|(0, 'a'); (1, 'd'); (2, 'o')|]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val mapi2: mapping: (int -> 'T1 -> 'T2 -> 'U) -> array1: 'T1 array -> array2: 'T2 array -> 'U array
@@ -1753,12 +1855,14 @@ module Array =
///
/// Evaluates to [| 10; 11; 12 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val mapi: mapping: (int -> 'T -> 'U) -> array: 'T array -> 'U array
/// Returns the greatest of all elements of the array, compared via Operators.max on the function result.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -1789,7 +1893,7 @@ module Array =
/// Returns the greatest of all elements of the array, compared via Operators.max on the function result.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The function to transform the elements into a type supporting comparison.
/// The input array.
@@ -1821,7 +1925,7 @@ module Array =
/// Returns the lowest of all elements of the array, compared via Operators.min.
///
- /// Throws ArgumentException for empty arrays
+ /// Throws ArgumentException for empty arrays This is an O(n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -1852,7 +1956,7 @@ module Array =
/// Returns the lowest of all elements of the array, compared via Operators.min on the function result.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The function to transform the elements into a type supporting comparison.
/// The input array.
@@ -1896,6 +2000,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 5 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val ofList: list: 'T list -> 'T array
@@ -1915,6 +2021,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 5 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the sequence.
[]
val ofSeq: source: seq<'T> -> 'T array
@@ -1936,6 +2044,8 @@ module Array =
///
/// Evaluates to [|(1, 2); (2, 3); (3, 4)|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val pairwise: array: 'T array -> ('T * 'T) array
@@ -1959,6 +2069,8 @@ module Array =
///
/// Evaluates to ([|2; 4|], [|1; 3|]).
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val partition: predicate: ('T -> bool) -> array: 'T array -> 'T array * 'T array
@@ -1981,6 +2093,8 @@ module Array =
///
/// Evaluates to [|4; 1; 2; 3|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val permute: indexMap: (int -> int) -> array: 'T array -> 'T array
@@ -2005,6 +2119,8 @@ module Array =
///
/// Evaluates to 1342, by computing ((1 * 10 + 3) * 10 + 4) * 10 + 2
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val reduce: reduction: ('T -> 'T -> 'T) -> array: 'T array -> 'T
@@ -2029,6 +2145,8 @@ module Array =
///
/// Evaluates to 2431, by computing 1 + (3 + (4 + 2 * 10) * 10) * 10
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val reduceBack: reduction: ('T -> 'T -> 'T) -> array: 'T array -> 'T
@@ -2047,6 +2165,8 @@ module Array =
///
/// Evaluates to [| "a"; "a"; "a" |].
///
+ ///
+ /// This is an O(n) operation, where n is the count.
[]
val replicate: count: int -> initial: 'T -> 'T array
@@ -2064,6 +2184,8 @@ module Array =
///
/// Evaluates to [| 2; 1; 0 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val rev: array: 'T array -> 'T array
@@ -2093,6 +2215,8 @@ module Array =
/// Evaluates to [|0; 1; -1; 2|]. Note 0 is the initial
/// state, 1 the next state, -1 the next state, and 2 the final state.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val scan<'T, 'State> : folder: ('State -> 'T -> 'State) -> state: 'State -> array: 'T array -> 'State array
@@ -2122,6 +2246,8 @@ module Array =
/// Evaluates to [|2; 1; 3; 0|] by processing each input from back to front. Note 0 is the initial
/// state, 3 the next state, 1 the next state, and 2 the final state.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val scanBack<'T, 'State> : folder: ('T -> 'State -> 'State) -> array: 'T array -> state: 'State -> 'State array
@@ -2137,6 +2263,8 @@ module Array =
///
/// Evaluates to [| 7 |].
///
+ ///
+ /// This is an O(1) operation.
[]
val inline singleton: value: 'T -> 'T array
@@ -2166,6 +2294,8 @@ module Array =
///
/// Throws IndexOutOfRangeException
///
+ ///
+ /// This is an O(1) operation.
[]
val set: array: 'T array -> index: int -> value: 'T -> unit
@@ -2206,6 +2336,8 @@ module Array =
///
/// Evaluates to [| "a"; "b"; "c"; "d" |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val skip: count: int -> array: 'T array -> 'T array
@@ -2228,6 +2360,8 @@ module Array =
/// Evaluates to [|"bbb"; "cc"; "d"|]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val skipWhile: predicate: ('T -> bool) -> array: 'T array -> 'T array
@@ -2251,7 +2385,7 @@ module Array =
///
/// input.[2..4]
///
- ///
+ /// This is an O(count) operation.
///
///
///
@@ -2267,7 +2401,7 @@ module Array =
/// Sorts the elements of an array, returning a new array. Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -2290,7 +2424,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -2313,7 +2447,7 @@ module Array =
/// Sorts the elements of an array, using the given comparison function as the order, returning a new array.
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to compare pairs of array elements.
/// The input array.
@@ -2342,7 +2476,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, modifying the array in place.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -2380,6 +2514,8 @@ module Array =
///
/// After evaluation array contains [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|].
///
+ ///
+ /// This is an O(n log n) operation, modifying the array in place.
[]
val sortInPlaceWith: comparer: ('T -> 'T -> int) -> array: 'T array -> unit
@@ -2398,6 +2534,8 @@ module Array =
///
/// After evaluation array contains [| 1; 1; 3; 4; 6; 8 |].
///
+ ///
+ /// This is an O(n log n) operation, modifying the array in place.
[]
val sortInPlace: array: 'T array -> unit when 'T: comparison
@@ -2420,13 +2558,15 @@ module Array =
///
/// Evaluates front to [|8; 4; 3|] and back to [|1; 6; 1|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val splitAt: index: int -> array: 'T array -> ('T array * 'T array)
/// Sorts the elements of an array, in descending order, returning a new array. Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -2447,7 +2587,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -2481,6 +2621,8 @@ module Array =
///
/// Evaluates to 11.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline sum: array: ^T array -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member Zero: ^T)
@@ -2501,6 +2643,8 @@ module Array =
///
/// Evaluates to 7.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline sumBy:
projection: ('T -> ^U) -> array: 'T array -> ^U
@@ -2509,7 +2653,7 @@ module Array =
/// Returns the first N elements of the array.
/// Throws InvalidOperationException
/// if the count exceeds the number of elements in the array. Array.truncate
- /// returns as many items as the array contains instead of throwing an exception.
+ /// returns as many items as the array contains instead of throwing an exception. This is an O(count) operation.
///
/// The number of items to take.
/// The input array.
@@ -2569,6 +2713,8 @@ module Array =
/// Evaluates to [| "a"; "bb" |]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val takeWhile: predicate: ('T -> bool) -> array: 'T array -> 'T array
@@ -2590,6 +2736,8 @@ module Array =
/// Evaluates to [| "bb"; "ccc" |]
///
///
+ ///
+ /// This is an O(n) operation, creating a new array.
[]
val tail: array: 'T array -> 'T array
@@ -2609,6 +2757,8 @@ module Array =
///
/// Evaluates to [ 1; 2; 5 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val toList: array: 'T array -> 'T list
@@ -2628,6 +2778,8 @@ module Array =
///
/// Evaluates to seq { 1; 2; 5 }.
///
+ ///
+ /// This is an O(1) operation.
[]
val toSeq: array: 'T array -> seq<'T>
@@ -2650,6 +2802,8 @@ module Array =
///
/// Evaluates to [|[|10; 11|]; [|20; 21|]; [|30; 31|]|].
///
+ ///
+ /// This is an O(n*m) operation, where n and m are the dimensions.
[]
val transpose: arrays: seq<'T array> -> 'T array array
@@ -2688,6 +2842,8 @@ module Array =
///
/// Evaluates to [| |].
///
+ ///
+ /// This is an O(count) operation.
[]
val truncate: count: int -> array: 'T array -> 'T array
@@ -2718,6 +2874,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFind: predicate: ('T -> bool) -> array: 'T array -> 'T option
@@ -2748,6 +2906,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFindBack: predicate: ('T -> bool) -> array: 'T array -> 'T option
@@ -2778,6 +2938,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFindIndex: predicate: ('T -> bool) -> array: 'T array -> int option
@@ -2808,6 +2970,8 @@ module Array =
///
/// Evaluates to None.
///
+ ///
+ /// This is an O(1) operation.
[]
val tryItem: index: int -> array: 'T array -> 'T option
@@ -2838,6 +3002,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFindIndexBack: predicate: ('T -> bool) -> array: 'T array -> int option
@@ -2857,6 +3023,8 @@ module Array =
///
/// Evaluates to [| 1; 2; 4; 8; 16; 32; 64 |]
///
+ ///
+ /// This is an O(n) operation, where n is the number of elements generated.
[]
val unfold<'T, 'State> : generator: ('State -> ('T * 'State) option) -> state: 'State -> 'T array
@@ -2876,6 +3044,8 @@ module Array =
///
/// Evaluates numbers to [|1; 2|] and names to [|"one"; "two"|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val unzip: array: ('T1 * 'T2) array -> ('T1 array * 'T2 array)
@@ -2895,6 +3065,8 @@ module Array =
///
/// Evaluates numbers to [|1; 2|], names to [|"one"; "two"|] and roman to [|"I"; "II"|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val unzip3: array: ('T1 * 'T2 * 'T3) array -> ('T1 array * 'T2 array * 'T3 array)
@@ -2908,7 +3080,7 @@ module Array =
///
/// Thrown when the input array is null.
///
- /// This is identical to Array.filter.
+ /// This is identical to Array.filter. This is an O(n) operation, where n is the length of the array.
///
/// Select only the even numbers:
///
@@ -2940,6 +3112,8 @@ module Array =
///
/// Evaluates to [|[|1; 2; 3|]; [|2; 3; 4|]; [|3; 4; 5|]|]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val windowed: windowSize: int -> array: 'T array -> 'T array array
@@ -2963,6 +3137,8 @@ module Array =
///
/// Evaluates to [| (1, "one"); (2, "two") |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val zip: array1: 'T1 array -> array2: 'T2 array -> ('T1 * 'T2) array
@@ -2988,6 +3164,8 @@ module Array =
///
/// Evaluates to [|(1, "one", "I"); (2, "two", "II")|].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val zip3: array1: 'T1 array -> array2: 'T2 array -> array3: 'T3 array -> ('T1 * 'T2 * 'T3) array
@@ -3008,6 +3186,8 @@ module Array =
///
/// Evaluates to [| 0; 2 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val removeAt: index: int -> source: 'T array -> 'T array
@@ -3029,6 +3209,8 @@ module Array =
///
/// Evaluates to [| 0; 3 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val removeManyAt: index: int -> count: int -> source: 'T array -> 'T array
@@ -3050,6 +3232,8 @@ module Array =
///
/// Evaluates to [| 0; 9; 2 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val updateAt: index: int -> value: 'T -> source: 'T array -> 'T array
@@ -3071,6 +3255,8 @@ module Array =
///
/// Evaluates to [| 0; 9; 1; 2 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val insertAt: index: int -> value: 'T -> source: 'T array -> 'T array
@@ -3092,6 +3278,8 @@ module Array =
///
/// Evaluates to [| 0; 8; 9; 1; 2 |].
///
+ ///
+ /// This is an O(n+m) operation, where n is the length of the array and m is the number of elements to insert.
[]
val insertManyAt: index: int -> values: seq<'T> -> source: 'T array -> 'T array
@@ -3111,6 +3299,8 @@ module Array =
///
/// Can evaluate to [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffle: source: 'T array -> 'T array
@@ -3132,6 +3322,8 @@ module Array =
///
/// Can evaluate to [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffleWith: random: Random -> source: 'T array -> 'T array
@@ -3153,6 +3345,8 @@ module Array =
///
/// Can evaluate to [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffleBy: randomizer: (unit -> float) -> source: 'T array -> 'T array
@@ -3170,6 +3364,8 @@ module Array =
///
/// After evaluation array can contain [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffleInPlace: source: 'T array -> unit
@@ -3188,6 +3384,8 @@ module Array =
///
/// After evaluation array can contain [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffleInPlaceWith: random: Random -> source: 'T array -> unit
@@ -3207,6 +3405,8 @@ module Array =
///
/// After evaluation array can contain [| 0; 2; 4; 3; 1 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val randomShuffleInPlaceBy: randomizer: (unit -> float) -> source: 'T array -> unit
@@ -3227,6 +3427,8 @@ module Array =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(1) operation.
[]
val randomChoice: source: 'T array -> 'T
@@ -3249,6 +3451,8 @@ module Array =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(1) operation.
[]
val randomChoiceWith: random: Random -> source: 'T array -> 'T
@@ -3271,6 +3475,8 @@ module Array =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(1) operation.
[]
val randomChoiceBy: randomizer: (unit -> float) -> source: 'T array -> 'T
@@ -3293,6 +3499,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 3 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomChoices: count: int -> source: 'T array -> 'T array
@@ -3317,6 +3525,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 3 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomChoicesWith: random: Random -> count: int -> source: 'T array -> 'T array
@@ -3341,6 +3551,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 3 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomChoicesBy: randomizer: (unit -> float) -> count: int -> source: 'T array -> 'T array
@@ -3364,6 +3576,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 2 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomSample: count: int -> source: 'T array -> 'T array
@@ -3389,6 +3603,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 2 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomSampleWith: random: Random -> count: int -> source: 'T array -> 'T array
@@ -3414,6 +3630,8 @@ module Array =
///
/// Can evaluate to [| 3; 1; 2 |].
///
+ ///
+ /// This is an O(count) operation.
[]
val randomSampleBy: randomizer: (unit -> float) -> count: int -> source: 'T array -> 'T array
@@ -3424,7 +3642,7 @@ module Array =
///
/// The predicate is applied to the elements of the input collection in parallel. If any application
/// returns false then the overall result is false and testing of other elements in all threads is stopped at system's earliest convenience.
- /// Otherwise, true is returned.
+ /// Otherwise, true is returned. This is an O(n) operation in the worst case, where n is the length of the array.
///
/// The function to test the input elements.
/// The input array.
@@ -3449,7 +3667,7 @@ module Array =
///
/// The predicate is applied to the elements of the input array in parallel. If any application
/// returns true then the overall result is true and testing of other elements in all threads is stopped at system's earliest convenience.
- /// Otherwise, false is returned.
+ /// Otherwise, false is returned. This is an O(n) operation in the worst case, where n is the length of the array.
///
/// The function to test the input elements.
/// The input array.
@@ -3505,6 +3723,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFind: predicate: ('T -> bool) -> array: 'T array -> 'T option
@@ -3535,6 +3755,8 @@ module Array =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryFindIndex: predicate: ('T -> bool) -> array: 'T array -> int option
@@ -3567,6 +3789,8 @@ module Array =
/// Evaluates to None.
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the array.
[]
val tryPick: chooser: ('T -> 'U option) -> array: 'T array -> 'U option
@@ -3575,7 +3799,7 @@ module Array =
/// Raises ArgumentException if the array is empty.
/// The order of processing is not guaranteed. For that reason, the 'reduce' function argument should be commutative.
/// (That is, changing the order of execution must not affect the result)
- /// Also, compared to the non-parallel version of Array.reduce, the 'reduce' function may be invoked more times due to the resulting reduction from participating threads.
+ /// Also, compared to the non-parallel version of Array.reduce, the 'reduce' function may be invoked more times due to the resulting reduction from participating threads. This is an O(n) operation, where n is the length of the array.
///
/// The function to reduce a pair of elements to a single element.
/// The input array.
@@ -3601,7 +3825,7 @@ module Array =
/// After processing entire input, results from all threads are reduced together.
/// Raises ArgumentException if the array is empty.
/// The order of processing is not guaranteed. For that reason, the 'reduction' function argument should be commutative.
- /// (That is, changing the order of execution must not affect the result)
+ /// (That is, changing the order of execution must not affect the result) This is an O(n) operation, where n is the length of the array.
///
/// The function to project from elements of the input array
/// The function to reduce a pair of projected elements to a single element.
@@ -3620,13 +3844,12 @@ module Array =
///
/// Evaluates to 1 + 3 + 4 + 2. However, the system could have decided to compute (1+3) and (4+2) first, and then put them together.
///
-
[]
val reduceBy: projection: ('T -> 'U) -> reduction: ('U -> 'U -> 'U) -> array: 'T array -> 'U
/// Returns the greatest of all elements of the array, compared via Operators.max.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -3657,7 +3880,7 @@ module Array =
/// Returns the greatest of all elements of the array, compared via Operators.max on the function result.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The function to transform the elements into a type supporting comparison.
/// The input array.
@@ -3689,7 +3912,7 @@ module Array =
/// Returns the smallest of all elements of the array, compared via Operators.min.
///
- /// Throws ArgumentException for empty arrays
+ /// Throws ArgumentException for empty arrays This is an O(n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -3720,7 +3943,7 @@ module Array =
/// Returns the lowest of all elements of the array, compared via Operators.min on the function result.
///
- /// Throws ArgumentException for empty arrays.
+ /// Throws ArgumentException for empty arrays. This is an O(n) operation, where n is the length of the array.
///
/// The function to transform the elements into a type supporting comparison.
/// The input array.
@@ -3766,6 +3989,8 @@ module Array =
///
/// Evaluates to 11.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline sum:
array: ^T array -> ^T when ^T: (static member (+): ^T * ^T -> ^T) and ^T: (static member Zero: ^T)
@@ -3787,6 +4012,8 @@ module Array =
///
/// Evaluates to 7.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline sumBy:
projection: ('T -> ^U) -> array: 'T array -> ^U
@@ -3814,6 +4041,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline average:
array: ^T array -> ^T
@@ -3851,6 +4080,8 @@ module Array =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val inline averageBy:
projection: ('T -> ^U) -> array: 'T array -> ^U
@@ -3861,7 +4092,7 @@ module Array =
/// the function returns Some(x).
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the length of the array.
///
/// The function to generate options from the elements.
/// The input array.
@@ -3893,7 +4124,7 @@ module Array =
/// For each element of the array, apply the given function. Concatenate all the results and return the combined array.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the total output length.
///
///
/// The input array.
@@ -3928,7 +4159,7 @@ module Array =
/// to each of the elements of the array.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the length of the array.
///
///
/// The input array.
@@ -3953,7 +4184,7 @@ module Array =
/// function indicates the index of element being transformed.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the length of the array.
///
///
/// The input array.
@@ -3979,7 +4210,7 @@ module Array =
///
/// Performs the operation in parallel using .
/// The order in which the given function is applied to elements of the input array is not specified.
- /// The order of the keys and values in the result is also not specified
+ /// The order of the keys and values in the result is also not specified This is an O(n) operation, where n is the length of the array.
/// A function that transforms an element of the array into a comparable key.
/// The input array.
///
@@ -4002,7 +4233,7 @@ module Array =
/// Apply the given function to each element of the array.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the length of the array.
///
///
/// The input array.
@@ -4029,7 +4260,7 @@ module Array =
/// function indicates the index of element.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to elements of the input array is not specified.
+ /// The order in which the given function is applied to elements of the input array is not specified. This is an O(n) operation, where n is the length of the array.
///
///
/// The input array.
@@ -4055,7 +4286,7 @@ module Array =
/// Create an array given the dimension and a generator function to compute the elements.
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to indices is not specified.
+ /// The order in which the given function is applied to indices is not specified. This is an O(n) operation, where n is the count.
///
///
///
@@ -4076,7 +4307,7 @@ module Array =
/// respectively
///
/// Performs the operation in parallel using .
- /// The order in which the given function is applied to indices is not specified.
+ /// The order in which the given function is applied to indices is not specified. This is an O(n) operation, where n is the length of the array.
///
/// The function to test the input elements.
/// The input array.
@@ -4099,7 +4330,7 @@ module Array =
/// Sorts the elements of an array in parallel, returning a new array. Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -4122,7 +4353,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -4146,7 +4377,7 @@ module Array =
/// Sorts the elements of an array in parallel, using the given comparison function as the order, returning a new array.
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to compare pairs of array elements.
/// The input array.
@@ -4175,7 +4406,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, modifying the array in place.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -4213,6 +4444,8 @@ module Array =
///
/// After evaluation array contains [|(0, "aa"); (2, "cc"); (3, "dd"); (1, "bbb")|].
///
+ ///
+ /// This is an O(n log n) operation, modifying the array in place.
[]
val sortInPlaceWith: comparer: ('T -> 'T -> int) -> array: 'T array -> unit
@@ -4231,13 +4464,15 @@ module Array =
///
/// After evaluation array contains [| 1; 1; 3; 4; 6; 8 |].
///
+ ///
+ /// This is an O(n log n) operation, modifying the array in place.
[]
val sortInPlace: array: 'T array -> unit when 'T: comparison
/// Sorts the elements of an array in parallel, in descending order, returning a new array. Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The input array.
///
@@ -4258,7 +4493,7 @@ module Array =
/// Elements are compared using .
///
/// This is not a stable sort, i.e. the original order of equal elements is not necessarily preserved.
- /// For a stable sort, consider using .
+ /// For a stable sort, consider using . This is an O(n log n) operation, where n is the length of the array.
///
/// The function to transform array elements into the type that is compared.
/// The input array.
@@ -4296,6 +4531,8 @@ module Array =
///
/// Evaluates to [| (1, "one"); (2, "two") |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the arrays.
[]
val zip: array1: 'T1 array -> array2: 'T2 array -> ('T1 * 'T2) array
@@ -4317,5 +4554,7 @@ module Array =
///
/// Evaluates to [| 2; 4 |]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val filter: predicate: ('T -> bool) -> array: 'T array -> 'T array
diff --git a/src/FSharp.Core/list.fsi b/src/FSharp.Core/list.fsi
index 1b48f6d9c60..9218eeed5ec 100644
--- a/src/FSharp.Core/list.fsi
+++ b/src/FSharp.Core/list.fsi
@@ -34,6 +34,8 @@ module List =
/// [ (1, "Kirk"); (1, "Spock"); (1, "McCoy"); (2, "Kirk"); (2, "Spock"); (2, "McCoy") ]
///
///
+ ///
+ /// This is an O(n*m) operation, where n and m are the lengths of the input lists.
[]
val allPairs: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list
@@ -56,6 +58,8 @@ module List =
/// [ 1; 2; 3; 4; 5; 6; 7 ]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the first list.
[]
val append: list1: 'T list -> list2: 'T list -> 'T list
@@ -77,6 +81,8 @@ module List =
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline average : list:^T list -> ^T
when ^T : (static member (+) : ^T * ^T -> ^T)
@@ -110,6 +116,8 @@ module List =
/// 51.0
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline averageBy: projection:('T -> ^U) -> list:'T list -> ^U
when ^U : (static member (+) : ^U * ^U -> ^U)
@@ -202,6 +210,8 @@ module List =
///
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val choose: chooser:('T -> 'U option) -> list:'T list -> 'U list
@@ -239,6 +249,8 @@ module List =
/// [ [ 1; 2; 3; 4; 5 ] ]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val chunkBySize: chunkSize:int -> list:'T list -> 'T list list
@@ -255,6 +267,8 @@ module List =
///
/// The sample evaluates to [1; 1; 2; 1; 2; 3; 1; 2; 3; 4] (added extra spaces for easy reading)
///
+ ///
+ /// This is an O(n) operation, where n is the total length of all resulting sublists.
[]
val collect: mapping:('T -> 'U list) -> list:'T list -> 'U list
@@ -335,6 +349,8 @@ module List =
///
/// Evaluates to -1
///
+ ///
+ /// This is an O(min(n,m)) operation, where n and m are the lengths of the lists.
[]
val inline compareWith: comparer:('T -> 'T -> int) -> list1:'T list -> list2:'T list -> int
@@ -352,6 +368,8 @@ module List =
/// input |> List.concat // evaluates [1; 2; 3; 4; 5; 6; 7; 8; 9]
///
///
+ ///
+ /// This is an O(n) operation, where n is the total number of elements across all lists.
[]
val concat: lists:seq<'T list> -> 'T list
@@ -393,6 +411,8 @@ module List =
///
/// Evaluates to false.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline contains: value:'T -> source:'T list -> bool when 'T : equality
@@ -412,6 +432,8 @@ module List =
///
/// Evaluates to [6; 1; 2; 3; 4; 5].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val distinct: list:'T list -> 'T list when 'T : equality
@@ -433,6 +455,8 @@ module List =
/// input |> List.distinctBy isEven // evaluates [6; 1]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val distinctBy: projection:('T -> 'Key) -> list:'T list -> 'T list when 'Key : equality
@@ -453,6 +477,8 @@ module List =
///
/// Evaluates [('H', 1); ('a', 1); ('p', 2); ('y', 1)]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val countBy : projection:('T -> 'Key) -> list:'T list -> ('Key * int) list when 'Key : equality
@@ -478,10 +504,14 @@ module List =
///
/// Evaluates to [[1; 2; 3]; [4; 5; 6]; [7; 8]; [9; 10]].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val splitInto: count:int -> list:'T list -> 'T list list
/// Returns an empty list of the given type.
+ ///
+ /// This is an O(1) operation.
[]
[]
val empty<'T> : 'T list
@@ -517,6 +547,8 @@ module List =
/// [1..5] |> List.except [0..10] // evaluates []
///
///
+ ///
+ /// This is an O(n+m) operation, where n is the length of the list and m is the length of the items to exclude.
[]
val except: itemsToExclude:seq<'T> -> list:'T list -> 'T list when 'T : equality
@@ -549,6 +581,8 @@ module List =
///
/// Will throw the exception: System.ArgumentException: The input sequence contains more than one element
///
+ ///
+ /// This is an O(1) operation.
[]
val exactlyOne: list:'T list -> 'T
@@ -565,6 +599,8 @@ module List =
/// ([] : int list) |> List.tryExactlyOne // evaluates None
///
///
+ ///
+ /// This is an O(1) operation.
[]
val tryExactlyOne: list:'T list -> 'T option
@@ -572,7 +608,7 @@ module List =
///
/// The predicate is applied to the elements of the input list. If any application
/// returns true then the overall result is true and no further elements are tested.
- /// Otherwise, false is returned.
+ /// Otherwise, false is returned. This is an O(n) operation in the worst case, where n is the length of the list.
/// The function to test the input elements.
/// The input list.
///
@@ -596,7 +632,7 @@ module List =
/// two lengths of the collections. If any application returns true then the overall result is
/// true and no further elements are tested. Otherwise, if one collections is longer
/// than the other then the exception is raised.
- /// Otherwise, false is returned.
+ /// Otherwise, false is returned. This is an O(n) operation in the worst case, where n is the length of the lists.
///
/// The function to test the input elements.
/// The first input list.
@@ -643,6 +679,8 @@ module List =
/// input |> List.find (fun (x,_) -> x |> isGreaterThan 6) // raises an exception
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val find: predicate:('T -> bool) -> list:'T list -> 'T
@@ -669,6 +707,8 @@ module List =
/// input |> List.findBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val findBack: predicate:('T -> bool) -> list:'T list -> 'T
@@ -696,6 +736,8 @@ module List =
/// input |> List.findIndex (fun (x,_) -> x |> isGreaterThan 6) // raises an exception
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val findIndex: predicate:('T -> bool) -> list:'T list -> int
@@ -723,6 +765,8 @@ module List =
/// input |> List.findIndexBack (fun (x,_) -> x |> isGreaterThan 6) // raises an exception
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val findIndexBack: predicate:('T -> bool) -> list:'T list -> int
@@ -746,6 +790,8 @@ module List =
///
/// Evaluates to [(2, "Kirk"); (4, "Spock")]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val filter: predicate:('T -> bool) -> list:'T list -> 'T list
@@ -792,6 +838,8 @@ module List =
/// { fruit = Apple; quantity = 1 }]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val fold<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State
@@ -822,6 +870,8 @@ module List =
///
/// Evaluates to 2. Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val fold2<'T1,'T2,'State> : folder:('State -> 'T1 -> 'T2 -> 'State) -> state:'State -> list1:'T1 list -> list2:'T2 list -> 'State
@@ -866,6 +916,8 @@ module List =
/// { fruit = Orange; quantity = 1 }]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val foldBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State
@@ -912,6 +964,8 @@ module List =
///
/// Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val foldBack2<'T1,'T2,'State> : folder:('T1 -> 'T2 -> 'State -> 'State) -> list1:'T1 list -> list2:'T2 list -> state:'State -> 'State
@@ -919,7 +973,7 @@ module List =
///
/// The predicate is applied to the elements of the input list. If any application
/// returns false then the overall result is false and no further elements are tested.
- /// Otherwise, true is returned.
+ /// Otherwise, true is returned. This is an O(n) operation in the worst case, where n is the length of the list.
/// The function to test the input elements.
/// The input list.
///
@@ -943,7 +997,7 @@ module List =
/// two lengths of the collections. If any application returns false then the overall result is
/// false and no further elements are tested. Otherwise, if one collection is longer
/// than the other then the exception is raised.
- /// Otherwise, true is returned.
+ /// Otherwise, true is returned. This is an O(n) operation in the worst case, where n is the length of the lists.
/// The function to test the input elements.
/// The first input list.
/// The second input list.
@@ -1001,6 +1055,8 @@ module List =
///
/// Evaluates to [(1, [1; 3; 5]); (0, [2; 4])]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val groupBy: projection:('T -> 'Key) -> list:'T list -> ('Key * 'T list) list when 'Key : equality
@@ -1027,6 +1083,8 @@ module List =
///
/// Throws ArgumentException
///
+ ///
+ /// Lists are represented as linked lists so this is an O(1) operation.
[]
val head: list:'T list -> 'T
@@ -1045,6 +1103,8 @@ module List =
///
/// Evaluates to [(0, "a"); (1, "b"); (2, "c")]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val indexed: list:'T list -> (int * 'T) list
@@ -1070,6 +1130,8 @@ module List =
///
/// Throws ArgumentException
///
+ ///
+ /// This is an O(n) operation, where n is the specified count.
[]
val init: length:int -> initializer:(int -> 'T) -> 'T list
@@ -1092,6 +1154,8 @@ module List =
///
/// Evaluates to false
///
+ ///
+ /// This is an O(1) operation.
[]
val isEmpty: list:'T list -> bool
@@ -1121,6 +1185,8 @@ module List =
///
/// Throws ArgumentException
///
+ ///
+ /// Lists are represented as linked lists so this is an O(n) operation, where n is the index.
[]
val item: index:int -> list:'T list -> 'T
@@ -1143,6 +1209,8 @@ module List =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline iter: action:('T -> unit) -> list:'T list -> unit
@@ -1168,6 +1236,8 @@ module List =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val iter2: action:('T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit
@@ -1191,6 +1261,8 @@ module List =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline iteri: action:(int -> 'T -> unit) -> list:'T list -> unit
@@ -1217,6 +1289,8 @@ module List =
///
/// in the console.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val iteri2: action:(int -> 'T1 -> 'T2 -> unit) -> list1:'T1 list -> list2:'T2 list -> unit
@@ -1241,6 +1315,8 @@ module List =
///
/// Throws ArgumentException
///
+ ///
+ /// Lists are represented as linked lists so this is an O(n) operation, where n is the length of the list.
[]
val last: list:'T list -> 'T
@@ -1250,7 +1326,7 @@ module List =
///
/// The length of the list.
///
- /// The notation array.Length is preferred.
+ /// The notation array.Length is preferred. This is an O(n) operation, where n is the length of the list.
///
///
///
@@ -1283,6 +1359,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// Lists are represented as linked lists so this is an O(n) operation, where n is the length of the list.
[]
val tryLast: list:'T list -> 'T option
@@ -1302,6 +1380,8 @@ module List =
///
/// Evaluates to [ 1; 3; 2 ]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val map: mapping:('T -> 'U) -> list:'T list -> 'U list
@@ -1323,6 +1403,8 @@ module List =
///
/// Evaluates to seq ['a'; 'd'; 'o']
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val map2: mapping:('T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list
@@ -1347,6 +1429,8 @@ module List =
/// Evaluates to [ "all"; "the"; "time" ]
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val map3: mapping:('T1 -> 'T2 -> 'T3 -> 'U) -> list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> 'U list
@@ -1376,6 +1460,8 @@ module List =
/// Evaluates newCharges to [In 2; Out 4; In 6] and balance to 2.
/// Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val mapFold<'T,'State,'Result> : mapping:('State -> 'T -> 'Result * 'State) -> state:'State -> list:'T list -> 'Result list * 'State
@@ -1405,6 +1491,8 @@ module List =
/// Evaluates newCharges to [In 2; Out 4; In 6] and balance to 2.
/// Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val mapFoldBack<'T,'State,'Result> : mapping:('T -> 'State -> 'Result * 'State) -> list:'T list -> state:'State -> 'Result list * 'State
@@ -1425,6 +1513,8 @@ module List =
///
/// Evaluates to [ 10; 11; 12 ]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val mapi: mapping:(int -> 'T -> 'U) -> list:'T list -> 'U list
@@ -1445,12 +1535,14 @@ module List =
///
/// Evaluates to [(0, 'a'); (1, 'd'); (2, 'o')]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val mapi2: mapping:(int -> 'T1 -> 'T2 -> 'U) -> list1:'T1 list -> list2:'T2 list -> 'U list
/// Return the greatest of all elements of the list, compared via Operators.max.
///
- /// Raises if list is empty
+ /// Raises if list is empty This is an O(n) operation, where n is the length of the list.
/// The input list.
///
/// Thrown when the list is empty.
@@ -1479,7 +1571,7 @@ module List =
/// Returns the greatest of all elements of the list, compared via Operators.max on the function result.
///
- /// Raises if list is empty.
+ /// Raises if list is empty. This is an O(n) operation, where n is the length of the list.
/// The function to transform the list elements into the type to be compared.
/// The input list.
///
@@ -1509,7 +1601,7 @@ module List =
/// Returns the lowest of all elements of the list, compared via Operators.min.
///
- /// Raises if list is empty
+ /// Raises if list is empty This is an O(n) operation, where n is the length of the list.
/// The input list.
///
/// Thrown when the list is empty.
@@ -1538,7 +1630,7 @@ module List =
/// Returns the lowest of all elements of the list, compared via Operators.min on the function result
///
- /// Raises if list is empty.
+ /// Raises if list is empty. This is an O(n) operation, where n is the length of the list.
/// The function to transform list elements into the type to be compared.
/// The input list.
///
@@ -1574,6 +1666,8 @@ module List =
/// The value at the given index.
///
/// Thrown when the index is negative or the input list does not contain enough elements.
+ ///
+ /// Lists are represented as linked lists so this is an O(n) operation, where n is the index.
[]
[]
val nth: list:'T list -> index:int -> 'T
@@ -1592,6 +1686,8 @@ module List =
///
/// Evaluates to [ 1; 2; 5 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the array.
[]
val ofArray : array:'T array -> 'T list
@@ -1609,6 +1705,8 @@ module List =
///
/// Evaluates to [ 1; 2; 5 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the sequence.
[]
val ofSeq: source:seq<'T> -> 'T list
@@ -1628,6 +1726,8 @@ module List =
///
/// Evaluates to [(1, 2); (2, 3); (3, 4)].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val pairwise: list:'T list -> ('T * 'T) list
@@ -1649,6 +1749,8 @@ module List =
///
/// Evaluates evens to [2; 4] and odds to [1; 3].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val partition: predicate:('T -> bool) -> list:'T list -> ('T list * 'T list)
@@ -1681,6 +1783,8 @@ module List =
/// Throws KeyNotFoundException.
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val pick: chooser:('T -> 'U option) -> list:'T list -> 'U
@@ -1702,6 +1806,8 @@ module List =
///
/// Evaluates to [4; 1; 2; 3].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val permute: indexMap:(int -> int) -> list:'T list -> 'T list
@@ -1711,7 +1817,7 @@ module List =
/// Return the final result. If the input function is f and the elements are i0...iN then computes
/// f (... (f i0 i1) i2 ...) iN.
///
- /// Raises if list is empty
+ /// Raises if list is empty This is an O(n) operation, where n is the length of the list.
///
/// The function to reduce two list elements to a single element.
/// The input list.
@@ -1751,6 +1857,8 @@ module List =
///
/// Evaluates to 2431, by computing 1 + (3 + (4 + 2 * 10) * 10) * 10
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val reduceBack: reduction:('T -> 'T -> 'T) -> list:'T list -> 'T
@@ -1767,6 +1875,8 @@ module List =
///
/// Evaluates to [ "a"; "a"; "a" ].
///
+ ///
+ /// This is an O(n) operation, where n is the specified count.
[]
val replicate: count:int -> initial:'T -> 'T list
@@ -1784,6 +1894,8 @@ module List =
///
/// Evaluates to [ 2; 1; 0 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val rev: list:'T list -> 'T list
@@ -1815,6 +1927,8 @@ module List =
/// state, 1 the next state, -1 the next state, and 2 the final state.
/// Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val scan<'T,'State> : folder:('State -> 'T -> 'State) -> state:'State -> list:'T list -> 'State list
@@ -1844,6 +1958,8 @@ module List =
/// are produced from back to front.
/// Note acc is a commonly used abbreviation for "accumulator".
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val scanBack<'T,'State> : folder:('T -> 'State -> 'State) -> list:'T list -> state:'State -> 'State list
@@ -1859,6 +1975,8 @@ module List =
///
/// Evaluates to [ 7 ].
///
+ ///
+ /// This is an O(1) operation.
[]
val inline singleton: value:'T -> 'T list
@@ -1898,6 +2016,8 @@ module List =
///
/// Evaluates to ["a"; "b"; "c"; "d"].
///
+ ///
+ /// This is an O(n) operation, where n is the number of elements to skip.
[]
val skip: count:int -> list: 'T list -> 'T list
@@ -1918,12 +2038,14 @@ module List =
/// Evaluates to ["bbb"; "cc"; "d"]
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val skipWhile: predicate:('T -> bool) -> list:'T list -> 'T list
/// Sorts the given list using the given comparison function.
///
- /// This is a stable sort, i.e. the original order of equal elements is preserved.
+ /// This is a stable sort, i.e. the original order of equal elements is preserved. This is an O(n log n) operation, where n is the length of the list.
/// The function to compare the list elements.
/// The input list.
///
@@ -1947,7 +2069,7 @@ module List =
/// Sorts the given list using keys given by the given projection. Keys are compared using .
///
- /// This is a stable sort, i.e. the original order of equal elements is preserved.
+ /// This is a stable sort, i.e. the original order of equal elements is preserved. This is an O(n log n) operation, where n is the length of the list.
/// The function to transform the list elements into the type to be compared.
/// The input list.
///
@@ -1966,7 +2088,7 @@ module List =
/// Sorts the given list using .
///
- /// This is a stable sort, i.e. the original order of equal elements is preserved.
+ /// This is a stable sort, i.e. the original order of equal elements is preserved. This is an O(n log n) operation, where n is the length of the list.
/// The input list.
///
/// The sorted list.
@@ -2000,12 +2122,14 @@ module List =
///
/// Evaluates front to [8; 4; 3] and back to [1; 6; 1].
///
+ ///
+ /// This is an O(n) operation, where n is the index.
[]
val splitAt: index:int -> list:'T list -> ('T list * 'T list)
/// Sorts the given list in descending order using keys given by the given projection. Keys are compared using .
///
- /// This is a stable sort, i.e. the original order of equal elements is preserved.
+ /// This is a stable sort, i.e. the original order of equal elements is preserved. This is an O(n log n) operation, where n is the length of the list.
/// The function to transform the list elements into the type to be compared.
/// The input list.
///
@@ -2024,7 +2148,7 @@ module List =
/// Sorts the given list in descending order using .
///
- /// This is a stable sort, i.e. the original order of equal elements is preserved.
+ /// This is a stable sort, i.e. the original order of equal elements is preserved. This is an O(n log n) operation, where n is the length of the list.
/// The input list.
///
/// The sorted list.
@@ -2054,6 +2178,8 @@ module List =
///
/// Evaluates to 11.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline sum: list:^T list -> ^T
when ^T : (static member (+) : ^T * ^T -> ^T)
@@ -2074,6 +2200,8 @@ module List =
///
/// Evaluates to 7.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val inline sumBy: projection:('T -> ^U) -> list:'T list -> ^U
when ^U : (static member (+) : ^U * ^U -> ^U)
@@ -2096,13 +2224,15 @@ module List =
/// Evaluates to ["bb"; "ccc"]
///
///
+ ///
+ /// Lists are represented as linked lists so this is an O(1) operation.
[]
val tail: list:'T list -> 'T list
/// Returns the first N elements of the list.
/// Throws InvalidOperationException
/// if the count exceeds the number of elements in the list. List.truncate
- /// returns as many items as the list contains instead of throwing an exception.
+ /// returns as many items as the list contains instead of throwing an exception. This is an O(n) operation, where n is the number of elements to take.
///
/// The number of items to take.
/// The input list.
@@ -2158,6 +2288,8 @@ module List =
///
/// Evaluates to ["a"; "bb"]
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val takeWhile: predicate:('T -> bool) -> list:'T list -> 'T list
@@ -2175,6 +2307,8 @@ module List =
///
/// Evaluates to [| 1; 2; 5 |].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val toArray: list:'T list -> 'T array
@@ -2192,6 +2326,8 @@ module List =
///
/// Evaluates to seq { 1; 2; 5 }.
///
+ ///
+ /// This is an O(1) operation.
[]
val toSeq: list:'T list -> seq<'T>
@@ -2219,6 +2355,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// Lists are represented as linked lists so this is an O(1) operation.
[]
val tryHead: list:'T list -> 'T option
@@ -2241,6 +2379,8 @@ module List =
///
/// Evaluates to [ [10; 11]; [20; 21]; [30; 31] ].
///
+ ///
+ /// This is an O(n*m) operation, where n is the number of inner lists and m is the length of each inner list.
[]
val transpose: lists:seq<'T list> -> 'T list list
@@ -2277,6 +2417,8 @@ module List =
///
/// Evaluates to the empty list.
///
+ ///
+ /// This is an O(n) operation, where n is the number of elements to return.
[]
val truncate: count:int -> list:'T list -> 'T list
@@ -2307,6 +2449,8 @@ module List =
/// Evaluates to None.
///
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val tryPick: chooser:('T -> 'U option) -> list:'T list -> 'U option
@@ -2336,6 +2480,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val tryFind: predicate:('T -> bool) -> list:'T list -> 'T option
@@ -2365,6 +2511,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val tryFindBack: predicate:('T -> bool) -> list:'T list -> 'T option
@@ -2395,6 +2543,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation in the worst case, where n is the length of the list.
[]
val tryFindIndex: predicate:('T -> bool) -> list:'T list -> int option
@@ -2423,6 +2573,8 @@ module List =
///
/// Evaluates to None.
///
+ ///
+ /// Lists are represented as linked lists so this is an O(n) operation, where n is the index.
[]
val tryItem: index:int -> list:'T list -> 'T option
@@ -2453,6 +2605,8 @@ module List =
///
/// Evaluates to None
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val tryFindIndexBack: predicate:('T -> bool) -> list:'T list -> int option
@@ -2472,6 +2626,8 @@ module List =
///
/// Evaluates to [1; 2; 4; 8; 16; 32; 64]
///
+ ///
+ /// This is an O(n) operation, where n is the number of elements generated.
[]
val unfold<'T,'State> : generator:('State -> ('T * 'State) option) -> state:'State -> 'T list
@@ -2489,6 +2645,8 @@ module List =
///
/// Evaluates numbers to [1; 2] and names to ["one"; "two"].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val unzip: list:('T1 * 'T2) list -> ('T1 list * 'T2 list)
@@ -2506,6 +2664,8 @@ module List =
///
/// Evaluates numbers to [1; 2], names to ["one"; "two"] and roman to ["I"; "II"].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val unzip3: list:('T1 * 'T2 * 'T3) list -> ('T1 list * 'T2 list * 'T3 list)
@@ -2517,7 +2677,7 @@ module List =
///
/// A list containing only the elements that satisfy the predicate.
///
- /// This is identical to List.filter.
+ /// This is identical to List.filter. This is an O(n) operation, where n is the length of the list.
///
/// Select only the even numbers:
///
@@ -2548,6 +2708,8 @@ module List =
///
/// Evaluates to [[1; 2; 3]; [2; 3; 4]; [3; 4; 5]]
///
+ ///
+ /// This is an O(n*windowSize) operation, where n is the length of the list.
[]
val windowed: windowSize:int -> list:'T list -> 'T list list
@@ -2567,6 +2729,8 @@ module List =
///
/// Evaluates to [(1, "one"); (2, "two")].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val zip: list1:'T1 list -> list2:'T2 list -> ('T1 * 'T2) list
@@ -2588,6 +2752,8 @@ module List =
///
/// Evaluates to [(1, "one", "I"); (2, "two", "II")].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the lists.
[]
val zip3: list1:'T1 list -> list2:'T2 list -> list3:'T3 list -> ('T1 * 'T2 * 'T3) list
@@ -2608,6 +2774,8 @@ module List =
///
/// let inputs = [ 0; 2 ]
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val removeAt: index: int -> source: 'T list -> 'T list
@@ -2629,6 +2797,8 @@ module List =
///
/// Evaluates to [ 0; 3 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val removeManyAt: index: int -> count: int -> source: 'T list -> 'T list
@@ -2650,6 +2820,8 @@ module List =
///
/// Evaluates to [ 0; 9; 2 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val updateAt: index: int -> value: 'T -> source: 'T list -> 'T list
@@ -2671,6 +2843,8 @@ module List =
///
/// Evaluates to [ 0; 9; 1; 2 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val insertAt: index: int -> value: 'T -> source: 'T list -> 'T list
@@ -2692,6 +2866,8 @@ module List =
/// Evaluates to [ 0; 8; 9; 1; 2 ].
///
///
+ ///
+ /// This is an O(n+m) operation, where n is the length of the list and m is the number of elements to insert.
[]
val insertManyAt: index: int -> values: seq<'T> -> source: 'T list -> 'T list
@@ -2709,6 +2885,8 @@ module List =
/// Can evaluate to [ 0; 2; 4; 3; 1 ].
///
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomShuffle : source: 'T list -> 'T list
@@ -2729,6 +2907,8 @@ module List =
///
/// Can evaluate to [ 0; 2; 4; 3; 1 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomShuffleWith : random: Random -> source: 'T list -> 'T list
@@ -2749,6 +2929,8 @@ module List =
///
/// Can evaluate to [ 0; 2; 4; 3; 1 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomShuffleBy : randomizer: (unit -> float) -> source: 'T list -> 'T list
@@ -2768,6 +2950,8 @@ module List =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomChoice : source: 'T list -> 'T
@@ -2789,6 +2973,8 @@ module List =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomChoiceWith : random: Random -> source: 'T list -> 'T
@@ -2810,6 +2996,8 @@ module List =
///
/// Can evaluate to 3.
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomChoiceBy : randomizer: (unit -> float) -> source: 'T list -> 'T
@@ -2831,6 +3019,8 @@ module List =
///
/// Can evaluate to [ 3; 1; 3 ].
///
+ ///
+ /// This is an O(n * count) operation, where n is the length of the list.
[]
val randomChoices : count: int -> source: 'T list -> 'T list
@@ -2854,6 +3044,8 @@ module List =
///
/// Can evaluate to [ 3; 1; 3 ].
///
+ ///
+ /// This is an O(n * count) operation, where n is the length of the list.
[]
val randomChoicesWith : random: Random -> count: int -> source: 'T list -> 'T list
@@ -2878,6 +3070,8 @@ module List =
///
/// Can evaluate to [ 3; 1; 3 ].
///
+ ///
+ /// This is an O(n * count) operation, where n is the length of the list.
[]
val randomChoicesBy : randomizer: (unit -> float) -> count: int -> source: 'T list -> 'T list
@@ -2900,6 +3094,8 @@ module List =
///
/// Can evaluate to [ 3; 1; 2 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomSample : count: int -> source: 'T list -> 'T list
@@ -2924,6 +3120,8 @@ module List =
///
/// Can evaluate to [ 3; 1; 2 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomSampleWith : random: Random -> count: int -> source: 'T list -> 'T list
@@ -2948,5 +3146,7 @@ module List =
///
/// Can evaluate to [ 3; 1; 2 ].
///
+ ///
+ /// This is an O(n) operation, where n is the length of the list.
[]
val randomSampleBy : randomizer: (unit -> float) -> count: int -> source: 'T list -> 'T list
\ No newline at end of file
diff --git a/src/FSharp.Core/map.fsi b/src/FSharp.Core/map.fsi
index dba37379f64..7a9e49cc72d 100644
--- a/src/FSharp.Core/map.fsi
+++ b/src/FSharp.Core/map.fsi
@@ -24,6 +24,8 @@ type Map<[] 'Key, [The resulting map.
///
+ /// Maps are represented as binary trees so this is an O(log n) operation, where n is the number of bindings in the map.
+ ///
///
///
/// let sample = Map [ (1, "a"); (2, "b") ]
@@ -41,6 +43,8 @@ type Map<[] 'Key, [The resulting map.
///
+ /// Maps are represented as binary trees so this is an O(log n) operation, where n is the number of bindings in the map.
+ ///
///
///
/// let sample = Map [ (1, "a"); (2, "b") ]
@@ -57,6 +61,8 @@ type Map<[] 'Key, [Returns true if there are no bindings in the map.
///
+ /// This is an O(1) operation.
+ ///
///
///
/// let emptyMap: Map<int, string> = Map.empty
@@ -74,6 +80,8 @@ type Map<[] 'Key, [The resulting map.
///
+ /// This is an O(n log n) operation, where n is the number of elements in the sequence.
+ ///
///
///
/// Map [ (1, "a"); (2, "b") ] // evaluates to map [(1, "a"); (2, "b")]
@@ -87,6 +95,8 @@ type Map<[] 'Key, [True if the map contains the given key.
///
+ /// Maps are represented as binary trees so this is an O(log n) operation, where n is the number of bindings in the map.
+ ///
///
///
/// let sample = Map [ (1, "a"); (2, "b") ]
@@ -99,6 +109,8 @@ type Map<[] 'Key, [The number of bindings in the map.
///
+ /// This is an O(n) operation, where n is the number of bindings in the map.
+ ///
///
///
/// let sample = Map [ (1, "a"); (2, "b") ]
@@ -116,6 +128,8 @@ type Map<[] 'Key, [The value mapped to the key.
///
+ /// Maps are represented as binary trees so this is an O(log n) operation, where n is the number of bindings in the map.
+ ///
///
///
/// let sample = Map [ (1, "a"); (2, "b") ]
@@ -132,6 +146,8 @@ type Map<[] 'Key, [