Sorting algorithms/Insertion sort: Difference between revisions
Content added Content deleted
m (added whitespace before the TOC (table of contents).) |
|||
Line 3: | Line 3: | ||
{{wikipedia|Insertion sort}} |
{{wikipedia|Insertion sort}} |
||
{{omit from|GUISS}} |
{{omit from|GUISS}} |
||
<br> |
|||
An <span style="font-family: serif">[[O]](''n''<sup>2</sup>)</span> sorting algorithm which moves elements one at a time into the correct position. |
An <span style="font-family: serif">[[O]](''n''<sup>2</sup>)</span> sorting algorithm which moves elements one at a time into the correct position. |
||
The algorithm consists of inserting one element at a time into the previously sorted part of the array, moving higher ranked elements up as necessary. |
The algorithm consists of inserting one element at a time into the previously sorted part of the array, moving higher ranked elements up as necessary. |
||
Line 24: | Line 26: | ||
Writing the algorithm for integers will suffice. |
Writing the algorithm for integers will suffice. |
||
<br><br> |
|||
=={{header|ACL2}}== |
=={{header|ACL2}}== |