Question: Example 6 / * * Returns false if there is any element common to two arrays. * / public static boolean example 6 ( int

Example 6
/** Returns false if there is any element common to two arrays. */
public static boolean example6(int[] data){
int n = data.length;
for (int j=0; j < n-1; j++)
for (int k=j+1; k < n; k++)
if (data[j]== data[k])
return false; // found duplicate pair
return true; // if we reach this, elements are unique
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!