leader

A collection of 2 post

EquiLeader

Problem A non-empty array A consisting of N integers is given. The leader of this array is the value that occurs in more than half of the elements of A. An equi leader is an index S such that 0 ≤ S < N − 1 and two sequences A0, A1, …, AS and AS + 1, AS + 2, …, AN − 1 have leaders of the same value…

Dominator

Problem An array A consisting of N integers is given. The dominator of array A is the value that occurs in more than half of the elements of A. For example, consider array A such that The dominator of A is 3 because it occurs in 5 out of 8 elements of A (namely in those with indices 0, 2, 4, 6 and…