13.07.2015 Views

Corretude - UFCG

Corretude - UFCG

Corretude - UFCG

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Introdução Indução Algoritmos Recursivos Algoritmos IterativosExemplo 11Considere o algoritmo Insertion-Sort abaixo.Insertion-Sort(A)1 for j = 2 to A.length2 key = A[j]3 / Insere A[j] na sequencia ordenada A[1 . . j − 1].4 i = j − 15 while i > 0 and A[i] > key6 A[i + 1] = A[i]7 i = i − 18 A[i + 1] = keyProf. Dr. Leandro Balby Marinho 29 / 44 <strong>UFCG</strong> CEEI

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!