Remove all elements smaller than the currently being added element ( remove useless elements )
while ( ( Qi . Count != 0 ) && arr [ i ] >= arr [ Qi [ Qi . Count - 1 ] ] ) Qi . RemoveAt ( Qi . Count - 1 ) ;