Discuss an elements-tests of equality


Discussion:

Q: Let A be an array of n elements. An element x is said to be a majority element in A if it occurs in A more than n/2 times. Assume that the only comparisons allowed between elements are tests of equality. Give an algorithm that uses no more than 2n comparisons to determine whether the array A contains a majority element and, if so, find it.

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Discuss an elements-tests of equality
Reference No:- TGS01931912

Now Priced at $20 (50% Discount)

Recommended (90%)

Rated (4.3/5)