*The algorithm for first phase that works in O(n) is known as Moore’s Voting Algorithm. Basic idea of the algorithm is if we cancel out each occurrence of an element e with all the other elements that are different from e then e will exist till end if it is a majority element. findCandidate(a[], size) 1. Initialize index and count of majority element maj_index = 0, count = 1 2. Loop for i = 1 to size – 1 (a)If count == 0 maj_index = i; count = 1 (b)If a[maj_index] == a[i] count++ (c)Else count--; 3. Return a[maj_index] --*

**1.Finding a Candidate:***printMajority (a[], size) 1. Find the candidate for majority 2. If candidate is majority. i.e., appears more than n/2 times. Print the candidate 3. Else Print "NONE" comments powered by Disqus*

**2. Check if the element obtained in step 1 is majority**