Language: EN FI

Exercises > Selection Sort

These exercises demonstrate the content of the ByTheMark service. These are meant for private individuals for learning data structures and algorithms. If you want to try out more content, you can register to the ByTheMark Personal free of charge.

Apply selection sort to the Input table below.

SelectionSort(a)
1 for i = 0 to n-2 do
2  min = i
3  for j = i+1 to n-1 do
4   if (a[j] < a[min]) do
5     min = j
6  swap a[i] and a[min]

  Last modified Tue Mar 01 20:54:04 EET 2011