logo

Crowdly

Browser

Додати до Chrome

Qual situação representa um cenário de melhor caso do método allDiff? // Whic...

✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.

Qual situação representa um cenário de melhor caso do método allDiff? //

Which situation represents a best-case scenario for the method allDiff?

/**

*

* @param numbers : an array that is filled up to position n-1

* @return true iff all the numbers are different

*/

public static boolean allDiff(int[] numbers,int n) {

int i=0;

while (i<n && diff(numbers[i],numbers,i,n))

i++;

return i==n;

}

private static boolean diff(int number, int[] numbers, int pos, int n) {

int i=pos+1;

while (i<n && number!=numbers[i])

i++;

return i==n;

}

0%
0%
0%
100%
0%
Більше питань подібних до цього

Хочете миттєвий доступ до всіх перевірених відповідей на moodle.fct.unl.pt?

Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!

Browser

Додати до Chrome