Dados los vectores
Enviado por jjvallejosr • 22 de Junio de 2015 • Tarea • 385 Palabras (2 Páginas) • 245 Visitas
Dados los vectores
N = 10 ELEMENTOS
PRUEBA DE ORDENACION DE U
k = 1 , 2, 3, . . . . 9
i = 0, 1, 2, . . . . 8
U[0] > U[1] = 821 > 858 ==> Falso
0 1 2 3 4 5 6 7 8 9
821 858 342 774 329 898 649 466 567 480
________________________________________
i = 0, 1, 2, . . . . 8
U[1] > U[2] = 858 > 342 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 858
U[1] = 342
U[2] = 858
0 1 2 3 4 5 6 7 8 9
821 342 858 774 329 898 649 466 567 480
________________________________________
i = 0, 1, 2, . . . . 8
U[2] > U[3] = 858 > 774 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 858
U[2] = 774
U[3] = 858
0 1 2 3 4 5 6 7 8 9
821 342 774 858 329 898 649 466 567 480
________________________________________
i = 0, 1, 2, 3, . . . . 8
U[3] > U[4] = 858 > 329 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 858
U[3] = 329
U[4] = 858
0 1 2 3 4 5 6 7 8 9
821 342 774 329 858 898 649 466 567 480
________________________________________
i = 0, 1, 2, 3, 4, . . . . 8
U[4] > U[5] = 858 > 898 ==> Falso
0 1 2 3 4 5 6 7 8 9
821 342 774 329 858 898 649 466 567 480
________________________________________
i = 0, 1, 2, 3, 4, 5, . . . . 8
U[5] > U[6] = 898 > 649 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 898
U[5] = 649
U[6] = 898
0 1 2 3 4 5 6 7 8 9
821 342 774 329 858 649 898 466 567 480
________________________________________
i = 0, 1, 2, 3, 4, 5, 6, . . . . 8
U[6] > U[7] = 898 > 466 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 898
U[6] = 466
U[7] = 898
0 1 2 3 4 5 6 7 8 9
821 342 774 329 858 649 466 898 567 480
________________________________________
i = 0, 1, 2, 3, 4, 5, 6, 7, 8
U[7] > U[8] = 898 > 567 ==> Verdadero
TMP = U[i]
U[i] = U[i+1]
U[i+1] = U[i]
TMP = 898
U[7] = 567
U[8] = 898
...