Baixe o app para aproveitar ainda mais
Prévia do material em texto
Lista de PAA ----- Yan Dumont -------- 1-Qual a notação sigma equivalente à seguinte progressão? 5 + ( ―5) + ( ―15) + .... + ( ―745) + ( ―755) 2-Avalie o somatório ∑𝑛 𝑖= 11 3- Resolva a seguinte equação de recorrência T(n) = T(n - 1) + 2; n > 0 T(0) = 1 4- class Exercicio4 { public static void main(String[] args) { int[] arrayA = { 24, 21, 11, 9, 8, 3 }; int[] arrayB = { 37, 19, 15, 12, 4, 2 }; int t = 0; int j = 0; System.out.println(" "); System.out.print("Arranjo A: "); for (int i = 0; i < arrayA.length; i++) { System.out.print(arrayA[i] + " "); } System.out.print("\n\nArranjo B: "); for (int i = 0; i < arrayB.length; i++) { System.out.print(arrayB[i] + " "); } System.out.println("\n"); for (int i = 0; i < arrayA.length + arrayB.length - 1; i++) { if (arrayA[t] > arrayB[j]) { System.out.println(arrayA[t] + " é maior que " + arrayB[j]); t = t + 1; } else { System.out.println(arrayB[j] + " é maior que " + arrayA[t]); j = j + 1; } } System.out.println("\n "); } } Explicação: No código acima, temos dois arranjos que possuem números diferentes, e após printar esses valores separadamente, ele compara o valor das posições do arranjos para achar o n -esimo maior numero entre os dois arranjos. Resultado:
Compartilhar