Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(inout) | :: | array(0:) | |||
logical, | intent(in), | optional | :: | reverse |
pure module subroutine char_sort(array, reverse) !! `char_sort( array[, reverse] )` sorts the input `ARRAY` of type `character(len=*)` !! using a hybrid sort based on the `introsort` of David Musser. !! The algorithm is of order O(N Ln(N)) for all inputs. !! Because it relies on `quicksort`, the coefficient of the O(N Ln(N)) !! behavior is small for random data compared to other sorting algorithms. implicit none character(len=*), intent(inout) :: array(0:) logical, intent(in), optional :: reverse end subroutine char_sort