Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/DataType/Sort/Sort.hpp

Go to the documentation of this file.
00001 // Sort.hpp - Implementation of Slow Sort method algorithm such as:
00002 //            Insertion Sort, Bubble Sort, Selection Sort, Shell Sort
00003 //            Radix Sort, Heap Sort, Merge Sort only.
00004 
00005 #ifndef __J2K__Sort_HPP__
00006 #define __J2K__Sort_HPP__    // To avoid multiple declaration of a class
00007 
00008 #include "Const.hpp"
00009 #include "MaxHeap.hpp"
00010 
00011 static long POW2[17] = {   1,    2,     4,     8,    16,   
00012                                 32,    64,   128,   256,  
00013                                512,  1024,  2048,  4096, 
00014                               8192, 16384, 32768, 65536  };
00015 
00016 #define BITS  6
00017 
00018 void InsertionSort(  Elem* array, int n  );
00019 void BubbleSort(     Elem* array, int n  );
00020 void SelectionSort(  Elem* array, int n  );
00021 void ShellSort(      Elem* array, int n  );
00022 void InsertionSort(  Elem* array, int n, int incr );
00023 
00024 void MergeSort(Elem* array, int Size);
00025 void HeapSort( Elem* array, int Size );
00026 void RadixSort(Elem* array, long Size);
00027 
00028 void QuickSort( Elem* array, int Size );
00029 void BrightQSort(  Elem* array, ulong Size );
00030 void OldQuickSort( Elem* array, ulong Size );
00031 
00032 void MergeSort(Elem* array, Elem* temp, int left, int right);
00033 
00034 struct QEntry {
00035    long Left;
00036    long Right;
00037 };
00038 
00039 // Swap longents: A[i] <==> A[j]
00040 inline void swap( Elem* A, int i, int j ) 
00041 {
00042   Elem temp = A[i];
00043   A[i] = A[j];
00044   A[j] = temp;
00045 }
00046 
00047 #endif // End of Sort.hpp
00048 

Generated on Sun Oct 14 18:46:18 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001