function longRunningFunction(array) { for ( i = 0; i < length(array); i++ ) { idx = i for ( j = i + 1; j < length(array); j++ ) { if ( array[idx] > array[j] ) { idx = j } } swap( array[i], array[idx] ) } }