Reverse a List
toolbar-separator.png This page has been deleted from the main contents of the wiki, and moved to the deleted: namespace as a record of its contents. Rather than adding content to this page, please put it somewhere where it will actually have a use. In addition, please avoid linking to this page.

Routine Summary

Reverses the order of elements in a list.

Inputs

L₁

Outputs

L₁

Variables Used

M,X

Calculator Compatibility

TI-83/84/+/SE/CSE/CE

Author

kg583

:dim(L₁→M
:For(L,1,int(M/2
:L₁(L→Z
:L₁(M-L+1→L₁(L
:Z→L₁(M-L+1
:End

This routine will quickly reverse L₁. It works by swapping pairs of elements that are equidistant from the center of the list, and uses no other lists as dummy variables.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Noncommercial-No Derivative Works 2.5 License.