/************************************************************************************************/
/*			        LEDA Lab: 3rd Lab Assignment					*/
/*			         Sorting Algorithms 					*/
/************************************************************************************************/

#define WhoAmI " <Give your name(s)> "		// for identification purposes		


#include <LEDA/core/array.h>				// for using the array data type of LEDA
//#include <LEDA/core/basic.h>				// to include the min function...
#include <LEDA/core/random.h>			// to include the random_source type...
#include <LEDA/core/string.h>
#include <iostream>

using namespace leda;

using std::cout;
using std::cin;
using std::endl;

int L=1;		//Low index
int H=5;	//High index

int insertion_sort(array<int>& A)
// returns the absolute number of comparisons...
{
	int low = A.low();
	int high = A.high();

	// count keeps track of comparisons and read/write operations in arrays
	int count = 0;

	//.............. PROVIDE YOUR CODE

	return(count);
}

int merge(array<int>& X, array<int>& Y, int i, int K, int h)
{
	// count keeps track of comparisons and read/write operations in arrays
	int count = 0;


	//.............. PROVIDE YOUR CODE

	return(count);
}


int merge_sort(array<int>& A)
{
	// count keeps track of comparisons and read/write operations in arrays
	int count = 0;


	//.............. PROVIDE YOUR CODE

	return count;
}


int bubble_sort(array<int>& A)
{
	// count keeps track of comparisons and read/write operations in arrays
	int count = 0;

	//.............. PROVIDE YOUR CODE

	return(count);
}

int main() 
{

cout << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;
cout << "LEDA LAB 2012: Lab3 \t Sorting Algorithms \t" << WhoAmI << endl;
cout << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;

	int result = 0;
	string s;

	cout << "Dwse to plhthos twn stoixeiwn:"; 
	cin >> H;
	cout << endl; 
	array<int> A(L,H), B(L,H), C(L,H); 

	cout << "8eleis tyxaio pinaka? [y/n]"; 
	cin >> s;

	random_source S(L,H);

	if ("yes"==s) 
		for(int i=L; i<=H; i++) 
		{ 
			S >> A[i]; 
		} 
	else 
	{ 
		cout << endl; 
		A.read("Dwse tis times twn stoixeiwn toy pinaka: "); 
	}

// use 3 arrays for the 3 sorting algorithms
	B = A;
	C = A;

cout << "Sorting an array of " << H-L+1 << " elements: ";
A.print('-');
cout << endl << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;

// testing insertion sort...
	cout<< "Testing the Insertion Sort routine..." << endl;
	result = insertion_sort(A);
	cout << endl << "\t * Number of comparisons: " << result << endl;
	result = insertion_sort(A);
      cout << endl << "\t * Number of comparisons (for resorting the sorted list): " << result << endl;
	cout << "Sorted array by Insertion Sort: ";
	A.print('-');
	cout << endl << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;


// testing buble sort...
	cout<< endl << "Testing the Bubble Sort routine..." << endl;
	result = bubble_sort(B);
	cout << endl << "\t * Number of comparisons: " << result << endl;
	result = bubble_sort(B);
	cout << endl << "\t * Number of comparisons (for resorting the sorted list): " << result << endl;
	cout << "Sorted array by Bubble Sort: ";
	B.print('-');
	cout << endl << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;

// testing merge sort...
	cout<< endl << "Testing the Merge Sort routine..." << endl;
	result = merge_sort(C);
	cout << endl << "\t * Number of comparisons: " << result << endl;
	result = merge_sort(C);
	cout << endl << "\t * Number of comparisons (for resorting the sorted list): " << result << endl;
	cout << "Sorted array by Merge Sort: ";
	C.print('-');
	cout << endl << "///////////////////////////////////////////////////////////////////////////////////////////////////// " << endl;

}
