/* sortdriver1.cpp is used to test various sorting algorithms
 *
 * Written by:   Larry R. Nyhoff
 * Written for:  Lab Manual for C++: An Introduction to Data Structures
 *
 * Add other documentation required by your instructor such as your name, 
 * course number, and the current date.
 *************************************************************************/

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

#include "SortLibrary"

/* Output operator to display the list stored in positions
 * 1, 2, . . .  of a vector v.
 *
 * Receive: Type parameter ElementType
 *          ostream out
 *          vector v with elements of type ElementType
 * Output:  v[1], v[2], . . .
 *****************************************************************/

// Define a function template for operator<<() here


int main()
{
  // Construct a vector of ints
  vector<int> intVecOrig(1),
              intVec(1);
  // Value in position [0] will be ignored -- use positions 1, 2, 3, ...

  intVecOrig.push_back(10);  intVecOrig.push_back(7);
  intVecOrig.push_back(2);   intVecOrig.push_back(5);
  intVecOrig.push_back(11);

  // Construct a vector of strings
  vector<string> strVecOrig(1),
                 strVec;
  // Value in position [0] will be ignored -- use positions 1, 2, 3, ...

  strVecOrig.push_back("DO");  strVecOrig.push_back("RE");
  strVecOrig.push_back("MO");  strVecOrig.push_back("FA");
  strVecOrig.push_back("SO");  strVecOrig.push_back("LA");
  strVecOrig.push_back("TI");


  // PART 1 -- BUBBLESORT
  cout << "BUBBLESORT:\n===========\n"
          "Unsorted list of integers:\n" << intVecOrig<< endl;
  intVec = intVecOrig;
  BubbleSort(intVec);
  cout << "Sorted list:\n" << intVec << endl;

  cout << "\nUnsorted list of strings:\n" << strVecOrig<< endl;
  strVec = strVecOrig;
  BubbleSort(strVec);
  cout << "Sorted list:\n" << strVec << endl;


  /******** PART 2 -- SELECTIONSORT
  cout << "\nSELECTION SORT\n==========\n"
          "Unsorted list of integers:\n" << intVecOrig<< endl;
  // Reset intVec to original list and sort it
  intVec = intVecOrig;
  SelectionSort(intVec);
  cout << "Sorted list:\n" << intVec << endl;

  cout << "\nUnsorted list of strings:\n" << strVecOrig<< endl;
  // Reset strVec to original list and sort it
  strVec = strVecOrig;
  SelectionSort(strVec);
  cout << "Sorted list:\n" << strVec << endl;

  ********* END OF PART 2 **********/


  /******** PART 3 -- INSERTIONSORT
  cout << "\nINSERTION SORT\n==========\n"
          "Unsorted list of integers:\n" << intVecOrig<< endl;
  // Reset intVec to original list and sort it
  intVec = intVecOrig;
  InsertionSort(intVec);
  cout << "Sorted list:\n" << intVec << endl;

  cout << "\nUnsorted list of strings:\n" << strVecOrig<< endl;
  // Reset strVec to original list and sort it
  strVec = strVecOrig;
  InsertionSort(strVec);
  cout << "Sorted list:\n" << strVec << endl;

  ********* END OF PART 3 **********/


 /******** PART 4 -- QUICKSORT
  cout << "\nQUICKSORT\n==========\n"
          "Unsorted list of integers:\n" << intVecOrig<< endl;
  // Reset intVec to original list and sort it
  intVec = intVecOrig;
  QSort(intVec);
  cout << "Sorted list:\n" << intVec << endl;

  cout << "\nUnsorted list of strings:\n" << strVecOrig<< endl;
  // Reset strVec to original list and sort it
  strVec = strVecOrig;
  QSort(strVec);
  cout << "Sorted list:\n" << strVec << endl;

  ********* END OF PART 4 **********/


  /******** PART 5 -- STL's SORT
  cout << "\nSTL'S SORT\n===========\n"
          "Unsorted list of integers:\n" << intVecOrig<< endl;
  // Reset intVec to original list and sort it
  intVec = intVecOrig;
  sort(intVec.begin() + 1 , intVec.end());
  cout << "Sorted list:\n" <<intVec << endl;

  cout << "\nUnsorted list of strings:\n" << strVecOrig<< endl;
  // Reset strVec to original list and sort it
  strVec = strVecOrig;
  sort(strVec.begin()+1, strVec.end());
  cout << "Sorted list:\n" << strVec << endl;

  ********* END OF PART 5 **********/

}


