For arr [ 2 , 10 ] , we compare arr [ lookup [ 0 , 3 ] ] and arr [ lookup [ 3 , 3 ] ]
if ( arr [ lookup [ i , j - 1 ] ] < arr [ lookup [ i + ( 1 << ( j - 1 ) ) , j - 1 ] ] ) lookup [ i , j ] = lookup [ i , j - 1 ] ; else lookup [ i , j ] = lookup [ i + ( 1 << ( j - 1 ) ) , j - 1 ] ; } } }