00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #pragma once
00015
00019 #include "Clock.h"
00020
00021
00022 #include "SortCmp.h"
00023
00024 namespace kNet
00025 {
00026
00059 namespace sort
00060 {
00061
00066 template<typename T, typename CmpFunc>
00067 void SelectionSort(T *list, int numItems, CmpFunc &cmp);
00068
00072 template<typename T, typename CmpFunc>
00073 void PartialSelectionSort(T *list, int numItems, int numItemsToSort, CmpFunc &cmp);
00074
00077 template<typename T, typename CmpFunc>
00078 void InsertionSort(T *list, int numItems, CmpFunc &cmp);
00079
00082 template<typename T, typename CmpFunc>
00083 void ShellSort(T *list, int numItems, CmpFunc &cmp);
00084
00087 template<typename T, typename CmpFunc>
00088 void BubbleSort(T *list, int numItems, CmpFunc &cmp);
00089
00093 template<typename T, typename CmpFunc>
00094 void CocktailSort(T *list, int numItems, CmpFunc &cmp);
00095
00098 template<typename T, typename CmpFunc>
00099 void CombSort(T *list, int numItems, CmpFunc &cmp);
00100
00104 template<typename T, typename CmpFunc>
00105 void MergeSort(T *list, int numItems, CmpFunc &cmp);
00106
00111 template<typename T, typename CmpFunc>
00112 void QuickSort(T *list, int numItems, CmpFunc &cmp);
00113
00117 template<typename T, typename CmpFunc>
00118 void HeapSort(T *list, int numItems, CmpFunc &cmp);
00119
00124 template<typename T, typename CmpFunc>
00125 void IntroSort(T *list, int numItems, int nMaxRecursionLevels, CmpFunc &cmp);
00126
00128 template<typename T, typename CmpFunc>
00129 bool IsSorted(T *list, int numItems, CmpFunc &cmp);
00130
00131
00132 template<typename T> void SelectionSort(T *list, int numItems) { SelectionSort<T>(list, numItems, TriCmp<T>); }
00133 template<typename T> void InsertionSort(T *list, int numItems) { InsertionSort<T>(list, numItems, TriCmp<T>); }
00134 template<typename T> void ShellSort(T *list, int numItems) { ShellSort<T>(list, numItems, TriCmp<T>); }
00135 template<typename T> void BubbleSort(T *list, int numItems) { BubbleSort<T>(list, numItems, TriCmp<T>); }
00136 template<typename T> void CocktailSort(T *list, int numItems) { CocktailSort<T>(list, numItems, TriCmp<T>); }
00137 template<typename T> void CombSort(T *list, int numItems) { CombSort<T>(list, numItems, TriCmp<T>); }
00138 template<typename T> void MergeSort(T *list, int numItems) { MergeSort<T>(list, numItems, TriCmp<T>); }
00139 template<typename T> void QuickSort(T *list, int numItems) { QuickSort<T>(list, numItems, TriCmp<T>); }
00140
00141 template<typename T> void HeapSort(T *list, int numItems) { HeapSort<T>(list, numItems, TriCmp<T>); }
00142 template<typename T> void IntroSort(T *list, int numItems, int nMaxRecursionLevels = 1000) { IntroSort<T>(list, numItems, nMaxRecursionLevels, TriCmp<T>); }
00143
00144 }
00145 }
00146
00147 #include "Sort.inl"
00148