diff --git a/src/FSharp.Core/array.fsi b/src/FSharp.Core/array.fsi index 18a4463277..0ae2be5c51 100644 --- a/src/FSharp.Core/array.fsi +++ b/src/FSharp.Core/array.fsi @@ -46,6 +46,8 @@ module Array = /// /// Thrown when either of the input arrays is null. /// + /// Time complexity: O(n + m) where n and m are the lengths of the input arrays. Space complexity: O(n + m). + /// /// /// /// Array.append [| 1; 2 |] [| 3; 4 |] @@ -278,6 +280,8 @@ module Array = /// /// Thrown when the input sequence is null. /// + /// Time complexity: O(n) where n is the total number of elements in all arrays. Space complexity: O(n). + /// /// /// /// let inputs = [ [| 1; 2 |]; [| 3 |]; [| 4; 5 |] ] @@ -1234,6 +1238,8 @@ module Array = /// Thrown when the input array is null. /// Thrown when the input array is empty. /// + /// Time complexity: O(1). Space complexity: O(1). + /// /// /// /// let inputs = [| "banana"; "pear" |] @@ -1530,7 +1536,7 @@ module Array = /// /// The length of the array. /// - /// The notation array.Length is preferred. + /// Time complexity: O(1). Space complexity: O(1). The notation array.Length is preferred. /// /// Thrown when the input array is null. /// @@ -2582,6 +2588,8 @@ module Array = /// /// A new array containing the elements of the original except the first element. /// + /// Time complexity: O(n) where n is the length of the array. Space complexity: O(n). + /// /// /// /// let inputs = [| "a"; "bb"; "ccc" |] diff --git a/src/FSharp.Core/list.fsi b/src/FSharp.Core/list.fsi index c77e26ddaf..42d0ad9d07 100644 --- a/src/FSharp.Core/list.fsi +++ b/src/FSharp.Core/list.fsi @@ -46,6 +46,8 @@ module List = /// /// The resulting list. /// + /// Time complexity: O(n) where n is the length of the first list. Space complexity: O(n). + /// /// /// /// List.append [ 1..3 ] [ 4..7 ] @@ -345,6 +347,8 @@ module List = /// /// The resulting concatenated list. /// + /// Time complexity: O(n) where n is the total number of elements in all lists. Space complexity: O(n). + /// /// /// /// let input = [ [1;2] @@ -1013,6 +1017,8 @@ module List = /// /// The first element of the list. /// + /// Time complexity: O(1). Space complexity: O(1). + /// /// /// /// let inputs = ["banana"; "pear"] @@ -1251,7 +1257,7 @@ module List = /// /// The length of the list. /// - /// The notation array.Length is preferred. + /// Time complexity: O(n) where n is the length of the list. Space complexity: O(1). The notation array.Length is preferred. /// /// /// @@ -2088,6 +2094,8 @@ module List = /// /// The list after removing the first element. /// + /// Time complexity: O(1). Space complexity: O(1). + /// /// /// /// let inputs = ["a"; "bb"; "ccc"] diff --git a/src/FSharp.Core/map.fsi b/src/FSharp.Core/map.fsi index 2fdabdbb29..911161f778 100644 --- a/src/FSharp.Core/map.fsi +++ b/src/FSharp.Core/map.fsi @@ -230,6 +230,8 @@ module Map = /// /// The resulting map. /// + /// Time complexity: O(log n) where n is the size of the map. Space complexity: O(log n) due to path copying in the balanced tree. + /// /// /// /// let input = Map [ (1, "a"); (2, "b") ] @@ -643,6 +645,8 @@ module Map = /// /// The resulting map. /// + /// Time complexity: O(log n) where n is the size of the map. Space complexity: O(log n) due to path copying in the balanced tree. + /// /// /// /// let sample = Map [ (1, "a"); (2, "b") ] diff --git a/src/FSharp.Core/prim-types.fsi b/src/FSharp.Core/prim-types.fsi index 6697e108d2..b755328f0c 100644 --- a/src/FSharp.Core/prim-types.fsi +++ b/src/FSharp.Core/prim-types.fsi @@ -2674,6 +2674,8 @@ namespace Microsoft.FSharp.Collections [] type List<'T> = | ([]): 'T list + /// Cons operator for adding an element to the front of a list. + /// Time complexity: O(1). Space complexity: O(1). | (::): Head: 'T * Tail: 'T list -> 'T list /// Returns an empty list of a particular type @@ -3800,6 +3802,8 @@ namespace Microsoft.FSharp.Core /// /// The concatenation of the lists. /// + /// Time complexity: O(n) where n is the length of the first list. Space complexity: O(n). + /// /// /// /// let l1 = ['a'; 'b'; 'c'] diff --git a/src/FSharp.Core/seq.fsi b/src/FSharp.Core/seq.fsi index 24189d3730..fd5e59c616 100644 --- a/src/FSharp.Core/seq.fsi +++ b/src/FSharp.Core/seq.fsi @@ -38,7 +38,9 @@ module Seq = /// /// The returned sequence may be passed between threads safely. However, /// individual IEnumerator values generated from the returned sequence should not be accessed - /// concurrently. + /// concurrently. + /// + /// Time complexity: O(1) - sequences are lazily evaluated. Space complexity: O(1). /// /// The first sequence. /// The second sequence. diff --git a/src/FSharp.Core/set.fsi b/src/FSharp.Core/set.fsi index d60432fcd0..5a9920514a 100644 --- a/src/FSharp.Core/set.fsi +++ b/src/FSharp.Core/set.fsi @@ -297,6 +297,8 @@ module Set = /// /// A new set containing value. /// + /// Time complexity: O(log n) where n is the size of the set. Space complexity: O(log n) due to path copying in the balanced tree. + /// /// /// /// let set = Set.empty.Add(1).Add(1).Add(2) @@ -539,6 +541,8 @@ module Set = /// /// The intersection of set1 and set2. /// + /// Time complexity: O(n + m) where n and m are the sizes of the input sets. Space complexity: O(min(n, m)). + /// /// /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) @@ -582,6 +586,8 @@ module Set = /// /// The union of set1 and set2. /// + /// Time complexity: O(n + m) where n and m are the sizes of the input sets. Space complexity: O(n + m). + /// /// /// /// let set1 = Set.empty.Add(1).Add(2).Add(3) @@ -680,6 +686,8 @@ module Set = /// /// The input set with value removed. /// + /// Time complexity: O(log n) where n is the size of the set. Space complexity: O(log n) due to path copying in the balanced tree. + /// /// /// /// let set = Set.empty.Add(1).Add(2).Add(3)