Sorting algorithms/Bubble sort: Difference between revisions
Content added Content deleted
m (AWK example update: Customarily arrays in Awk start with index 1, not index 0) |
m (→{{header|AWK}}: Update commentary) |
||
Line 218: | Line 218: | ||
}</lang> |
}</lang> |
||
GNU awk contains built in |
GNU awk contains built in functions for sorting, but POSIX |
||
Awk doesn't. Here is a generic bubble sort() implementation that you |
|||
can copy/paste to your |
|||
Awk programs. Adapted from the above example. Note that it |
|||
is not possible to return arrays from Awk functions so the |
is not possible to return arrays from Awk functions so the |
||
array is "edited in place". The extra parameters passed in |
array is "edited in place". The extra parameters passed in |