Finished Insertion Sort and fixed Output naming
This commit is contained in:
parent
d48e023234
commit
2eee0e5fb1
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1,5 @@
|
||||
wordlists
|
||||
test/OUTPUT
|
||||
bin/*.out
|
||||
build/*.o
|
||||
*.swp
|
||||
|
BIN
bin/main.out
BIN
bin/main.out
Binary file not shown.
Binary file not shown.
@ -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.
@ -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)
|
||||
{
|
||||
;
|
||||
|
15000
test/OUTPUT/HS0K.txt
15000
test/OUTPUT/HS0K.txt
File diff suppressed because it is too large
Load Diff
15000
test/OUTPUT/IS0K.txt
15000
test/OUTPUT/IS0K.txt
File diff suppressed because it is too large
Load Diff
15000
test/OUTPUT/MS0K.txt
15000
test/OUTPUT/MS0K.txt
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user