// sorts and clocks the execution time void WordList::Sort(SortType type) { cout << "Sorting..." << endl; clock_t startTime = clock(); switch (type) { case INSERTION: insertionSort(); break; case QUICK: quickSort(words, 0, words.size() - 1); break; case MERGE: mergeSort(words); break; case HEAP: Heap<string> heap; heap.InitializeMaxHeap(words); heap.Heapsort(words); break; } clock_t execTime = clock() - startTime; ofstream outputFile("Output.txt", ofstream::app); cout << endl << "Execution time for Sort(): " << (float)execTime / CLOCKS_PER_SEC << " seconds" << endl; outputFile << endl << "Execution time for Sort(): " << (float)execTime / CLOCKS_PER_SEC << " seconds" << endl; outputFile.close(); }