public List<int> quicksort( List<int> a) { Random r = new Random(); List<int> less = new List<int>(); List<int> greater = new List<int>(); if (a.Count <= 1) return a; int pos =r.Next(a.Count); int pivot = a[pos]; a.RemoveAt(pos); foreach (int x in a) { if (x <= pivot) { less.Add(x); } else { greater.Add(x); } } return concat(quicksort(less), pivot, quicksort(greater)); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)