Anonymous user
Sort three variables: Difference between revisions
added an algorithm (for numeric values only) to the task's preamble..
(added an algorithm (for numeric values only) to the task's preamble..) |
|||
Line 17:
z = 'lions, tigers, and'
<!-- Care was taken to use a leading lowercase letter so that EBCDIC and ASCII machines sort the literals in the same order. {Gerard Schildberger} !-->
For numeric value sorting, use:
I.E.: (for the three variables '''x''', '''y''', and '''z'''), where:
Line 46:
Θ extract the three elements from the array and place them in the
variables '''x''', '''y''', and '''z''' in order of extraction
Another algorithm (only for numeric values):
x= 77444
y= -12
z= 0
low= x
mid= y
high= z
x= min(low, mid, high) /*determine the lowest value of X,Y,Z. */
z= max(low, mid, high) /* " " highest " " " " " */
y= low + mid + high - x - z /* " " middle " " " " " */
Show the results of the sort here on this page using at least the values of those shown above.
|