sorting-algorithms/include/sorts.h

46 lines
1.1 KiB
C
Raw Normal View History

#ifndef SORTS_H
#define SORTS_H
#include <chrono>
#include <string>
#include <vector>
enum SortType {INSERTION = 0, MERGE, HEAP};
class Sorter
{
private:
std::string filename;
int lineCount;
std::vector<std::string> originalWordList;
std::chrono::duration<double> sortTime;
2023-02-11 22:43:54 -06:00
int heapSize; // Heap Sort only
public:
Sorter();
std::vector<std::string> newWordList;
2023-02-11 19:28:12 -06:00
bool defaultFile, defaultOnly, fileGiven, allLists, sortGiven;
SortType currentType;
std::string GetFilename(void);
void SetFilename(std::string newName);
void SetWordList(void);
void SortAll(void);
void RunSorts(void);
void __RunSorts__(void);
void OutputResult(void);
void PrintSortTime(std::string outputFilename);
void PrintToFile(std::string outputFilename);
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);
void HeapSort(void);
2023-02-11 22:43:54 -06:00
void __HeapSort__(void);
void __Heapify__(int i);
int __LEFT__(int i);
int __RIGHT__(int i);
};
void CheckArguments(int argc, char* arguments[], Sorter* sortObj);
#endif