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

Meteoroids usually come from?
87% of 102= n what S n
how do the cells in your body get energy ( in the shortest way to answer please)
What is the potential energy of a spring that is compressed 0.65 m by a 25 kg block if the spring constant is 95 N/m?
Iba constructed a triangle ABC in her notebook. AB was 12 centimeters long. BC was 10 centimeters long. Select all measurements that could be the length of AC.
There is much interdependence among the biogeochemical cycles on Earth. How is warmer ocean water involved in these cycles?
It takes earth blank to complete one revolution around the sun
Bonding due to sharing of electrons is A-ionic bond B-covalent bond C-nuclear bond D- metallic bond
Which phrase best completes this sentence? En ____________ los almacenes están al aire libre. el supermercado el mall la feria artesanal la librería
In the diagram, VW = 3, WX = 4, and VX = 8. Is line WX tangent to point V?