Sorting algorithms/Quicksort: Difference between revisions
Content deleted Content added
m Removed dependency on C# 9 init methods from properties. |
m Minor datatype adjustment. |
||
Line 1,795:
#region Properties
public Int32 InsertionLimit { get; }
private T[] Samples { get; }
private Int32 Left { get; set; }
private Int32 Right { get; set; }
private Int32 LeftMedian { get; set; }
private Int32 RightMedian { get; set; }
#endregion
//
// The Tripartite conditional enables Bentley-McIlroy 3-way Partitioning.
// This performs additional compares to isolate islands of keys equal to
// the pivot value. Use unless key-equivalent classes are of small size.
//
#define Tripartite
namespace RosettaCode {
using System;
using System.Diagnostics;
public class QuickSort<T> where T : IComparable {
#region Constants
public const UInt32 INSERTION_LIMIT_DEFAULT = 12;
private const Int32 SAMPLES_MAX = 19;
#endregion
#region Properties
public UInt32 InsertionLimit { get; }
private T[] Samples { get; }
private Int32 Left { get; set; }
Line 1,803 ⟶ 1,828:
#region Constructors
public QuickSort(
this.InsertionLimit = insertionLimit;
this.Samples = new T[SAMPLES_MAX];
|