home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch6 / mergsort.h < prev    next >
Text File  |  2005-06-16  |  2KB  |  48 lines

  1. /*           mergsort.h 
  2.  * 
  3.  * Contains declarations necessary for use 
  4.  * of the merge_sort() package. 
  5.  */ 
  6.  
  7. /* Constant Definitions */
  8. #define MAX_ARRAY  512
  9.  
  10. /* Function Prototypes */ 
  11. void merge_sort( int to_sort[], int first, int last ); 
  12. /*   PRECONDITION:  to_sort is the array with the 
  13.  *                  elements to be sorted. first is the 
  14.  *                  index of the first element to 
  15.  *                  be sorted and last is the index of 
  16.  *                  the last element to be sorted.
  17.  *
  18.  *   POSTCONDITION: to_sort will contain the elements 
  19.  *                  in increasing order.
  20.  */
  21. void merge( int[], int, int, int, int );
  22. /*   PRECONDITION:  Two sorted lists reside in the 
  23.  *                  array lists. The first list starts 
  24.  *                  at index first1 and goes through 
  25.  *                  index last1. The second list starts 
  26.  *                  at index first2 and goes through 
  27.  *                  index last2.
  28.  *
  29.  *
  30.  *   POSTCONDITION: A utility function for merge sort, 
  31.  *                  merges two sorted lists. The merged 
  32.  *                  lists are in the array lists.
  33.  *
  34.  */
  35. void move( int[], int, int, int[], int );
  36. /*   PRECONDITION:  list2 must contain enough cells 
  37.  *                  after index fiest2 to hold the 
  38.  *                  elements in list1 between indices 
  39.  *                  first1 and last1.
  40.  *
  41.  *
  42.  *   POSTCONDITION: A utility function for merge sort, 
  43.  *                  copies the elements in the array 
  44.  *                  list1 with indices first1 to last1 
  45.  *                  to the array list2 starting at the 
  46.  *                  position with index first2.
  47.  */
  48.