2023-01-12 13:32:19 -06:00
|
|
|
#ifndef SORTS_H
|
|
|
|
#define SORTS_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
|
2023-01-16 16:11:40 -06:00
|
|
|
enum SortType {INSERTION = 0, MERGE, HEAP};
|
|
|
|
|
2023-01-12 13:32:19 -06:00
|
|
|
class Sorter
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
std::string filename;
|
2023-01-16 16:11:40 -06:00
|
|
|
int lineCount;
|
|
|
|
std::vector<std::string> originalWordList;
|
|
|
|
std::vector<std::string> newWordList;
|
|
|
|
SortType currentType;
|
2023-01-12 13:32:19 -06:00
|
|
|
public:
|
2023-01-16 16:11:40 -06:00
|
|
|
Sorter(std::string newFilename);
|
|
|
|
std::string GetFilename(void);
|
|
|
|
void SetFilename(std::string newName);
|
2023-01-12 13:32:19 -06:00
|
|
|
void SetWordList(void);
|
2023-01-16 16:11:40 -06:00
|
|
|
void RunSorts(void);
|
|
|
|
void OutputResult(void);
|
|
|
|
void PrintToFile(std::string outputFilename);
|
2023-01-12 13:32:19 -06:00
|
|
|
void InsertionSort(void);
|
|
|
|
void MergeSort(void);
|
2023-01-19 13:04:06 -06:00
|
|
|
void __MergeSort__(int p, int r);
|
|
|
|
void __Merge__(int p, int q, int r);
|
2023-01-12 13:32:19 -06:00
|
|
|
void HeapSort(void);
|
|
|
|
};
|
|
|
|
|
2023-01-16 16:11:40 -06:00
|
|
|
#endif
|