C # algorithm (4) Fast sorting I have introduced three sort algorithms, which are relatively simple. Today I wrote another algorithm for fast sorting. Hope you can give me more advice. I will not answer the specific ideas. Previous experiences. Using System; Namespace QuickSorter { Public class QuickSorter { Private void Swap (ref int l, ref int r) { Int s; S = l; L = r; R = s; } Public void Sort (int [] list, int low, int high) { Int timeout; Int l, r; Int mid; If (high <= low) Return; Else if (high = low + 1) { If (list [low]> list [high]) Swap (ref list [low], ref list [high]); Return; } Mid = (low + high)> 1; Vertex = list [mid]; Swap (ref list [low], ref list [mid]); L = low + 1; R = high; Do { While (l <= r & list [l] l ++; While (list [r]> = tables) R --; If (l Swap (ref list [l], ref list [r]); } While (l list [low] = list [r]; List [r] = cursor; If (low + 1 Sort (list, low, R-1 ); If (r + 1 Sort (list, r + 1, high ); } } Public class MainClass { Public static void Main () { Int [] iArrary = new int }; QuickSorter q = new QuickSorter (); Q. Sort (iArrary, 0, 13 ); For (int m = 0; m <= 13; m ++) Console. WriteLine ("{0}", iArrary [m]); } } } Compiled and running environment: windows xp VC #. net 7.0 |