Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static IEnumerable<int> QuickSort(IEnumerable<int> i)
- {
- if (!i.Any()) return i;
- var p = i.ElementAt(new Random().Next(0, i.Count() - 1));
- return QuickSort(i.Where(x => x < p)).Concat(i.Where(x => x == p)).Concat(QuickSort(i.Where(x => x > p)));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement