Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. public static IEnumerable<int> QuickSort(IEnumerable<int> i)
  2. {
  3. if (!i.Any()) return i;
  4. var p = i.ElementAt(new Random().Next(0, i.Count() - 1));
  5. return QuickSort(i.Where(x => x < p)).Concat(i.Where(x => x == p)).Concat(QuickSort(i.Where(x => x > p)));
  6. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement