Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 744 Bytes

File metadata and controls

34 lines (25 loc) · 744 Bytes

Sorting algorithms in Fortran

Just an illustration of sorting algorithms.

Usage

Compile and run the test utility

$ gfortran -Ofast quicksort.f90 mergesort.f90 radixsort.f90 driver_sort.f90 -o sort.exe
$ ./sort.exe

Program 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)

License

MIT license applies. Provided "as is", without warranty.