Magna Concursos
2895251 Ano: 2022
Disciplina: Engenharia Eletrônica
Banca: IADES
Orgão: UNDF

//start –> Starting index, end --> Ending index

Quicksort(array, start, end)

{

if (start < end)

{

pIndex = Partition(A, start, end)

Quicksort(A,start,pIndex-1)

Quicksort(A,pIndex+1, end)

}

}

partition (array, start, end)

{

// Setting rightmost Index as pivot

pivot = arr[end];

i = (start - 1) // Index of smaller element and indicates the

// right position of pivot found so far

for (j = start; j <= end- 1; j++)

{

// If current element is smaller than the pivot

if (arr[j] < pivot)

{

i++; // increment index of smaller element

swap arr[i] and arr[j]

}

}

swap arr[i + 1] and arr[end])

return (i + 1)

}

Considerando as rotinas apresentadas, escritas em pseudocódigo, assinale a alternativa que indica o que faz numa lista de números inteiros.

 

Provas

Questão presente nas seguintes provas

Professor - Automação e Controle

60 Questões