资 源 简 介
设T[0:n-1]是n个元素的一个数组。对任一元素x,设S(x)={i|T[i]=x}。当|S(x)|>n/2时,称x为T的主元素。设计一个线性时间算法,确定T[0:n]是否有一个主元素。-Set T [0: n-1] is the n elements of an array. Of any element x, set S (x) = (i | T [i] = x). When | S (x) |> n/2 when x for T said the main element. Design a linear time algorithm to determine the T [0: n] whether there is a main element.