Реализации алгоритмов/Сортировка/Быстрая: различия между версиями
Содержимое удалено Содержимое добавлено
Строка 41:
int partition (int[] array, int start, int end)
{
int
int marker = start;//divides left and right subarrays
for ( int i = start; i <= end; i++ )
{
if ( array[i] < array[end] )
{
array[marker] = array[i];
array[i] = temp;
Строка 52 ⟶ 53 :
}
}
//put pivot(array[end]) between left and right subarrays
return marker - 1;▼
temp = array[marker];
array[marker] = array[end];
array[end] = temp;
}
|