Sorting algorithms/Insertion sort: Difference between revisions

Content added Content deleted
Line 860: Line 860:


===For arrays whose elements must not be of linear type===
===For arrays whose elements must not be of linear type===

This implementation finds the position at which the element is to be inserted, and then uses '''array_subcirculate''' to move it into place. The prelude's implementation of '''array_subcirculate''' is a '''memmove(3)'''.


<lang ATS>#include "share/atspre_staload.hats"
<lang ATS>#include "share/atspre_staload.hats"