This example shows how to sort a list of elements in-situ.

listToSort

RUN

selectionSort

Selection sort repeatedly iterates the list in order to take the maximal (or minimal) element of the part that needs to be sorted, and build a new list from the selected elements.

swap