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

This program shows young offenders how terrible prison life is. a. extradition c. parole b. shock probation d. shock incarceration
What happened on March 2nd that may have angered Bostonian
who were the cunningham boys and what happened to them? whats the irony here
Given the function f(x) = −2x + 8, find x if f(x) = 14 ...?
solve for d when 2x-2yd=y+xd ...?
name the respiratory system three main component
Give the excluded value(s) for the following fraction. y+5/y^2+4y-32
Ann and Betty together have $60. Ann has $9 more than twice Betty's amount. How much money does each have?
A bedroom set lists for $12,000 and carries a trade discount of 30 percent. Freight (FOB shipping point) of $150 is not part of list price. Calculate the deliv
Assume that x and y are both differentiable functions of t and find the required values of dy/dt and dx/dt. y = √x (a) Find dy/dt, given x = 16 and dx/dt = 7