Sorting algorithms/Insertion sort: Difference between revisions

m
added whitespace, used numbered bullet points.
m (→‎{{header|REXX}}: added whitespace and a comment, used a template for the output section.)
m (added whitespace, used numbered bullet points.)
Line 10:
 
Although insertion sort is an <span style="font-family: serif">[[O]](''n''<sup>2</sup>)</span> algorithm, its simplicity, low overhead, good locality of reference and efficiency make it a good choice in two cases: <br>
 
(i) small <span style="font-family: serif">''n''</span>, <br>
(ii):# as&nbsp; thesmall final finishing-off algorithm for&nbsp; <span style="font-family: serif">[[O]](''n'' log''n'')</span>, algorithms such as [[Merge sort|mergesort]] and [[quicksort]].<br>
:# &nbsp; as the final finishing-off algorithm for <span style="font-family: serif">[[O]](''n'' log''n'')</span> algorithms such as [[Merge sort|mergesort]] and [[quicksort]].
 
 
The algorithm is as follows (from [[wp:Insertion_sort#Algorithm|wikipedia]]):