Sorting algorithms/Heapsort: Difference between revisions

Content added Content deleted
m (→‎version 2: added a 2nd output to show the sorting of numbers.)
m (→‎version 1: changed the wording in the REXX (version1) section header.)
Line 2,836: Line 2,836:
=={{header|REXX}}==
=={{header|REXX}}==
===version 1===
===version 1===
This REXX version uses a heapsort to sort elements of an array, the elements can be numbers or strings.
This REXX version uses a heapsort to sort elements of an array, the elements can be numbers or character strings.

<br>Indexing of the array (for this version) starts with &nbsp; '''1''' &nbsp; (one), &nbsp; but can be programmed to start with zero.
Indexing of the array (for this version) starts with &nbsp; '''1''' &nbsp; (one), &nbsp; but can be programmed to start with zero.
<lang rexx>/*REXX program sorts an array (names of modern Greek letters) using a heapsort algorithm*/
<lang rexx>/*REXX program sorts an array (names of modern Greek letters) using a heapsort algorithm*/
@.=; @.1='alpha' ; @.6 ="zeta" ; @.11='lambda' ; @.16="pi" ; @.21='phi'
@.=; @.1='alpha' ; @.6 ="zeta" ; @.11='lambda' ; @.16="pi" ; @.21='phi'