# Find elements larger than half of the elements in an array | Set 2

Given an array arr[] consisting of N positive integers, the task is to find the elements which are greater than at least half of the array elements.Examples:Input: arr[] = {1, 6, 3, 4}Output: 4 6Explanation:Size of the array is 4. The elements which are greater than atleast N/2(= 4/2 = 2) elements of the array are 4 and 6.Input: arr[] = {10, 4, 2, 8, 9}Output: 10 9 8Naive Approach: Please refer to the previous post of this article for the Naive Approach.Time Complexity: O(N2)Auxiliary Space: O(1)Sorting-based Approach: Please refer to the previous post of this article for the Sorting Based Approach.Time Complexity: O(N*log N)Auxiliary Space: O(1)Approach: The above approach can also be optimized by using Hashing by keeping track of the count of array elements. After finding the frequency of each element, print elements in non-increasing order till N/2 elements have been printed. Follow the steps below to solve the problem:Below is the implementation of the above approach:C++#include using namespace std;void findLarger(int arr[], int n){        int mid = (n + 1) / 2;        int mx = *max_element(arr, arr + n);            int count[mx + 1] = { 0 };    for (int i = 0; i < n; i++) {        count[arr[i]]++;    }            for (int i = mx; i >= 0; i–) {        while (count[i] > 0) {                                    count[i]–;            mid–;                        cout 