Sorting algorithms/Insertion sort: Difference between revisions
Content added Content deleted
Line 1,118: | Line 1,118: | ||
array_ptr_free (pf_arr, pfgc_arr | p_arr) |
array_ptr_free (pf_arr, pfgc_arr | p_arr) |
||
end</lang> |
end</lang> |
||
{{out}} |
|||
Sorting random numbers by their first digit, to demonstrate that the sort is stable. The numbers are stored in the array as linear strings (strings that must be explicitly freed), to demonstrate that the sort works with linear types. |
|||
<pre>$ patscc -DATS_MEMALLOC_LIBC -O3 insertion_sort_task_array_of_linear.dats && ./a.out |
|||
83 86 77 15 93 35 86 92 49 21 62 27 90 59 63 26 40 26 72 36 11 68 67 29 82 30 62 23 67 35 |
|||
15 11 21 27 26 26 29 23 35 36 30 35 49 40 59 62 63 68 67 62 67 77 72 83 86 86 82 93 92 90</pre> |
|||
=={{header|AutoHotkey}}== |
=={{header|AutoHotkey}}== |