Sorting algorithms/Counting sort: Difference between revisions
→version 2: Take care of empty list
Deadmarshal (talk | contribs) Tag: Made through Tor |
Walterpachl (talk | contribs) (→version 2: Take care of empty list) |
||
Line 3,160:
===version 2===
{{trans|PL/I}}
<syntaxhighlight lang="rexx">/* REXX ---------------------------------------------------------------
* 13.07.2014 Walter Pachl translated from PL/I
* 27.05.2023 Walter Pachl take care of bad lists
*--------------------------------------------------------------------*/
Parse Arg alist
alist='999 888 777 1 5 13 15 17 19 21 5'▼
If alist='*' Then
▲ alist='999 888 777 1 5 13 15 17 19 21 5'
Select
When alist='' Then Call exit 'List is empty'
When words(alist)=1 Then Call exit 'List has only one element:' alist
Otherwise Nop
End
Parse Var alist lo hi .
Do i=1 By 1 While alist<>''
Line 3,210 ⟶ 3,212:
End
Say ol
Return
exit:
Say arg(1)
</syntaxhighlight>
'''Output:'''
<pre>before count_sort
|