write a program in java to print the frequency of all elements.PLEASE ANSWER PROPERLY
Answers
Answered by
0
Explanation:
JAVA
public class Frequency {
public static void main(String[] args) {
//Initialize array.
int [] arr = new int [] {1, 2, 8, 3, 2, 2, 2, 5, 1};
//Array fr will store frequencies of element.
int [] fr = new int [arr.length];
int visited = -1;
for(int i = 0; i < arr.length; i++){
Similar questions