Jump to content

Sorting algorithms/Shell sort: Difference between revisions

Line 1,002:
 
Because the value of a[i] ends up in a particular spot earlier in the array, it is common to store that value in a temporary variable, rather than use interchanges (swaps) to move the value through the array. Writing "safe" code to do it with a temporary variable, however, would have been tedious, so I used interchanges. One can always write the implementation "unsafely", however. This will still leave you with about as much "safety" as one would expect from most other languages.
 
Furthermore, there is no difficulty in using the temporary-variable approach, if the elements of the array are assumed to be non-linear ('''t@ype''' instead of '''vt@ype''').
 
=={{header|AutoHotkey}}==
1,448

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.