Question
A plurality of an array is the number that occurs more than any other number. For example, in the array [4, 5, 6, 7, 4,
A plurality of an array is the number that occurs more than any other number. For example, in the array [4, 5, 6, 7, 4, 5, 4], number 4 is the plurality (because 4 occurs most frequently). In the array [3, 5, 6, 7, 3, 5], there is no plurality (because 3 & 5 both occur most frequently).
Give an algorithm to find the plurality of an n length array, or report that no plurality exists. What is the complexity of your algorithm?
Rubric:
No points for an incorrect algorithm.
Scores for a correct algorithm will depend on the complexity. Obviously, the faster the algorithm, the higher is your score.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started