Finished Insertion Sort and fixed Output naming
This commit is contained in:
Binary file not shown.
+24
-2
@@ -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)
|
||||
{
|
||||
;
|
||||
|
||||
Reference in New Issue
Block a user