I have an input array A
A[0], A[1], ... , A[N-1]
I need the Max (T, A) function, which returns B, represents the maximum value on A compared to the previous moved window of size T, where
B[i+T] = Max(A[i], A[i+T])
Using the maximum heap to track the maximum value for the current moving windows A [i] to A [i + T], this algorithm gives the worst case O (N log (T)).
I would like to know if there is a better algorithm? Perhaps the O (N) algorithm
heap arrays algorithm max min
ipoppo
source share