Doublehranch5402 Doublehranch5402
  • 24-02-2020
  • Computers and Technology
contestada

g what does the following piece of code do a) Print the duplicate elements in the array b) Print the element with maximum frequency c) Print the unique elements in the array d) None of the mentioned

Respuesta :

colocho08
colocho08 colocho08
  • 03-03-2020

Answer:

a) Print the duplicate elements in the array

Explanation:

I found this code:

This is two for cycle, where we make a comparison among two variables i and j to print duplicate elements.

for (int i=0; i < arr.length-1; i++)

{

for (int j = i+1; j < arr.length; j++)

 {

   if (( arr[i].equals(arr[j])) && (i != j))

       {

         System.out.println(arr[i])

}

}

}

Answer Link

Otras preguntas

What is the estimate of 1/2+1/6?
A wildlife reserve had 8 elephant calves born during the summer and now has 31 total elephants. How many elephants were in the reserve before summer began. Writ
2.) Simplify. -3m - 7n + 10m + 4n
write a thesis statement for a research paper about Ronald Reagan.
Resources that were created over millions of years from the remains of prehistoric plants and animals are called
If the graph of the function h defined by =hx+−4x23 is translated vertically downward by 9 units, it becomes the graph of a function f . Find the expressio
What effect does the setting of Bag-End have on the plot in the beginning of The Hobbit? A.It helps establish the easy, safe lifestyle that Bilbo is used to. B.
do chromosome mutations occur during nuclear division
name an influencial philosopher in the european dark ages.
A historian wants to learn more about how laborers in Egypt lived. Which document would be the best for her to study? a pharaoh's letter to his son about how to