Implement a recursive template function for the 2-way Mergesort algorithm.
A Main program is provided that tests this function.
Can anybody help me out with this question?

this is the main function

#include <iostream>
#include "Student.hpp"
#include "MergeSort.cpp"

int main()
{
	const int n=10;
	{
		Student A[n];
		Student tmpArray[n];
	
		A[0].SetName("Fred");
		A[1].SetName("Andy");
		A[2].SetName("Guy");
		A[3].SetName("Freddy");
		A[4].SetName("Mercury");
		A[5].SetName("Andrew");
		A[6].SetName("Chou");
		A[7].SetName("Chouw");
		A[8].SetName("Ben");
		A[9].SetName("Benny");
	
		mergeSort( A, tmpArray, 0, n-1 );
		cout << "Sorted students: " << endl;
		for ( int i=0; i<n; i++ )
		{
			cout << A[i] << ", ";
		}
		cout << endl;
	}

	{
		int A[n] = { 954, 764, 5432, 74, 532, 87543, 20, 42, 5432, 11 };
		int tmpArray[n];

		mergeSort( A, tmpArray, 0, n-1 );
		cout << "Sorted numbers: " << endl;
		for ( int i=0; i<n; i++ )
		{
			cout << A[i] << ", ";
		}
		cout << endl;

	}


	return 0;
}

Ok, so you posted what your teacher gave you. Now post what YOU have attempted.

Show some effort by posting some of your own code. I'm not even sure what mergesort is supposed to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.