Write a resolution function for an n input voters, voting on n positive bytes inputs. The output will take the byte value that appears on the majority of the inputs, with a tolerance of t. The tolerance allows inputs to be different by this value and still be considered as equal. This constant is defined in the resolution function.
Answers
Answered by
8
Input : {3, 3, 4, 2, 4, 4, 2, 4, 4}
Output : 4
Explanation: The frequency of 4 is 5 which is greater
than the half of the size of the array size.
Input : {3, 3, 4, 2, 4, 4, 2, 4}
Output : No Majority Element
Explanation: There is no element whose frequency is
greater than the half of the size of the array size.
Answered by
0
Answer:
no majority element...................................................
Similar questions