APA activity. Implementation of sorting methods: Selection Sort, Insertion Sort, Quick Sort, Merge Sort, Heap Sort, Counting Sort and Radix Sort.
-
The compilation of the file is as simple as it follows: Go straight to the root of the project using the terminal and enter the command make.
-
In order to run the program properly, you must run it from the terminal by typing the following parameters according to which sorting method and which way to select the numbers you want to use: ./SortingNumbers "1st param" "2nd param" "3rd param" "4th param"
-
The parameters must be chosen as it follows:
- 1st: "-sort".
- 2nd: "-s", "-i", "-q", "-m", "-h", "-c" or "-r" indicating Selection Sort, Insertion Sort, Quick Sort, Merge Sort, HeapSort, Counting Sort or Radix Sort, respectively.
- 3rd: "-r", "-c" or "-f" indicating Random Selection, Chosen Selection or Reading From File Selection of numbers.
- 4th(Optional): "Integer Number" indicating how many numbers you want to sort. In case you are reading from file ("-f" argument), the number of numbers inputed must be at the beginning of it.
- ./SortingNumbers -sort -s -r 10 ---> Here you will sort an amount of 10 numbers chosen randomly by using the Selection Sort method.
- ./SortingNumbers -sort -i -c 20 ---> On the other hand, you will have to choose 20 numbers that will be sorted by the Insertion Sort method.
- ./SortingNumbers -sort -i -f < file.txt --> Reading from a file (a .txt file for example), the argument that succeds "<" must be the file path (in the example the file is in the root of the project).