1 Star 0 Fork 65

欢喜派/C-Sharp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
RandomPivotQuickSorter.cs 550 Bytes
一键复制 编辑 原始数据 按行查看 历史
Andrii Siriak 提交于 2021-05-08 21:42 . Cleanup minor things (#221)
using System;
using System.Collections.Generic;
namespace Algorithms.Sorters.Comparison
{
/// <summary>
/// Sorts arrays using quicksort (selecting random point as a pivot).
/// </summary>
/// <typeparam name="T">Type of array element.</typeparam>
public sealed class RandomPivotQuickSorter<T> : QuickSorter<T>
{
private readonly Random random = new();
protected override T SelectPivot(T[] array, IComparer<T> comparer, int left, int right) =>
array[random.Next(left, right + 1)];
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C#
1
https://gitee.com/Joypai/C-Sharp.git
git@gitee.com:Joypai/C-Sharp.git
Joypai
C-Sharp
C-Sharp
master

搜索帮助

D67c1975 1850385 1daf7b77 1850385