Just an illustration of sorting algorithms.
Compile and run the test utility
$ gfortran -Ofast quicksort.f90 mergesort.f90 radixsort.f90 driver_sort.f90 -o sort.exe
$ ./sort.exeProgram asks for the number of items to sort and prints the running time of all algorithms.
The individual sorting routines can be used separately in other applications, cf this example:
use mergesort_module
use quicksort_module
use radixsort_module
:
integer :: A(100)
:
call mergesort(A)
call quicksort(A, MODE_HOARE) ! "mode" argument is optional
call quicksort(A, MODE_LOMUTO)
call radixsort(A)
call radixsort_msb(A)MIT license applies. Provided "as is", without warranty.