template class bag { public: typedef T value_type; ...... void merge_sort(int p, int r); void merge(int p, int q, int r); void quick_sort(int p, int r); void partition(int p, int r, int& q); void print_bag(); void print_bag(char* file_name); private: int max; // amount of available space int used; // number of elements in the list T* array; // the dynamic array void reserve(int n, bool copy); // called by public functions only if n > max. expands // the bag capacity to n elements, copies the existing // elements to the new space if copy == true, and deletes // the old dynamic array. exits if memory allocation fails. };