_stan
Ominide
1 min. di lettura
Vota

Concetti Chiave

  • The method checks if any element of the vector is present in the matrix, returning TRUE if none are found.
  • The input consists of a matrix M and a vector V, which the method examines.
  • If an element of the vector is found in the matrix, the method returns FALSE immediately.
  • The method iterates through both the array and the matrix to perform the check.
  • Example given: if vector elements are 20, 30, 40, 50, 60 and absent in the matrix, the method returns TRUE.

Tema 67

Scrivere un metodo verificaCheNessunElementoDelVettoreSiaPresenteNellaMatrice che riceve in ingresso una matrice M ed un vettore V e restituisce TRUE se nessun elemento del vettore presente nella matrice; FALSE altrimenti.

Ad esempio, siano M e V rispettivamente una matrice e un vettore cos costituiti

0 1 2 3
4 5 6 7
8 9 10 11
12 13 14 15
20 30 40 50 60
allora verificaCheNessunElementoDelVettoreSiaPresenteNellaMatrice (M, V) = TRUE

 public class tema67{ public static boolean verificaCheNessunElementoDelVettoreSiaPresenteNellaMatrice (int[][] M, int[] V){ // in questo caso baster scorrere larray e la matrice e appena un elemento // dellarray dovesse trovarsi // nella matrice far restituire false for (int k = 0; k    

Domande e risposte

Hai bisogno di aiuto?
Chiedi alla community