/********************************************************************* C311 Spring 2021 Authors: Dana Vrajitoru & W. Knight Functions implementing the merge sort. ********************************************************************/ #ifndef MERGE_SORT_H #define MERGE_SORT_H /********************* A R R A Y M E R G E ********************* This function assumes that the (sub)arrays a[afirst..alast] and b[bfirst..blast] contain objects of a data type on which the binary comparison operator "<=" is defined. It also assumes that the objects in each array are arranged in increasing order. It begins by making sure that the (sub)array c[cfirst..clast] is large enough to hold all the objects from the other two arrays; if that is not the case, it returns the value false). If it determines that the array c is big enough, it copies all the objects from array a and b into array c in such a way that they form a single ordered list in c . Coded by W. Knight and D. Vrajitoru, using a standard elementary merging algorithm. */ bool merge_arrays (const int a[], int afirst, int alast, const int b[], int bfirst, int blast, int c[], int cfirst, int clast); // The actual merge sort function void merge_sort (int a[], int first, int last, int *aux = NULL) ; #endif