The elements of the array are taken as input. **One value is taken from the user and that value is searched in the array whether it appears more than n/2 times in the array or not**, where n is the number of elements of the array.

```
INPUT: Array elements
OUTPUT: the frequency of an element more than n/2 or not
PROCESS:
Step 1: [taking the input]
Read n [number of elements]
For i=0 to n-1 repeat
Read a[i]
[end of ‘for’ loop]
Read x [the element to search]
Step 2: [calculating the frequency of the element in array]
Set c<-0
For i=0 to n-1 repeat
If a[i]=x then
Set c<-c+1
[End of ‘if’]
[End of ‘for’ loop]
If c>n/2 then
Print “Yes, the element x is present more than n/2 times in the array”
Else
Print “No, the element x does not occur more than n/2 times in the array”
[End of ‘if’]
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
- Frequency of each element in the 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
- Sum of the elements of an Array is calculated using a pointer
- The union and intersection between the two given arrays