qsort_vrtx Subroutine

private recursive subroutine qsort_vrtx(list)

Quicksort for long integer kinds.

Arguments

Type IntentOptional Attributes Name
integer(kind=long_k), intent(inout) :: list(:)

list to be sorted


Source Code

  recursive subroutine qsort_vrtx( list )
    ! ---------------------------------------------------------------------------
    !> list to be sorted
    integer( kind=long_k ), intent(inout)  :: list(:)
    ! ---------------------------------------------------------------------------
    integer :: split
    ! ---------------------------------------------------------------------------

    ! recursive call of qsort
    if( size( list ) .gt. 1)then
      call partition( list, split )
      call qsort_vrtx( list( :split-1 ))
      call qsort_vrtx( list( split: ))
    end if

  end subroutine qsort_vrtx