Finished Insertion Sort and fixed Output naming

This commit is contained in:
TriantaTV 2023-01-17 11:55:57 -06:00
parent d48e023234
commit 2eee0e5fb1
9 changed files with 28 additions and 45002 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
wordlists
test/OUTPUT
bin/*.out
build/*.o
*.swp

Binary file not shown.

Binary file not shown.

View File

@ -24,6 +24,8 @@ public:
void PrintToFile(std::string outputFilename);
void InsertionSort(void);
void MergeSort(void);
void __MergeSort__(void);
void __Merge__(void);
void HeapSort(void);
};

Binary file not shown.

View File

@ -76,7 +76,7 @@ void Sorter::PrintToFile(std::string outputFilename)
{
std::string outputPath = "test/OUTPUT/";
outputPath += outputFilename;
outputPath += std::to_string(lineCount % 1000);
outputPath += std::to_string(lineCount / 1000);
outputPath += "K.txt";
std::ofstream file(outputPath);
if (!file.is_open())
@ -91,7 +91,19 @@ void Sorter::PrintToFile(std::string outputFilename)
void Sorter::InsertionSort(void)
{
;
int i;
std::string key;
for (int j = 1; j < lineCount; j++)
{
key = newWordList[j];
i = j - 1;
while ((i >= 0) && (newWordList[i] > key))
{
newWordList[i + 1] = newWordList[i];
i = i - 1;
}
newWordList[i + 1] = key;
}
}
void Sorter::MergeSort(void)
@ -99,6 +111,16 @@ void Sorter::MergeSort(void)
;
}
void Sorter::__MergeSort__(void)
{
;
}
void Sorter::__Merge__(void)
{
;
}
void Sorter::HeapSort(void)
{
;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff