Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
(Add AWK generic sort() function for grab-and-use) |
(→{{header|AWK}}: Fix markup) |
||
Line 218: | Line 218: | ||
}</lang> |
}</lang> |
||
GNU awk contains built in sort() functions, but for POSIX awk, |
|||
here is a simple bubblesort (adapted from above). Note, it |
|||
is not possible to return arrays from function, so the |
|||
array is "edited in place". The extra parameters passed in |
|||
function argument lists is well known trick to use local |
|||
variables. |
|||
⚫ | |||
<lang awk> |
|||
⚫ | |||
# Licensed and released under GPL-2+ http://spdx.org/licenses/ |
# Licensed and released under GPL-2+ http://spdx.org/licenses/ |
||
Line 263: | Line 266: | ||
exit |
exit |
||
} |
} |
||
</lang> |
|||
=={{header|BASIC}}== |
=={{header|BASIC}}== |