Given an array A,compute  B s.t B[i] stores the nearest element to the right of A[i] which is smaller than A[i]
Given an array A,compute  B s.t B[i] stores the nearest element to the left of A[i] which is smaller than A[i]