The elements of the array are taken as input from the user. Then **the frequency of each element is counted separately and printed**.

```
INPUT: Array elements
OUTPUT: the frequency of each element
PROCESS:
Step 1: [taking the input]
Read n [number of elements]
For i=0 to n-1 repeat
Read a[i]
Set f[i]-1
[end of ‘for’ loop]
Step 2: [Counting the frequency of the elements of array]
For i=0 to n-1 repeat
Set c<- 1
For j=i+1 to n-1 repeat
If a[i]=a[j] then
Set c<-c+1
Set f[j]<-0
[End of ‘if’]
[End of ‘for’ loop]
If f[i]≠0 then
Set f[i]<-c
[End of ‘if’]
[End of ‘for’ loop]
Print "Frequency of the elements of array : "
For i=0 to n-1 repeat
If f[i]≠0 then
Print "The frequency of a[i] is f[i] "
[End of ‘if’]
[End of ‘for’ loop]
Step 3: Stop.
```

Related

- Find Maximum and Minimum from an array
- Kth Largest and Smallest Element
- 2nd largest element from the array
- Find how many negative numbers are present in the array
- The elements of the one array are copied to another array.
- Delete element from any position in array
- Find out the unique elements from the Array
- Finds odd and even elements from the array and stored in two separate arrays
- Counts the number of odd and even elements separately from the array
- Reverses the elements of an Array
- Merge two Array and stored in the third Array
- Rotated the Array at left
- Rotated the Array right
- Sorted the array and then separate even and odd elements in different array
- Sort number of strings in an array
- Check one given element of an array present more than n/2 times or not.
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays