/C-Plus-Plus-Sorts

My attempts at Merge Sort, Insertion Sort, Quick Sort, and Selection Sort in C++.

Primary LanguageC++

C-Plus-Plus-Sorts

Please compile the file with 'g++ sorting.cpp'

The .dat file that is sorted for this program is rather large and not uploaded to Github. You could probably use any .dat file. A sample .dat file will be provided but it will not be long enough to use for comparing the different sort functions.

Once you have a .dat file, update the file path that is being read at line 40. Run the code with './a.out X Y'.

Where X is the amount of lines you want read and Y is one of the following:

  • 'MS' for Merge Sort
  • 'SS' for Selection Sort
  • 'IS' for Insertion Sort
  • 'QS' for Quick Sort

Sample Output of the Program:

$ ./a.out 500000 QS
STARTING FILE READ
.
.
.
STARTING QUICK SORT
STARTING WRITE TO FILE
.
.
.
FINISHED

Sample .dat File:

ywigqchzsdxkolmdkiughlggcoymlm
qwvlnibrlxviuwkhwrqvojgtfyvscz
rzhkcdeeyglpjsvbxoihkpceehcajl
oetgxalplemmsozpajvfkkknprrikg
nfbacypowevzqegnsfxobyejcczcmx
xkdmdtaxnwccaycrlbljnybkicdpzc
nlkbvzcagppkzrmhbaexgoqbnkuhhu
drjcbqfuzdcxaqlpnqbowqnagwkygj
cqguaiiurnmrzjbehjfcckpxxhqwsn
evlvcmttguailrgdfdiogmhjehbtpj
uwpsbvahlqysgyvulfybymdvclnuhg
fxmxoggeopeofllongxiscmrpeyhwj
eivnqterejwmwnbequlpcgowcodart
aqofnmqfmzmnqrklrzvjqlqtzhtbcj
auutxdwwelufpxhrzakhhcszpsiemn
rvdbnvfbxhywasfiuftaopifwfjhmg
rifsgefbqfzszhhkiiayltcramwjoa
ihszycysodkefnijomzdndyiszfjbq
uvbwywsvdkznxvbkthsebnrwerfcew
ummhnsjpeoissyjvsnatnmrhqkgska
wsoyfpnvjtzpmddnobbvlxxmjyklbf
wdvcmpjwxxqfkdlzupcfcjofmicsre
simypqzujbsjekbvwawxzvmpgsbuiu
bbyrwqqzgzbhdhzocxoogiiiszmgoq
eaqcvkombxixtwonhzgyohjdtdksno