diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSort.md b/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSort.md new file mode 100644 index 00000000..87fba1e7 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSort.md @@ -0,0 +1,28 @@ +--- +uid: SuperLinq.SuperEnumerable.DensePartialSort``1(System.Collections.Generic.IEnumerable{``0},System.Int32) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSort/DensePartialSort1.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSort``1(System.Collections.Generic.IEnumerable{``0},System.Int32,SuperLinq.OrderByDirection) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSort/DensePartialSort2.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSort``1(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Collections.Generic.IComparer{``0}) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSort/DensePartialSort3.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSort``1(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Collections.Generic.IComparer{``0},SuperLinq.OrderByDirection) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSort/DensePartialSort4.linq#L6-)] + diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSortBy.md b/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSortBy.md new file mode 100644 index 00000000..0bdc4acb --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.DensePartialSortBy.md @@ -0,0 +1,28 @@ +--- +uid: SuperLinq.SuperEnumerable.DensePartialSortBy``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{``0,``1}) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSortBy/DensePartialSortBy1.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSortBy``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{``0,``1},SuperLinq.OrderByDirection) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSortBy/DensePartialSortBy2.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSortBy``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{``0,``1},System.Collections.Generic.IComparer{``1}) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSortBy/DensePartialSortBy3.linq#L6-)] + +--- +uid: SuperLinq.SuperEnumerable.DensePartialSortBy``2(System.Collections.Generic.IEnumerable{``0},System.Int32,System.Func{``0,``1},System.Collections.Generic.IComparer{``1},SuperLinq.OrderByDirection) +example: [*content] +--- +The following code example demonstrates how to get the top N items of a sequence using `DensePartialSort`. +[!code-csharp[](SuperLinq/DensePartialSortBy/DensePartialSortBy4.linq#L6-)] + diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort1.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort1.linq new file mode 100644 index 00000000..1b6d5e70 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort1.linq @@ -0,0 +1,47 @@ + + SuperLinq + SuperLinq + + +var sequence = new Item[] +{ + new(key: 5, text: "1"), + new(key: 5, text: "2"), + new(key: 4, text: "3"), + new(key: 4, text: "4"), + new(key: 3, text: "5"), + new(key: 3, text: "6"), + new(key: 2, text: "7"), + new(key: 2, text: "8"), + new(key: 1, text: "9"), + new(key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence.DensePartialSort(3); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(1, 9), (1, 10), (2, 7), (2, 8), (3, 5), (3, 6)] + +class Item : IComparable +{ + public Item(int key, string text) + { + Key = key; + Text = text; + } + + public int Key { get; } + public string Text { get; } + + public int CompareTo(Item other) => + this.Key.CompareTo(other.Key); + + public override string ToString() => + $"({this.Key}, {this.Text})"; +} diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort2.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort2.linq new file mode 100644 index 00000000..29d89d5d --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort2.linq @@ -0,0 +1,47 @@ + + SuperLinq + SuperLinq + + +var sequence = new Item[] +{ + new(key: 5, text: "1"), + new(key: 5, text: "2"), + new(key: 4, text: "3"), + new(key: 4, text: "4"), + new(key: 3, text: "5"), + new(key: 3, text: "6"), + new(key: 2, text: "7"), + new(key: 2, text: "8"), + new(key: 1, text: "9"), + new(key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence.DensePartialSort(3, OrderByDirection.Descending); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(5, 1), (5, 2), (4, 3), (4, 4), (3, 5), (3, 6)] + +class Item : IComparable +{ + public Item(int key, string text) + { + Key = key; + Text = text; + } + + public int Key { get; } + public string Text { get; } + + public int CompareTo(Item other) => + this.Key.CompareTo(other.Key); + + public override string ToString() => + $"({this.Key}, {this.Text})"; +} diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort3.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort3.linq new file mode 100644 index 00000000..362f7076 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort3.linq @@ -0,0 +1,32 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSort( + 3, + Comparer<(int key, string text)>.Create((x, y) => x.key.CompareTo(y.key))); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(1, 9), (1, 10), (2, 7), (2, 8), (3, 5), (3, 6)] diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort4.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort4.linq new file mode 100644 index 00000000..dbb96390 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSort/DensePartialSort4.linq @@ -0,0 +1,33 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSort( + 3, + Comparer<(int key, string text)>.Create((x, y) => x.key.CompareTo(y.key)), + OrderByDirection.Descending); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(5, 1), (5, 2), (4, 3), (4, 4), (3, 5), (3, 6)] diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy1.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy1.linq new file mode 100644 index 00000000..238b601c --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy1.linq @@ -0,0 +1,32 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSortBy( + 3, + x => x.key); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(1, 9), (1, 10), (2, 7), (2, 8), (3, 5), (3, 6)] diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy2.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy2.linq new file mode 100644 index 00000000..537c94b7 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy2.linq @@ -0,0 +1,33 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSortBy( + 3, + x => x.key, + OrderByDirection.Descending); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(5, 1), (5, 2), (4, 3), (4, 4), (3, 5), (3, 6)] diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy3.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy3.linq new file mode 100644 index 00000000..0690b574 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy3.linq @@ -0,0 +1,33 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSortBy( + 1, + x => x.key, + Comparer.Create((x, y) => (x % 2).CompareTo(y % 2))); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(4, 3), (4, 4), (2, 7), (2, 8)] diff --git a/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy4.linq b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy4.linq new file mode 100644 index 00000000..c1c02036 --- /dev/null +++ b/Docs/SuperLinq.Docs/apidoc/SuperLinq/DensePartialSortBy/DensePartialSortBy4.linq @@ -0,0 +1,34 @@ + + SuperLinq + SuperLinq + + +var sequence = new[] +{ + (key: 5, text: "1"), + (key: 5, text: "2"), + (key: 4, text: "3"), + (key: 4, text: "4"), + (key: 3, text: "5"), + (key: 3, text: "6"), + (key: 2, text: "7"), + (key: 2, text: "8"), + (key: 1, text: "9"), + (key: 1, text: "10"), +}; + +// Get the top N sets of items +var result = sequence + .DensePartialSortBy( + 1, + x => x.key, + Comparer.Create((x, y) => (x % 2).CompareTo(y % 2)), + OrderByDirection.Descending); + +Console.WriteLine( + "[" + + string.Join(", ", result) + + "]"); + +// This code produces the following output: +// [(5, 1), (5, 2), (3, 5), (3, 6), (1, 9), (1, 10)] diff --git a/Source/SuperLinq/DensePartialSort.cs b/Source/SuperLinq/DensePartialSort.cs index f941ddf6..a58a0242 100644 --- a/Source/SuperLinq/DensePartialSort.cs +++ b/Source/SuperLinq/DensePartialSort.cs @@ -5,23 +5,40 @@ namespace SuperLinq; public static partial class SuperEnumerable { /// - /// Executes a partial sort of the top elements of a sequence, including ties. If is less than the total number of elements in , then this method will - /// improve performance. + /// Executes a partial sort of the top elements of a sequence, including ties. If + /// is less than the total number of elements in , then this + /// method will improve performance. /// - /// Type of elements in the sequence. - /// The source sequence. - /// Number of (maximum) elements to return. - /// A sequence containing at most top elements from source, in their ascending - /// order. - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// The source sequence. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// A sequence containing at most top elements from source, in their ascending order. + /// + /// + /// is . + /// + /// + /// is less than 1. + /// /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . /// /// - /// This operator uses deferred execution and streams it results. + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. + /// + /// + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSort(this IEnumerable source, int count) @@ -30,24 +47,43 @@ public static IEnumerable DensePartialSort(this IEnumerable source, int } /// - /// Executes a partial sort of the top elements of a sequence, - /// including ties. If is less than the total number of elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a + /// sequence, including ties. If is less than the total number of elements in , then this method will improve performance. /// - /// Type of elements in the sequence. - /// The source sequence. - /// Number of (maximum) elements to return. - /// The direction in which to sort the elements - /// A sequence containing at most top elements from source, in the specified - /// order. - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// The source sequence. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// The direction in which to sort the elements + /// + /// + /// A sequence containing at most top elements from source, in the specified order. + /// + /// + /// is . + /// + /// + /// is less than 1. + /// /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . + /// + /// + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. /// /// - /// This operator uses deferred execution and streams it results. + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSort( @@ -57,24 +93,43 @@ public static IEnumerable DensePartialSort( } /// - /// Executes a partial sort of the top elements of a sequence, including ties, using - /// to compare elements. If is less than the total number of - /// elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a sequence, including ties, using + /// to compare elements. If is less than the total number + /// of elements in , then this method will improve performance. /// - /// Type of elements in the sequence. - /// The source sequence. - /// Number of (maximum) elements to return. - /// A to compare elements. - /// A sequence containing at most top elements from source, in their ascending - /// order. - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// The source sequence. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// An to compare elements. + /// + /// + /// A sequence containing at most top elements from source, in their ascending order. + /// + /// + /// is . + /// + /// + /// is less than 1. + /// /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . /// /// - /// This operator uses deferred execution and streams it results. + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. + /// + /// + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSort( @@ -85,25 +140,47 @@ public static IEnumerable DensePartialSort( } /// - /// Executes a partial sort of the top elements of a sequence, - /// including ties, using to compare elements. If is less than - /// the total number of elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a + /// sequence, including ties, using to compare elements. If + /// is less than the total number of elements in , then this method will improve + /// performance. /// - /// Type of elements in the sequence. - /// The source sequence. - /// Number of (maximum) elements to return. - /// A to compare elements. - /// The direction in which to sort the elements - /// A sequence containing at most top elements from source, in the specified - /// order. - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// The source sequence. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// A to compare elements. + /// + /// + /// The direction in which to sort the elements + /// + /// + /// A sequence containing at most top elements from source, in the specified order. + /// + /// + /// is . + /// + /// + /// is less than 1. + /// /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . + /// + /// + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. /// /// - /// This operator uses deferred execution and streams it results. + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSort( @@ -114,26 +191,46 @@ public static IEnumerable DensePartialSort( } /// - /// Executes a partial sort of the top elements of a sequence, including ties, according to - /// the key for each element. If is less than the total number of elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a sequence, including ties, + /// according to the key for each element. If is less than the total number of elements + /// in , then this method will improve performance. /// - /// Type of elements in the sequence. - /// Type of keys. - /// The source sequence. - /// A function to extract a key from an element. - /// Number of (maximum) elements to return. - /// A sequence containing at most top elements from source, in ascending order of - /// their keys. - /// is . - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// Type of keys. + /// + /// + /// The source sequence. + /// + /// + /// A function to extract a key from an element. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// A sequence containing at most top elements from source, in ascending order of their + /// keys. + /// + /// + /// or is . + /// + /// + /// is less than 1. /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . /// /// - /// This operator uses deferred execution and streams it results. + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. + /// + /// + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSortBy( @@ -144,27 +241,49 @@ public static IEnumerable DensePartialSortBy( } /// - /// Executes a partial sort of the top elements of a sequence, - /// including ties, according to the key for each element. If is less than the total number - /// of elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a + /// sequence, including ties, according to the key for each element. If is less than + /// the total number of elements in , then this method will improve performance. /// - /// Type of elements in the sequence. - /// Type of keys. - /// The source sequence. - /// A function to extract a key from an element. - /// Number of (maximum) elements to return. - /// The direction in which to sort the elements - /// A sequence containing at most top elements from source, in the specified order - /// of their keys. - /// is . - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// Type of keys. + /// + /// + /// The source sequence. + /// + /// + /// A function to extract a key from an element. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// The direction in which to sort the elements + /// + /// + /// A sequence containing at most top elements from source, in the specified order of + /// their keys. + /// + /// + /// or is . + /// + /// + /// is less than 1. /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . + /// + /// + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. /// /// - /// This operator uses deferred execution and streams it results. + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSortBy( @@ -175,27 +294,50 @@ public static IEnumerable DensePartialSortBy( } /// - /// Executes a partial sort of the top elements of a sequence, including ties, according to - /// the key for each element, using to compare the keys. If is - /// less than the total number of elements in , then this method will improve performance. + /// Executes a partial sort of the top elements of a sequence, including ties, + /// according to the key for each element, using to compare the keys. If is less than the total number of elements in , then this method will + /// improve performance. /// - /// Type of elements in the sequence. - /// Type of keys. - /// The source sequence. - /// A function to extract a key from an element. - /// Number of (maximum) elements to return. - /// A to compare elements. - /// A sequence containing at most top elements from source, in ascending order of - /// their keys. - /// is . - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// Type of keys. + /// + /// + /// The source sequence. + /// + /// + /// A function to extract a key from an element. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// A to compare elements. + /// + /// + /// A sequence containing at most top elements from source, in ascending order of their + /// keys. + /// + /// + /// or is . + /// + /// + /// is less than 1. /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . /// /// - /// This operator uses deferred execution and streams it results. + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. + /// + /// + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSortBy( @@ -207,29 +349,53 @@ public static IEnumerable DensePartialSortBy( } /// - /// Executes a partial sort of the top elements of a sequence, - /// including ties, according to the key for each element, using to compare the keys. If - /// is less than the total number of elements in , then this - /// method will improve performance. + /// Executes a partial sort of the top elements of a + /// sequence, including ties, according to the key for each element, using to + /// compare the keys. If is less than the total number of elements in , then this method will improve performance. /// - /// Type of elements in the sequence. - /// Type of keys. - /// The source sequence. - /// A function to extract a key from an element. - /// Number of (maximum) elements to return. - /// A to compare elements. - /// The direction in which to sort the elements - /// A sequence containing at most top elements from source, in the specified order - /// of their keys. - /// is . - /// is . - /// is less than 1. + /// + /// Type of elements in the sequence. + /// + /// + /// Type of keys. + /// + /// + /// The source sequence. + /// + /// + /// A function to extract a key from an element. + /// + /// + /// Number of (maximum) elements to return. + /// + /// + /// A to compare elements. + /// + /// + /// The direction in which to sort the elements + /// + /// + /// A sequence containing at most top elements from source, in the specified order of + /// their keys. + /// + /// or is . + /// + /// + /// is less than 1. + /// /// /// - /// This operation is an O(n * log(K)) where K is . + /// This is an O(n * log(K)) operation where K is . + /// + /// + /// This method is implemented by using deferred execution. The operator will be executed in it's entirety + /// immediately when the sequence is first enumerated. /// /// - /// This operator uses deferred execution and streams it results. + /// This method performs a stable sort; that is, if the keys of two elements are equal, the order of the + /// elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the + /// same key. /// /// public static IEnumerable DensePartialSortBy(