So, I'm wondering if someone can help me out here. The skeleton of the program is as follows...
- Code: Select all
#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <cstdlib>
#include <time>
using namespace std;
typedef int ItemType;
typedef list<ItemType> ADT; //short for Abstract Data Type
blah blah blah code here
class Sort
{
public:
blah blah blah public functions here
protected:
void mergeSort(void);
private:
ADT items;
void _merge(ADT::iterator first, ADT::iterator mid, ADT::iterator last);
void _mergeSort(ADT::iterator first, ADT::iterator last);
(insert more private members here)
}
Ok, all this is defined in the project specifications. Furthermore, the function mergeSort(void) is implemented (not allowed to change this).
- Code: Select all
void Sort::mergeSort(void);
{
_mergeSort(items.begin(), items.end());
}
yeah, real flippin hard function there.
Anyhow, I'll draw the attention back to the declaration of typedef ADT. In this example, I made it of the STL list type. However, the doccumentation says that this merge sort should work if ADT is changed to deque or vector.
I honestly have no clue how to go about writing these functions. Could someone give me some pointers?
Edit: Kewl, that post somehow broke the forum tables... --;