Sorting algorithms/Insertion sort: Difference between revisions
Content deleted Content added
Added Oz. |
→{{header|TI-83 BASIC}}: Added ti83b |
||
Line 588: | Line 588: | ||
insertion_sort Int.compare [6,8,5,9,3,2,1,4,7];</lang> |
insertion_sort Int.compare [6,8,5,9,3,2,1,4,7];</lang> |
||
=={{header|TI-83 BASIC}}== |
|||
Store input in L<sub>1</sub>, run prgmSORTINS, get output in L<sub>2</sub>. |
|||
:L<sub>1</sub>→L<sub>2</sub> |
|||
:0→A |
|||
:Lbl L |
|||
:A+1→A |
|||
:A→B |
|||
:While B>0 |
|||
:If L<sub>2</sub>(B)<L<sub>2</sub>(B+1) |
|||
:Goto B |
|||
:L<sub>2</sub>(B)→C |
|||
:L<sub>2</sub>(B+1)→L<sub>2</sub>(B) |
|||
:C→L<sub>2</sub>(B+1) |
|||
:B-1→B |
|||
:End |
|||
:Lbl B |
|||
:If A<(dim(L<sub>2</sub>)-1) |
|||
:Goto L |
|||
:DelVar A |
|||
:DelVar B |
|||
:DelVar C |
|||
:Stop |
|||
=={{header|Tcl}}== |
=={{header|Tcl}}== |