searching an array by dividing it