Update the algorithm with find the element in the array which
greater than left element and smaller than right element
update the algorithm with soultion method